This commit is contained in:
@@ -894,6 +894,11 @@ namespace CMS_CORE.Demo
|
||||
throw new Nc_Exception(getError(BIT_NOT_IN_RANGE_ERROR));
|
||||
}
|
||||
|
||||
public override void PROC_RPPName(ushort ProcNumber, ref string Name)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -330,7 +330,6 @@ namespace CMS_CORE.Fanuc
|
||||
//Get PP Lines
|
||||
public override void PROC_RPPLines(ushort ProcNumber, ref List<string> Lines)
|
||||
{
|
||||
Focas1.OPMSG3 Messg = new Focas1.OPMSG3();
|
||||
short nReturn = 0;
|
||||
int linN;
|
||||
ushort Lenght = 256;
|
||||
@@ -367,6 +366,28 @@ namespace CMS_CORE.Fanuc
|
||||
|
||||
|
||||
|
||||
//Get Active PP Name
|
||||
public override void PROC_RPPName(ushort ProcNumber, ref string Name)
|
||||
{
|
||||
short nReturn = 0;
|
||||
Focas1.ODBEXEPRG Prg = new Focas1.ODBEXEPRG(); ;
|
||||
|
||||
//Check if the NC is Connected
|
||||
CheckConnection();
|
||||
|
||||
//Execute the method
|
||||
nReturn = Focas1.cnc_exeprgname(nLibHandle[GetHandleIndexFromPath(ProcNumber)], Prg);
|
||||
|
||||
//Throw Exception if there's an error
|
||||
if (nReturn != 0)
|
||||
ThrowNCException(NC_PROD_ERROR, nReturn);
|
||||
|
||||
Name = new String(Prg.name).Replace("\0", String.Empty);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Get the PMC Messages
|
||||
public override void PLC_RActiveMessages(ref List<String> Alarms)
|
||||
{
|
||||
@@ -1772,6 +1793,7 @@ namespace CMS_CORE.Fanuc
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -442,6 +442,20 @@ namespace CMS_CORE
|
||||
public abstract void PROC_RPPLines(ushort ProcNumber, ref List<String> Lines);
|
||||
|
||||
|
||||
/**
|
||||
* <summary>
|
||||
* Read active PP Name
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <param name="Name">Reference of a String Variables where data will be saved</param>
|
||||
* */
|
||||
public abstract void PROC_RPPName(ushort ProcNumber, ref String Name);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -463,7 +463,6 @@ namespace CMS_CORE.Osai
|
||||
{
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
MSGERROR err;
|
||||
String L1 = "";
|
||||
String L2 = "";
|
||||
String L3 = "";
|
||||
@@ -508,6 +507,40 @@ namespace CMS_CORE.Osai
|
||||
|
||||
|
||||
|
||||
//Get Active PP Name
|
||||
public override void PROC_RPPName(ushort ProcNumber, ref string Name)
|
||||
{
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
ushort Level = 0;
|
||||
String MainName = "";
|
||||
String SubName = "";
|
||||
|
||||
//Check if the NC is Connected
|
||||
CheckConnection();
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
//Execute the method
|
||||
nReturn = OpenNC.GetActivePartProgram(ProcNumber, out Level, out MainName, out SubName, out errorClass, out errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
throw new Nc_Exception(getError(NC_PROD_ERROR, errorClass, errorNum));
|
||||
|
||||
//Build the new String
|
||||
Name = MainName;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ThrowNCException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Get a dictionary with the Actual position of the axes in Process
|
||||
public override void AXES_RInterpPosition(ushort Process, ref Dictionary<String, double> Axes)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace CMS_CORE.Siemens
|
||||
const string NcNotFound = "Missing response";
|
||||
const string NcNotFound2 = "networking error";
|
||||
const string NcNotFound3 = "Nc not Connected";
|
||||
const string SinumerikEnvPath = @"MotionControl\siemens\sinumerik";
|
||||
const string SinumerikEnvVar = "HMI_INSTALL_DIR";
|
||||
const int IDMinPLCMessage = 700000;
|
||||
const int IDMaxPLCMessage = 799999;
|
||||
const int IDMinChannel = 10000;
|
||||
@@ -41,6 +41,7 @@ namespace CMS_CORE.Siemens
|
||||
const string PathAdvancedJog = "/Channel/State/machFunc";
|
||||
const string PathRelatPosition = "/Channel/GeometricAxis/actToolBasPosEN";
|
||||
const string PathActProgLines = "/Channel/ProgramInfo/actPartProgram";
|
||||
const string PathActProgName = "/Channel/ProgramPointer/progName";
|
||||
|
||||
// Global Variables
|
||||
private DateTime Last_Static_Read;
|
||||
@@ -249,10 +250,10 @@ namespace CMS_CORE.Siemens
|
||||
CheckConnection();
|
||||
|
||||
//Setup variables
|
||||
DataSvc Data = new DataSvc();
|
||||
Data.Timeout = TimeoutConn;
|
||||
Data.PriorityFlag = SlPriority.highPriority;
|
||||
Item ReadItem = new Item(PathGenericNcState + "[u" + ProcNumber + "]");
|
||||
DataSvc Data = new DataSvc();
|
||||
Data.Timeout = TimeoutConn;
|
||||
Data.PriorityFlag = SlPriority.highPriority;
|
||||
Item ReadItem = new Item(PathGenericNcState + "[u" + ProcNumber + "]");
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
@@ -313,6 +314,46 @@ namespace CMS_CORE.Siemens
|
||||
|
||||
|
||||
|
||||
//Get PP Name
|
||||
public override void PROC_RPPName(ushort ProcNumber, ref string Name)
|
||||
{
|
||||
String RetString;
|
||||
int LastUnderscore;
|
||||
|
||||
//Check if the NC is Connected
|
||||
CheckConnection();
|
||||
|
||||
//Setup variables
|
||||
DataSvc Data = new DataSvc();
|
||||
Data.Timeout = TimeoutConn;
|
||||
Data.PriorityFlag = SlPriority.highPriority;
|
||||
Item ReadItem = new Item(PathActProgName + "[u" + ProcNumber + "]");
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
//Read Data
|
||||
Data.Read(ReadItem);
|
||||
|
||||
//Elaborate String
|
||||
RetString = ((String)ReadItem.Value);
|
||||
RetString = RetString.Replace("_N_", "");
|
||||
LastUnderscore = RetString.LastIndexOf("_");
|
||||
if (LastUnderscore >= 0)
|
||||
RetString = RetString.Remove(LastUnderscore, 1).Insert(LastUnderscore, ".");
|
||||
|
||||
//Save Data
|
||||
Name = RetString;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ThrowNCException(ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Get the Nc Active Alarms
|
||||
public override void NC_RActiveAlarms(ref List<string> Alarms)
|
||||
{
|
||||
@@ -986,8 +1027,7 @@ namespace CMS_CORE.Siemens
|
||||
//Check if Siemens Environment is started
|
||||
private void CheckSiemensEnv()
|
||||
{
|
||||
Debug.WriteLine(Environment.GetEnvironmentVariable("PATH"));
|
||||
if (!Environment.GetEnvironmentVariable("PATH").Contains(SinumerikEnvPath))
|
||||
if (String.IsNullOrEmpty(Environment.GetEnvironmentVariable(SinumerikEnvVar)))
|
||||
throw new Nc_Exception("CMS-Core-Error: Siemens Environment not found");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user