Fix siemens tool table & connect
This commit is contained in:
@@ -3739,10 +3739,7 @@ namespace CMS_CORE_Library.Fanuc
|
||||
//Read Language from NC PARAM
|
||||
cmsError = NC_RParam((short)PARAM_LING_FANUC.Address, ref FanucLanguage);
|
||||
if (cmsError.IsError())
|
||||
{
|
||||
MessageBox.Show(cmsError.localizationKey);
|
||||
return cmsError;
|
||||
}
|
||||
|
||||
//Execute the method
|
||||
nReturn1 = Focas1.cnc_sysinfo(nLibHandle[0], tmpNode);
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using static CMS_CORE_Library.Models.DataStructures;
|
||||
using static CMS_CORE_Library.Nc;
|
||||
@@ -75,7 +76,6 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
// Alarms Handler
|
||||
private AlarmSvc SiemensAlmSvc = null;
|
||||
|
||||
private Alarm[] SiemensAlarms;
|
||||
|
||||
// Tool table listeners
|
||||
@@ -123,9 +123,9 @@ namespace CMS_CORE_Library.Siemens
|
||||
public const string NC_FILE_PATH = "MPF.DIR";
|
||||
|
||||
// Test
|
||||
private static DataSvc AxesSvc = new DataSvc();
|
||||
private static DataSvc AxesSvc;
|
||||
|
||||
private static DataSvc SelectedProcessSvc = new DataSvc();
|
||||
private static DataSvc SelectedProcessSvc;
|
||||
|
||||
private static ushort SelectedProcess = 0;
|
||||
private static Dictionary<string, double> MachineAxesPosition = new Dictionary<string, double>();
|
||||
@@ -146,7 +146,7 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
public Nc_Siemens(ushort ConnectionTimeOut)
|
||||
{
|
||||
//Set Connected to FALSE and close the session
|
||||
// Set Connected to FALSE and close the session
|
||||
Connected = false;
|
||||
|
||||
//Setup timeout
|
||||
@@ -157,9 +157,16 @@ namespace CMS_CORE_Library.Siemens
|
||||
//Connect Method
|
||||
public override CmsError NC_Connect()
|
||||
{
|
||||
//Try to get information
|
||||
// Try to get information
|
||||
try
|
||||
{
|
||||
// InitializeSiemens objects
|
||||
if (AxesSvc == null)
|
||||
AxesSvc = new DataSvc();
|
||||
|
||||
if (SelectedProcessSvc == null)
|
||||
SelectedProcessSvc = new DataSvc();
|
||||
|
||||
//Check if Siemens Environment is started
|
||||
CmsError cmsError = CheckSiemensEnv();
|
||||
if (cmsError.IsError())
|
||||
@@ -4362,7 +4369,7 @@ namespace CMS_CORE_Library.Siemens
|
||||
SiemensToolModel tool = ToolTableData[toolIndex];
|
||||
if (tool.LifeType == SIEMENS_LIFE_TYPE.TIME)
|
||||
{
|
||||
ToolTableData[toolIndex]
|
||||
tool
|
||||
.EdgesData[edgeIndex]
|
||||
.PreAlmLife = Convert.ToDouble(actualString.Split('=').LastOrDefault());
|
||||
}
|
||||
@@ -4433,7 +4440,7 @@ namespace CMS_CORE_Library.Siemens
|
||||
SiemensToolModel tool = ToolTableData[toolIndex];
|
||||
if (tool.LifeType == SIEMENS_LIFE_TYPE.WEAR)
|
||||
{
|
||||
ToolTableData[toolIndex]
|
||||
tool
|
||||
.EdgesData[edgeIndex]
|
||||
.ResidualLife = Convert.ToDouble(actualString.Split('=').LastOrDefault());
|
||||
}
|
||||
@@ -4517,20 +4524,25 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
case "$TC_DP25":
|
||||
{
|
||||
// Get tool general information
|
||||
var toolInfo = Convert.ToInt32(actualString.Split('=').LastOrDefault());
|
||||
SiemensToolModel tool = ToolTableData[toolIndex];
|
||||
// Sets tool value only with the first edge value
|
||||
if (tool.EdgesData[edgeIndex].Id == 1)
|
||||
{
|
||||
// Get tool general information
|
||||
var toolInfo = Convert.ToInt32(actualString.Split('=').LastOrDefault());
|
||||
|
||||
// Convert rotation data
|
||||
ROTATION rotation = ROTATION.NONE;
|
||||
if (GetBitValue(toolInfo, 9))
|
||||
rotation = ROTATION.CLOCKWHISE;
|
||||
else if (GetBitValue(toolInfo, 10))
|
||||
rotation = ROTATION.COUNTERCLOCKWHISE;
|
||||
// Set new data
|
||||
// Convert rotation data
|
||||
ROTATION rotation = ROTATION.NONE;
|
||||
if (GetBitValue(toolInfo, 9))
|
||||
rotation = ROTATION.CLOCKWHISE;
|
||||
else if (GetBitValue(toolInfo, 10))
|
||||
rotation = ROTATION.COUNTERCLOCKWHISE;
|
||||
// Set new data
|
||||
|
||||
ToolTableData[toolIndex].Cooling1 = GetBitValue(toolInfo, 11);
|
||||
ToolTableData[toolIndex].Cooling2 = GetBitValue(toolInfo, 12);
|
||||
ToolTableData[toolIndex].Rotation = rotation;
|
||||
tool.Cooling1 = GetBitValue(toolInfo, 11);
|
||||
tool.Cooling2 = GetBitValue(toolInfo, 12);
|
||||
tool.Rotation = rotation;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -4677,26 +4689,6 @@ namespace CMS_CORE_Library.Siemens
|
||||
case "$TC_TP9":
|
||||
outputTool.LifeType = (SIEMENS_LIFE_TYPE)Convert.ToInt32(actualString.Split('=').LastOrDefault());
|
||||
break;
|
||||
|
||||
case "$TC_TP25":
|
||||
{
|
||||
// Get tool general information
|
||||
var toolInfo = Convert.ToInt32(actualString.Split('=').LastOrDefault());
|
||||
|
||||
// Convert rotation data
|
||||
ROTATION rotation = ROTATION.NONE;
|
||||
if (GetBitValue(toolInfo, 9))
|
||||
rotation = ROTATION.CLOCKWHISE;
|
||||
else if (GetBitValue(toolInfo, 10))
|
||||
rotation = ROTATION.COUNTERCLOCKWHISE;
|
||||
// Set new data
|
||||
|
||||
outputTool.Cooling1 = GetBitValue(toolInfo, 11);
|
||||
outputTool.Cooling2 = GetBitValue(toolInfo, 12);
|
||||
outputTool.Rotation = rotation;
|
||||
}
|
||||
break;
|
||||
|
||||
case "$TC_TP_MAX_VELO":
|
||||
outputTool.MaxSpeed = Convert.ToDouble(actualString.Split('=').LastOrDefault(), numberFormat);
|
||||
break;
|
||||
@@ -4809,6 +4801,36 @@ namespace CMS_CORE_Library.Siemens
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "$TC_MOP6":
|
||||
{
|
||||
if (outputTool.LifeType == SIEMENS_LIFE_TYPE.WEAR)
|
||||
{
|
||||
outputTool
|
||||
.EdgesData[edgeIndex]
|
||||
.ResidualLife = Convert.ToDouble(actualString.Split('=').LastOrDefault());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "$TC_MOP15":
|
||||
{
|
||||
if (outputTool.LifeType == SIEMENS_LIFE_TYPE.WEAR)
|
||||
{
|
||||
outputTool
|
||||
.EdgesData[edgeIndex]
|
||||
.NominalLife = Convert.ToDouble(actualString.Split('=').LastOrDefault());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "$TC_MOP5":
|
||||
{
|
||||
if (outputTool.LifeType == SIEMENS_LIFE_TYPE.WEAR)
|
||||
{
|
||||
outputTool
|
||||
.EdgesData[edgeIndex]
|
||||
.PreAlmLife = Convert.ToDouble(actualString.Split('=').LastOrDefault());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "$TC_DP2":
|
||||
case "$TC_DP3":
|
||||
@@ -4830,7 +4852,6 @@ namespace CMS_CORE_Library.Siemens
|
||||
case "$TC_DP22":
|
||||
case "$TC_DP23":
|
||||
case "$TC_DP24":
|
||||
case "$TC_DP25":
|
||||
case "$TC_DPV":
|
||||
case "$TC_DPV3":
|
||||
case "$TC_DPV4":
|
||||
@@ -4863,6 +4884,29 @@ namespace CMS_CORE_Library.Siemens
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "$TC_DP25":
|
||||
{
|
||||
// Sets tool values with first edge value
|
||||
if(outputTool.EdgesData[edgeIndex].Id == 1)
|
||||
{
|
||||
// Get tool general information
|
||||
var toolInfo = Convert.ToInt32(actualString.Split('=').LastOrDefault());
|
||||
|
||||
// Convert rotation data
|
||||
ROTATION rotation = ROTATION.NONE;
|
||||
if (GetBitValue(toolInfo, 9))
|
||||
rotation = ROTATION.CLOCKWHISE;
|
||||
else if (GetBitValue(toolInfo, 10))
|
||||
rotation = ROTATION.COUNTERCLOCKWHISE;
|
||||
// Set new data
|
||||
|
||||
outputTool.Cooling1 = GetBitValue(toolInfo, 11);
|
||||
outputTool.Cooling2 = GetBitValue(toolInfo, 12);
|
||||
outputTool.Rotation = rotation;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5290,6 +5334,7 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
#endregion Siemens Tool private functions
|
||||
|
||||
|
||||
#region Multitool Private region
|
||||
|
||||
private void MultitoolsNumber_OnChange(Guid guid, Item item, DataSvcStatus status)
|
||||
|
||||
Reference in New Issue
Block a user