Fix siemenes

This commit is contained in:
Lucio Maranta
2018-08-31 11:43:35 +00:00
parent c3053b58e1
commit f9600956d3
2 changed files with 23 additions and 13 deletions
+8 -6
View File
@@ -131,14 +131,16 @@ namespace CMS_CORE_Application
error = true;
SetError(Lines, cmsError);
}
List<AxisModel> axes = new List<AxisModel>();
cmsError = N.AXES_RAxesNames(1, ref axes);
N.TOOLS_RStoredData();
InfoFile f = new InfoFile();
N.FILES_RGetFileInfo("",ref f);
//N.TOOLS_RStoredData();
//InfoFile f = new InfoFile();
//N.FILES_RGetFileInfo("",ref f);
Dictionary<int, byte> statu = new Dictionary<int, byte>();
Dictionary<int, uint> lives = new Dictionary<int, uint>();
N.TOOLS_RUpdatedToolsData(ref statu, ref lives);
//Dictionary<int, byte> statu = new Dictionary<int, byte>();
//Dictionary<int, uint> lives = new Dictionary<int, uint>();
//N.TOOLS_RUpdatedToolsData(ref statu, ref lives);
sw.Stop();
if (!this.IsDisposed && this.InvokeRequired)
{
+15 -7
View File
@@ -3,6 +3,7 @@ using Siemens.Sinumerik.Operate.Services;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -179,7 +180,10 @@ namespace CMS_CORE.Siemens
//Set Connected to FALSE and close the session
Connected = false;
if (SiemensToolSvc != null)
{
SiemensToolSvc.UnSubscribe(ToolMngmtSvcHandler);
SiemensToolSvc = null;
}
if (MagazinePositionSvc != null)
MagazinePositionSvc.UnSubscribe(MagazinePositionEnabled_OnChange);
if (MagazineActionsSvc != null)
@@ -1294,6 +1298,7 @@ namespace CMS_CORE.Siemens
CmsError cmsError = CheckConnection();
if (cmsError.IsError())
return cmsError;
int i = 0;
try
{
XDocument xmlAxesFile = XDocument.Load(AXES_FILE_PATH);
@@ -1317,7 +1322,7 @@ namespace CMS_CORE.Siemens
bool[] axesAreVisible = new bool[20];
for (int i = 1; i < 20; i++)
for (i = 1; i < 20; i++)
{
// Populate static configured axes for the current channel
if (ChannelAxesId.Count == 0 || ChannelAxesId[channel - 1] == null)
@@ -2047,19 +2052,22 @@ namespace CMS_CORE.Siemens
try
{
// Setup variables
String TempFile = Path.GetTempFileName();
string tmpFile = Path.GetTempFileName();
FileSvc FileData = new FileSvc();
Node sourceNode = new Node(partProgramPath);
Node destNode = new Node(TempFile);
Node destNode = new Node(tmpFile);
//Execute Function
FileData.Copy(sourceNode, destNode, true);
//Write to local file
WriteLocalFile(ReadLocalFile(new FileStream(TempFile, FileMode.Open)), ref localFile);
FileStream tmpFileStream = new FileStream(tmpFile, FileMode.Open);
//Write to local file
WriteLocalFile(ReadLocalFile(tmpFileStream), ref localFile);
tmpFileStream.Close();
//Delete temporary file
File.Delete(TempFile);
File.Delete(tmpFile);
}
catch (Exception ex)
{
@@ -4123,7 +4131,7 @@ namespace CMS_CORE.Siemens
// Create a configuration file
FileStream f = new FileStream(LOCALE_TOOL_FILE_PATH, FileMode.Create);
// Read siemens configuration file
FILES_RProgramToFile(NC_TOOL_FILE_PATH, f);
CmsError cmsError = FILES_RProgramToFile(NC_TOOL_FILE_PATH, f);
f.Close();
return File.ReadAllLines(LOCALE_TOOL_FILE_PATH);
}