Siemens AXes

Added demo offsets
This commit is contained in:
Lucio Maranta
2018-08-23 11:30:39 +00:00
parent 8df32e59e0
commit 943dba9e02
11 changed files with 905 additions and 352 deletions
+7
View File
@@ -247,6 +247,13 @@ namespace Nc_Demo_Application.Server.Service
[WebGet(UriTemplate = "tool_table/config", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetToolManagerConfiguration(out DemoToolManagerConfig config);
[WebGet(UriTemplate = "tool_table/offset", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetOffsets(out List<OffsetModel> offsetData);
[WebInvoke(Method = "PUT", UriTemplate = "tool_table/offset", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
void PutOffset(ref OffsetModel offsetData);
#endregion
}
+33
View File
@@ -2603,11 +2603,44 @@ namespace CMS_CORE.Demo
public override CmsError TOOLS_ROffset(short offsetId, ref OffsetModel offset)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
if (cmsError.IsError())
return cmsError;
try
{
serverService.GetOffsets(out List<OffsetModel> offsetData);
offset = offsetData.Where(x => x.Id == offsetId).FirstOrDefault();
}
catch (Exception ex)
{
return ManageException(ex);
}
return NO_ERROR;
}
public override CmsError TOOLS_WOffset(short offsetId, OffsetModel offset)
{
offset.Id = offsetId;
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
if (cmsError.IsError())
return cmsError;
try
{
serverService.PutOffset(ref offset);
}
catch (Exception ex)
{
return ManageException(ex);
}
return NO_ERROR;
}
+78 -19
View File
@@ -1192,34 +1192,93 @@ namespace CMS_CORE.Siemens
#region PROCESS-AXES (PATH) High-level data
//Get a dictionary with the Actual position of the axes in Process
public override CmsError AXES_RInterpPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
public override CmsError AXES_RInterpPosition(ushort channel, ref Dictionary<string, double> axes)
{
return FUNCTION_NOT_ALLOWED_ERROR;
try
{
axes = AXES_ReadAxesPos(channel, "GeometricAxis/actToolBasePos"); // TODO FIX
}
catch (Exception ex)
{
return ManageException(ex);
}
return NO_ERROR;
}
public override CmsError AXES_RMachinePosition(ushort channel, ref Dictionary<string, double> axes)
{
try
{
axes = AXES_ReadAxesPos(channel, "GeometricAxis/actToolBasePos");
}
catch (Exception ex)
{
return ManageException(ex);
}
return NO_ERROR;
}
//Get a dictionary with the Machine position of the axes in Process
public override CmsError AXES_RMachinePosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
public override CmsError AXES_RProgrPosition(ushort channel, ref Dictionary<string, double> axes)
{
return FUNCTION_NOT_ALLOWED_ERROR;
try
{
axes = AXES_ReadAxesPos(channel, "GeometricAxis/actProgPos");
}
catch (Exception ex)
{
return ManageException(ex);
}
return NO_ERROR;
}
public override CmsError AXES_RFollowingError(ushort channel, ref Dictionary<string, double> axes)
{
try
{
axes = AXES_ReadAxesPos(channel, "MachineAxis/vaLagError");
}
catch (Exception ex)
{
return ManageException(ex);
}
return NO_ERROR;
}
public override CmsError AXES_RDistanceToGo(ushort channel, ref Dictionary<string, double> axes)
{
try
{
axes = AXES_ReadAxesPos(channel, "GeometricAxis/actDistToGoEns");
}
catch (Exception ex)
{
return ManageException(ex);
}
return NO_ERROR;
}
//Get a dictionary with the Programmed position of the axes in Process
public override CmsError AXES_RProgrPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
private Dictionary<string, double> AXES_ReadAxesPos(ushort channel, string positionType)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
Dictionary<string, double> axes = new Dictionary<string, double>();
List<AxisModel> axesConf = new List<AxisModel>();
CmsError cmsError = AXES_RAxesNames(channel, ref axesConf);
foreach (var conf in axesConf)
{
DataSvc dataSvc = new DataSvc();
//Get a dictionary with the Following Error of the axes in Process
public override CmsError AXES_RFollowingError(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
// Write parameter into multitool parameters
Item item = new Item() { Path = string.Format("/Channel/{0}[u{1},{2}]", positionType, channel, conf.Id) };
dataSvc.Read(item);
//Get a dictionary with the Distance To Go of the axes in Process
public override CmsError AXES_RDistanceToGo(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
return FUNCTION_NOT_ALLOWED_ERROR;
axes.Add(conf.Id.ToString(), Convert.ToDouble(item.Value));
}
return axes;
}
public override CmsError AXES_RAxesNames(ushort channel, ref List<AxisModel> axesData)