Added unit of measure

Fix siemens axes names and added axes type
This commit is contained in:
Lucio Maranta
2018-12-14 16:28:16 +00:00
parent 10115ad59c
commit effae21fa8
6 changed files with 157 additions and 109 deletions
+9
View File
@@ -319,6 +319,15 @@ namespace CMS_CORE_Library.Demo
return NO_ERROR;
}
// Get NC unit of measure
public override CmsError NC_RUnitOfMeasure(ref string unitOfMeasure)
{
unitOfMeasure = "mm";
return NO_ERROR;
}
#endregion High level methods
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+13
View File
@@ -446,6 +446,19 @@ namespace CMS_CORE_Library.Fanuc
return NO_ERROR;
}
// Get NC unit of measure
public override CmsError NC_RUnitOfMeasure(ref string unitOfMeasure)
{
bool val = false;
CmsError cmsError = MEM_RWBoolean(R, 0, MEMORY_TYPE.Fanuc_F, 2, 0, ref val);
if (cmsError.IsError())
return cmsError;
unitOfMeasure = val ? "inch" : "mm";
return NO_ERROR;
}
#endregion High level methods
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+7 -1
View File
@@ -159,6 +159,7 @@ namespace CMS_CORE_Library.Models
public int Id;
public string Name;
public bool IsSelectable;
public AXIS_TYPE Type;
}
public class PreviewFileModel
@@ -201,7 +202,12 @@ namespace CMS_CORE_Library.Models
WAITING_OPERATOR = 2,
CLOSING = 3
}
public enum AXIS_TYPE
{
LINEAR = 0,
ROTATING = 1
}
#endregion Data structure models
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+3
View File
@@ -284,6 +284,9 @@ namespace CMS_CORE_Library
public abstract CmsError NC_SetScreenVisible(SCREEN_PAGE screen);
// Get NC unit of measure
public abstract CmsError NC_RUnitOfMeasure(ref string unitOfMeasure);
#endregion NC High-level data (to override)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+8
View File
@@ -408,6 +408,14 @@ namespace CMS_CORE_Library.Osai
return NO_ERROR;
}
// Get NC unit of measure
public override CmsError NC_RUnitOfMeasure(ref string unitOfMeasure)
{
unitOfMeasure = "mm";
return NO_ERROR;
}
#endregion High-level Methods
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+117 -108
View File
@@ -48,6 +48,8 @@ namespace CMS_CORE_Library.Siemens
private const string JOG_INCR_PATH = "/Channel/GeometricAxis/actIncrVal";
private const string ADVANCED_JOG_PATH = "/Channel/State/machFunc";
private const string RELATIVE_POS_PATH = "/Channel/GeometricAxis/actToolBasPosEN";
private const string UNIT_OF_MEASURE = "/Nck/Configuration/basicLengthUnit";
private const string ACT_PROG_LINES_PATH = "/Channel/ProgramInfo/actPartProgram";
private const string ACT_PROG_NAME_PATH = "/Channel/ProgramPointer/progName";
@@ -69,7 +71,7 @@ namespace CMS_CORE_Library.Siemens
private static uint ConfChannelNo;
private static uint MaxChannelNo;
private static uint SiemensLanguage;
private static List<int[]> ChannelAxesId;
private static string UnitOfMeasure;
// Alarms Handler
private AlarmSvc SiemensAlmSvc = null;
@@ -78,7 +80,7 @@ namespace CMS_CORE_Library.Siemens
// Tool table listeners
private static ToolMngmntSvc SiemensToolSvc = null;
private static DataSvc MagazinePositionSvc = null;
private static DataSvc MagazineActionsSvc = null;
@@ -112,15 +114,18 @@ namespace CMS_CORE_Library.Siemens
public static List<SiemensMagazineConfigModel> MagazineConfig = new List<SiemensMagazineConfigModel>();
private static List<AxisModel> AxesData = new List<AxisModel>();
public static uint multitoolsNumber = 0;
public static uint MAX_AXES_FOR_PROCESS = 20;
// File paths
public const string BASE_FILE_PATH = "//NC/";
public const string NC_FILE_PATH = "MPF.DIR";
public const string PART_PRG_PATH = "C:\\PartPrg\\";
// Test
private static DataSvc AxesSvc = new DataSvc();
private static DataSvc SelectedProcessSvc = new DataSvc();
private static ushort SelectedProcess = 0;
@@ -202,7 +207,7 @@ namespace CMS_CORE_Library.Siemens
private void ManageSelectedProcess(Guid guid, Item[] item, DataSvcStatus[] status)
{
// Set selectedProcess
for(int i = 0; i < item.Count(); i++)
for (int i = 0; i < item.Count(); i++)
{
if (Convert.ToBoolean(item[i].Value))
SelectedProcess = (ushort)(i + 1);
@@ -227,11 +232,11 @@ namespace CMS_CORE_Library.Siemens
axesData.Add(new Item() { Path = string.Format("/Channel/{0}[u{1},{2}]", "MachineAxis/toolBaseDistToGo", SelectedProcess, conf.Id), SymbolicName = conf.Id.ToString() });
}
if(axesData.Count() > 0)
if (axesData.Count() > 0)
// Subscribe to changes
AxesSvc.Subscribe(ManageAxes, axesData.ToArray());
}
private void ManageAxes(Guid guid, Item[] item, DataSvcStatus[] status)
{
MachineAxesPosition.Clear();
@@ -246,11 +251,8 @@ namespace CMS_CORE_Library.Siemens
InterpAxesPosition.Add(item[i * 4 + 2].SymbolicName, Convert.ToDouble(item[i * 4 + 2].Value));
ToGoAxesPosition.Add(item[i * 4 + 3].SymbolicName, Convert.ToDouble(item[i * 4 + 3].Value));
}
Console.WriteLine(item.FirstOrDefault().Value);
}
// Disconnect Method
public override CmsError NC_Disconnect()
{
@@ -557,12 +559,25 @@ namespace CMS_CORE_Library.Siemens
return NO_ERROR;
}
// Get NC unit of measure
public override CmsError NC_RUnitOfMeasure(ref string unitOfMeasure)
{
CmsError cmsError = ReadStaticNCData();
if (cmsError.IsError())
return cmsError;
unitOfMeasure = UnitOfMeasure;
return NO_ERROR;
}
// Get the Nc Active Alarms
public override CmsError NC_RActiveAlarms(ref List<AlarmModel> alarms)
{
{
alarms = SiemensAlarms.
Where(x => (x.Id < IDMinPLCMessage || x.Id > IDMaxPLCMessage) && (x.Id < IDMinChannel || x.Id > IDMaxChannel))
.Select(x => {
.Select(x =>
{
uint id = x.Instance == 1 ? (uint)x.Id : Convert.ToUInt32((x.Id & 0xffff) | (x.Instance << 24));
return new AlarmModel()
{
@@ -587,7 +602,6 @@ namespace CMS_CORE_Library.Siemens
int TotalTimes = 2000 / 50;
int ActualTimes = 0;
string area = ConvertStepToSiemensScreen(screen);
if (string.IsNullOrEmpty(area))
return INCORRECT_PARAMETERS_ERROR;
@@ -597,12 +611,11 @@ namespace CMS_CORE_Library.Siemens
Infrastructure.SwitchToArea(area);
while (Infrastructure.CurrentActiveArea != area)
{
if(ActualTimes == TotalTimes)
if (ActualTimes == TotalTimes)
return HMI_NOT_RESPONDING_ERROR;
Thread.Sleep(SleepMs);
ActualTimes++;
}
}
}
return NO_ERROR;
@@ -846,7 +859,7 @@ namespace CMS_CORE_Library.Siemens
return NO_ERROR;
}
public override CmsError PLC_RNcSoftKeys(ref List<SoftKeysModel> ncSoftKeys)
{
CmsError cmsError = PLC_RSoftKeys(NC_SOFTKEYS_VALUE, NC_SOFTKEYS_CLICKABLE, ref ncSoftKeys);
@@ -991,7 +1004,7 @@ namespace CMS_CORE_Library.Siemens
return NO_ERROR;
}
public override CmsError PLC_RMachineCounters(ref List<CounterModel> counters)
{
List<uint> val = new List<uint>();
@@ -1021,7 +1034,7 @@ namespace CMS_CORE_Library.Siemens
return cmsError;
// Convert byte to an array of bits
bool[] bits = ByteToBits(val);
uint processId = 1;
uint processId = 1;
string[] parameters;
string actualLine = "";
@@ -1070,7 +1083,7 @@ namespace CMS_CORE_Library.Siemens
Path = string.Format("/channel/parameter/r[c{0} , 155]", process),
Value = responseVal
};
dataSvc.Write(item);
}
catch (Exception ex)
@@ -1080,7 +1093,7 @@ namespace CMS_CORE_Library.Siemens
return NO_ERROR;
}
public override CmsError PLC_RMTConnectData(ref List<MtConnectDataIsNeededModel> data)
{
byte val = 0;
@@ -1105,7 +1118,7 @@ namespace CMS_CORE_Library.Siemens
parameters = ExtractM154ParametersFromNcCodeLine(tmpStr);
data.Add(new MtConnectDataIsNeededModel()
{
Process = processId,
Process = processId,
IsNeeded = bit,
ActualLine = parameters
});
@@ -1221,7 +1234,6 @@ namespace CMS_CORE_Library.Siemens
return cmsError;
}
#endregion PLC High-level data
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1385,7 +1397,8 @@ namespace CMS_CORE_Library.Siemens
{
alarms = SiemensAlarms
.Where(x => x.Id >= IDMinChannel && x.Id <= IDMaxChannel && x.Parameters[0].Equals(procNumber.ToString()))
.Select(x => {
.Select(x =>
{
uint id = x.Instance == 1 ? (uint)x.Id : Convert.ToUInt32((x.Id & 0xffff) | (x.Instance << 24));
return new AlarmModel()
{
@@ -1448,7 +1461,7 @@ namespace CMS_CORE_Library.Siemens
public override CmsError PROC_RSelectedProcess(ref ushort procNumber)
{
procNumber = (ushort)SelectedProcess;
procNumber = SelectedProcess;
//CmsError cmsError;
//bool readValue = false;
@@ -1572,14 +1585,14 @@ namespace CMS_CORE_Library.Siemens
{
Dictionary<string, double> axes = new Dictionary<string, double>();
List<AxisModel> axesConf = new List<AxisModel>();
CmsError cmsError = AXES_RAxesNames(channel, ref axesConf);
List<Item> items = new List<Item>();
foreach (var conf in axesConf)
{
// Setup the items to be readed
items.Add(new Item() { Path = string.Format("/Channel/{0}[u{1},{2}]", positionType, channel, conf.Id)});
items.Add(new Item() { Path = string.Format("/Channel/{0}[u{1},{2}]", positionType, channel, conf.Id) });
}
DataSvc dataSvc = new DataSvc();
@@ -1605,16 +1618,16 @@ namespace CMS_CORE_Library.Siemens
CmsError cmsError = CheckConnection();
if (cmsError.IsError())
return cmsError;
int i = 0;
List<AxisModel> configuredAxes = new List<AxisModel>();
try
{
// Check if the static object is already populated
if(AxesData.Count == 0)
if (AxesData.Count == 0)
{
XDocument xmlAxesFile = XDocument.Load(AXES_FILE_PATH);
// Read data from file
var configuredAxes = xmlAxesFile
configuredAxes = xmlAxesFile
.Root
.Elements()
.Select(x => new AxisModel()
@@ -1625,52 +1638,46 @@ namespace CMS_CORE_Library.Siemens
})
.Where(x => x.Id != 0) // Parse only active axes
.ToList();
}
// Read data from NC
DataSvc svcData = new DataSvc();
// Object used for reading data from NC
DataSvc svcData = new DataSvc();
Item[] ncAxes = new Item[20];
Item[] axesVisibleParams = new Item[20];
if (ChannelAxesId == null)
ChannelAxesId = new List<int[]>();
Item[] ncAxes = new Item[MAX_AXES_FOR_PROCESS * 3];
bool[] axesAreVisible = new bool[20];
bool[] axesAreVisible = new bool[MAX_AXES_FOR_PROCESS];
for (i = 1; i <= 20; i++)
for (int i = 1; i <= MAX_AXES_FOR_PROCESS; i++)
{
// Set the path to read on which process is the axis
ncAxes[i - 1] = new Item("/Nck/MachineAxis/chanNoAxisIsActive[" + i + "]");
// Set the path in order to find which axes are visible
ncAxes[i - 1 + MAX_AXES_FOR_PROCESS] = new Item("/NC/_N_CH_TEA_ACX/$MC_DISPLAY_AXIS[u" + channel + "," + i + "]");
// Set the path of the axes type
ncAxes[i - 1 + (MAX_AXES_FOR_PROCESS * 2)] = new Item("/Nck/Configuration/axisType[" + i + "]");
}
svcData.Read(ncAxes);
for (int i = 0; i < MAX_AXES_FOR_PROCESS; i++)
{
// Set if axis is visible
axesAreVisible[i] = (Convert.ToInt32(ncAxes[i + MAX_AXES_FOR_PROCESS].Value) & 1) == 1;
int processAxes = Convert.ToInt32(ncAxes[i].Value);
// If axis is active
if (processAxes == channel && axesAreVisible[i])
{
// Populate static configured axes for the current channel
if (ChannelAxesId.Count == 0 || ChannelAxesId[channel - 1] == null)
// Find match NC axis with configuration
var axis = configuredAxes.Where(x => x.Id == (i + 1)).FirstOrDefault();
if (axis != null)
{
ChannelAxesId.Add(new int[20]);
}
if (ChannelAxesId[channel - 1][i - 1] == 0)
{
// Get
ncAxes[i - 1] = new Item("/Channel/Drive/AXCONF_MACHAX_USED[u" + channel + "," + i + "]");
svcData.Read(ncAxes[i - 1]);
ChannelAxesId[channel - 1][i - 1] = Convert.ToInt32(ncAxes[i - 1].Value);
}
// Read if axis is visible
axesVisibleParams[i - 1] = new Item("/NC/_N_CH_TEA_ACX/$MC_DISPLAY_AXIS[u" + channel + "," + i + "]");
svcData.Read(axesVisibleParams[i - 1]);
axesAreVisible[i - 1] = (Convert.ToInt32(axesVisibleParams[i - 1].Value) & 1) == 1;
// Get id of current Nc axis
int currentNcAxisId = ChannelAxesId[channel - 1][i - 1];
// If is active
if (currentNcAxisId != 0 && axesAreVisible[i - 1])
{
// Find match NC axis with configuration
var axis = configuredAxes.Where(x => x.Id == currentNcAxisId).FirstOrDefault();
if (axis != null)
AxesData.Add(axis);
axis.Type = (AXIS_TYPE)Convert.ToInt32(ncAxes[i + (MAX_AXES_FOR_PROCESS * 2)].Value);
AxesData.Add(axis);
}
}
}
// Get from PLC which axis can be selected
// Get from PLC which axis can be selected
List<byte> ids = new List<byte>();
cmsError = MEM_RWByteList(R, 0, AXES_BUTTON_VISIBLE.MemType, AXES_BUTTON_VISIBLE.Address, AXES_BUTTON_VISIBLE.SubAddress, 0, AXES_BUTTON_VISIBLE.Size, ref ids);
if (cmsError.IsError())
@@ -1679,7 +1686,7 @@ namespace CMS_CORE_Library.Siemens
// Parse the data readed from PLC
foreach (byte id in ids)
{
if(id != 0)
if (id != 0)
{
// If axis exists, set it as selectable
var tmpAxis = AxesData.Where(x => x.Id == id).FirstOrDefault();
@@ -2203,7 +2210,7 @@ namespace CMS_CORE_Library.Siemens
// Go through the array of file nodes
foreach (Node element in nodeArray)
{
if(element.AccessRights.List == AccessLevel.KEY_0)
if (element.AccessRights.List == AccessLevel.KEY_0)
{
var file = new PreviewFileModel()
{
@@ -2234,8 +2241,8 @@ namespace CMS_CORE_Library.Siemens
Node fileNode = new Node(path);
if (fileNode != null)
{
string filePath = "C://CMS//STEP//TMP//" + fileNode.Name;
FileStream str = new FileStream(filePath, FileMode.CreateNew);
string filePath = "C://CMS//STEP//TMP//" + fileNode.Name;
FileStream str = new FileStream(filePath, FileMode.Create);
CmsError cmsError = FILES_RProgramToFile(path, str);
if (cmsError.IsError())
return cmsError;
@@ -2301,7 +2308,6 @@ namespace CMS_CORE_Library.Siemens
PiSvc pi = new PiSvc(piArgs);
pi.Start();
}
catch (Exception ex)
{
@@ -2335,7 +2341,7 @@ namespace CMS_CORE_Library.Siemens
trimString = trimString.Remove(lastUnderscore, 1).Insert(lastUnderscore, ".");
// check if is the NULL Program
if(trimString == "/MPF0")
if (trimString == "/MPF0")
{
programData = new ActiveProgramDataModel()
{
@@ -2438,7 +2444,7 @@ namespace CMS_CORE_Library.Siemens
public override CmsError FILES_RProgramToFile(string partProgramPath, FileStream localFile)
{
//Check if the NC is Connected
// Check if the NC is Connected
CmsError cmsError = CheckConnection();
if (cmsError.IsError())
return cmsError;
@@ -2450,17 +2456,17 @@ namespace CMS_CORE_Library.Siemens
FileSvc FileData = new FileSvc();
Node sourceNode = new Node(partProgramPath);
Node destNode = new Node(tmpFile);
//Execute Function
// Execute Function
FileData.Copy(sourceNode, destNode, true);
FileStream tmpFileStream = new FileStream(tmpFile, FileMode.Open);
//Write to local file
// Write to local file
WriteLocalFile(ReadLocalFile(tmpFileStream), ref localFile);
tmpFileStream.Close();
//Delete temporary file
// Delete temporary file
File.Delete(tmpFile);
}
catch (Exception ex)
@@ -2609,15 +2615,15 @@ namespace CMS_CORE_Library.Siemens
return NO_ERROR;
}
#region Tools functions
public override CmsError TOOLS_RToolsData(ref List<SiemensToolModel> toolTable)
{
toolTable = new List<SiemensToolModel>(ToolTableData.Select(x =>
{
// Find if is loaded in magazine
MountedToolModel tool = MagazineMountedTools.Where(y => y.ToolId == x.Id).FirstOrDefault();
// Find if is loaded in magazine
MountedToolModel tool = MagazineMountedTools.Where(y => y.ToolId == x.Id).FirstOrDefault();
if (tool != null)
{
x.MagazineId = tool.MagazineId;
@@ -2629,8 +2635,8 @@ namespace CMS_CORE_Library.Siemens
x.PositionId = 0;
}
// Update multitool id
x.MultitoolId = ToolIsInMultitool(x.Id);
// Update multitool id
x.MultitoolId = ToolIsInMultitool(x.Id);
return x;
})
.ToList());
@@ -2754,14 +2760,14 @@ namespace CMS_CORE_Library.Siemens
new Item() { Path = "/Tool/Data/toolMaxVelo[" + tool.Id + "]", Value = tool.MaxSpeed },
// Max acceleration
new Item() { Path = "/Tool/Data/toolMaxAcc[" + tool.Id + "]", Value = tool.MaxAcceleration },
// Custom fields
new Item() {Path = "/Tool/User/data[c1," + tool.Id + "]", Value = tool.Load},
new Item() {Path = "/Tool/User/data[c2," + tool.Id + "]", Value = tool.Gamma},
new Item() {Path = "/Tool/User/data[c3," + tool.Id + "]", Value = tool.MaxLoadPctAutoload},
new Item() {Path = "/Tool/User/data[c4," + tool.Id + "]", Value = tool.MinLoadPctAutoload},
new Item() {Path = "/Tool/User/data[c5," + tool.Id + "]", Value = tool.ToolTypeCode},
@@ -3281,7 +3287,6 @@ namespace CMS_CORE_Library.Siemens
decPosition = decPosition < newMagazineTool.PositionId ? decPosition + magConfig.MaxPositions : decPosition;
incPosition = incPosition > newMagazineTool.PositionId ? incPosition - magConfig.MaxPositions : incPosition;
// Right check
// Calculate left space occupied
double leftMounted = decPosition - (ToolTableData[toolIndex].LeftSize / 2.0);
@@ -3847,8 +3852,9 @@ namespace CMS_CORE_Library.Siemens
Item ItemMaxChannelNo = new Item(MAX_CHANNEL_NO_PATH);
Item ItemConfChannelNo = new Item(CONF_CHANNEL_NO_PATH);
Item ItemLanguage = new Item(LANGUAGE_PATH);
Item ItemSerialNumber = new Item(SERIAL_NO_PATH);
cmsError = ConvertMemToPath(MATR_MACCH_SIEMENS.MemType, MATR_MACCH_SIEMENS.Address, MATR_MACCH_SIEMENS.SubAddress, 0, 1, 'W', out string itemString);
Item ItemSerialNumber = new Item(SERIAL_NO_PATH);
Item ItemUnitOfMeasure = new Item(UNIT_OF_MEASURE);
cmsError = ConvertMemToPath(MATR_MACCH_SIEMENS.MemType, MATR_MACCH_SIEMENS.Address, MATR_MACCH_SIEMENS.SubAddress, 0, 1, 'W', out string itemString);
if (cmsError.IsError())
return cmsError;
@@ -3862,6 +3868,7 @@ namespace CMS_CORE_Library.Siemens
ReadStaticData.Read(ItemLanguage);
ReadStaticData.Read(ItemSerialNumber);
ReadStaticData.Read(ItemMachineNumber);
ReadStaticData.Read(ItemUnitOfMeasure);
//Setup variables
Cnc_name = GetName((uint)ItemNcType.Value);
@@ -3872,6 +3879,7 @@ namespace CMS_CORE_Library.Siemens
ConfChannelNo = (uint)ItemConfChannelNo.Value;
SiemensLanguage = (uint)ItemLanguage.Value;
Cms_MachNumber = ((uint)ItemMachineNumber.Value).ToString();
UnitOfMeasure = (uint)ItemUnitOfMeasure.Value == 0 ? "mm" : "inch";
//Save NOW
Last_Static_Read = DateTime.Now;
@@ -4115,7 +4123,7 @@ namespace CMS_CORE_Library.Siemens
Name = x.FamilyName,
ToolType = x.ToolType
}).FirstOrDefault();
// Populate model with new data
MagazineAction = new MagazineActionModel()
{
@@ -4144,9 +4152,9 @@ namespace CMS_CORE_Library.Siemens
for (int i = 0; i < toolsStrings.Count(); i++)
{
string actualString = toolsStrings[i]; // Get actual string data
GetIdsFromSiemensToolString(actualString, out int firstId, out int secondId); // find ids from current string
if (firstId != 0)
{
// If tool is changed, change current index tool
@@ -4244,15 +4252,19 @@ namespace CMS_CORE_Library.Siemens
case "$TC_TPC1":
ToolTableData[toolIndex].Load = Convert.ToInt32(actualString.Split('=').LastOrDefault(), numberFormat);
break;
case "$TC_TPC2":
ToolTableData[toolIndex].Gamma = Convert.ToInt32(actualString.Split('=').LastOrDefault(), numberFormat);
break;
case "$TC_TPC3":
ToolTableData[toolIndex].MaxLoadPctAutoload = Convert.ToInt32(actualString.Split('=').LastOrDefault(), numberFormat);
break;
case "$TC_TPC4":
ToolTableData[toolIndex].MinLoadPctAutoload = Convert.ToInt32(actualString.Split('=').LastOrDefault(), numberFormat);
break;
case "$TC_TPC5":
ToolTableData[toolIndex].ToolTypeCode = Convert.ToInt32(actualString.Split('=').LastOrDefault(), numberFormat);
break;
@@ -4558,7 +4570,7 @@ namespace CMS_CORE_Library.Siemens
}
}
}
private SiemensToolModel CreateToolFromId(int toolIdToGet, string[] toolsStrings)
{
SiemensEdgesConfiguration toolEdgesConfig = new SiemensEdgesConfiguration();
@@ -4599,15 +4611,15 @@ namespace CMS_CORE_Library.Siemens
break;
case "$TC_TP3":
outputTool.LeftSize = Convert.ToByte(actualString.Split('=').LastOrDefault());
outputTool.LeftSize = Convert.ToByte(actualString.Split('=').LastOrDefault());
break;
case "$TC_TP4":
outputTool.RightSize = Convert.ToByte(actualString.Split('=').LastOrDefault());
outputTool.RightSize = Convert.ToByte(actualString.Split('=').LastOrDefault());
break;
case "$TC_TP7":
outputTool.MagazinePositionType = Convert.ToInt32(actualString.Split('=').LastOrDefault());
outputTool.MagazinePositionType = Convert.ToInt32(actualString.Split('=').LastOrDefault());
break;
case "$TC_TP8":
@@ -4627,7 +4639,7 @@ namespace CMS_CORE_Library.Siemens
break;
case "$TC_TP9":
outputTool.LifeType = (SIEMENS_LIFE_TYPE)Convert.ToInt32(actualString.Split('=').LastOrDefault());
outputTool.LifeType = (SIEMENS_LIFE_TYPE)Convert.ToInt32(actualString.Split('=').LastOrDefault());
break;
case "$TC_TP25":
@@ -4650,25 +4662,29 @@ namespace CMS_CORE_Library.Siemens
break;
case "$TC_TP_MAX_VELO":
outputTool.MaxSpeed = Convert.ToDouble(actualString.Split('=').LastOrDefault(), numberFormat);
outputTool.MaxSpeed = Convert.ToDouble(actualString.Split('=').LastOrDefault(), numberFormat);
break;
case "$TC_TP_MAX_ACC":
outputTool.MaxAcceleration = Convert.ToDouble(actualString.Split('=').LastOrDefault(), numberFormat);
outputTool.MaxAcceleration = Convert.ToDouble(actualString.Split('=').LastOrDefault(), numberFormat);
break;
// Custom CMS fields
case "$TC_TPC1":
outputTool.Load = Convert.ToInt32(actualString.Split('=').LastOrDefault(), numberFormat);
break;
case "$TC_TPC2":
outputTool.Gamma = Convert.ToInt32(actualString.Split('=').LastOrDefault(), numberFormat);
break;
case "$TC_TPC3":
outputTool.MaxLoadPctAutoload = Convert.ToInt32(actualString.Split('=').LastOrDefault(), numberFormat);
break;
case "$TC_TPC4":
outputTool.MinLoadPctAutoload = Convert.ToInt32(actualString.Split('=').LastOrDefault(), numberFormat);
break;
case "$TC_TPC5":
outputTool.ToolTypeCode = Convert.ToInt32(actualString.Split('=').LastOrDefault(), numberFormat);
break;
@@ -4986,10 +5002,9 @@ namespace CMS_CORE_Library.Siemens
case ToolAction.TOOL_CREATED:
{
string[] toolsStrings = ReadToolTableFile();
Stopwatch st = new Stopwatch();
st.Start();
SiemensToolModel newTool = CreateToolFromId((int)toolInfo.tNo, toolsStrings);
Console.WriteLine(st.ElapsedMilliseconds);
if (newTool != null)
{
ToolTableData.Add(newTool);
@@ -5012,14 +5027,9 @@ namespace CMS_CORE_Library.Siemens
// If the id belongs to a tool
if (toolIndex != -1)
{
Stopwatch st = new Stopwatch();
st.Start();
// Get tool new data
SiemensToolModel newTool = CreateToolFromId((int)toolInfo.tNo, toolsStrings);
Console.WriteLine(st.ElapsedMilliseconds);
// Replace the element
if (newTool != null)
ToolTableData[toolIndex] = newTool;
@@ -5244,7 +5254,6 @@ namespace CMS_CORE_Library.Siemens
#endregion Siemens Tool private functions
#region Multitool Private region
private void MultitoolsNumber_OnChange(Guid guid, Item item, DataSvcStatus status)
@@ -5441,7 +5450,7 @@ namespace CMS_CORE_Library.Siemens
internal static MEMORY_CELL OPERATOR_INPUT_NEEDED = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 3014, 1);
internal static MEMORY_CELL MTCONNECT_DATA_NEEDED = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 3042, 1);
internal static MEMORY_CELL AXES_BUTTON_VISIBLE = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 3044, 16);
internal static MEMORY_CELL MAGAZINE_ACTION = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 4000, 16);