From 9908b0637b4b929f0dcf306128e1e9b22ff96b78 Mon Sep 17 00:00:00 2001 From: Lucio Maranta Date: Mon, 2 Mar 2020 07:26:51 +0000 Subject: [PATCH] Fix axes --- CMS_CORE_Library/Siemens/Nc_Siemens.cs | 47 ++++++++++++++------------ 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/CMS_CORE_Library/Siemens/Nc_Siemens.cs b/CMS_CORE_Library/Siemens/Nc_Siemens.cs index 6baa836..780612a 100644 --- a/CMS_CORE_Library/Siemens/Nc_Siemens.cs +++ b/CMS_CORE_Library/Siemens/Nc_Siemens.cs @@ -274,32 +274,35 @@ namespace CMS_CORE_Library.Siemens } } - // Clean listener - AxesSvc.UnSubscribe(ManageAxes); - - if (SelectedProcess > 0) + if (this.EnableAxes) { - List axesConf = new List(); + // Clean listener + AxesSvc.UnSubscribe(ManageAxes); - AXES_RAxesNames(SelectedProcess, ref AxesData); - - List axesData = new List(); - foreach (var conf in AxesData) + if (SelectedProcess > 0) { - // Setup the items to be subscribed - // Machine - axesData.Add(new Item() { Path = string.Format("/Nck/{0}[u{1},{2}]", "MachineAxis/actToolBasePos", SelectedProcess, conf.Id), SymbolicName = conf.Id.ToString() }); - // Programmed - axesData.Add(new Item() { Path = string.Format("/Channel/{0}[u{1},{2}]", "GeometricAxis/cmdProgPos", SelectedProcess, conf.Id), SymbolicName = conf.Id.ToString() }); - // Interp - axesData.Add(new Item() { Path = string.Format("/Channel/{0}[u{1},{2}]", "GeometricAxis/actToolEdgeCenterPos", SelectedProcess, conf.Id), SymbolicName = conf.Id.ToString() }); - // Dist to go - axesData.Add(new Item() { Path = string.Format("/Channel/{0}[u{1},{2}]", "MachineAxis/toolBaseDistToGo", SelectedProcess, conf.Id), SymbolicName = conf.Id.ToString() }); - } + List axesConf = new List(); - if (axesData.Count() > 0) - // Subscribe to axis changes - AxesSvc.Subscribe(ManageAxes, axesData.ToArray()); + AXES_RAxesNames(SelectedProcess, ref AxesData); + + List axesData = new List(); + foreach (var conf in AxesData) + { + // Setup the items to be subscribed + // Machine + axesData.Add(new Item() { Path = string.Format("/Nck/{0}[u{1},{2}]", "MachineAxis/actToolBasePos", SelectedProcess, conf.Id), SymbolicName = conf.Id.ToString() }); + // Programmed + axesData.Add(new Item() { Path = string.Format("/Channel/{0}[u{1},{2}]", "GeometricAxis/cmdProgPos", SelectedProcess, conf.Id), SymbolicName = conf.Id.ToString() }); + // Interp + axesData.Add(new Item() { Path = string.Format("/Channel/{0}[u{1},{2}]", "GeometricAxis/actToolEdgeCenterPos", SelectedProcess, conf.Id), SymbolicName = conf.Id.ToString() }); + // Dist to go + 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) + // Subscribe to axis changes + AxesSvc.Subscribe(ManageAxes, axesData.ToArray()); + } } }