using CMS_CORE_Library; using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace CMS_CORE { public abstract partial class Nc { //Private Global Variables internal Boolean Connected; internal String Ip; internal ushort Port; internal Boolean UseProxy; internal String LibName = "CMS_CORE_Library.dll"; //Osai Variable internal string OSAI_PlcMessagesPath = @"C:\CMS\OSAI\"; internal string OSAI_WinNbiPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\OSAI\WinNBI\"; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region LIB Methods /** * * Get the NC IP-Address * * Compatibility: Fanuc | Osai | Demo * * * */ public String LIB_GetIpAddress() { return Ip; } /** * * Set the NC IP-Address * * Compatibility: Fanuc | Osai | Demo * * * */ public void LIB_SetIpAddress(String ip) { Ip = ip; } /** * * Get Nc Port * * Compatibility: Fanuc | Osai | Demo * * * */ public ushort LIB_GetPort() { return Port; } /** * * Set Nc Port * * Compatibility: Fanuc | Osai | Demo * * * */ public void LIB_SetPort(ushort port) { Port = port; } /** * * Get Library Version * * Compatibility: Fanuc | Osai | Demo | Siemens * * * */ public String LIB_GetLibraryVersion() { return FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion.ToString(); } #endregion #region LIB Methods (OSAI) /** * * Get if the library uses Windows proxy * * Compatibility: Osai * * Thrown when an internal or a library error occours * * */ public Boolean LIB_GetWindowsProxy() { return UseProxy; } /** * * Set if the library need to use Windows proxy * * Compatibility: Osai * * Thrown when an internal or a library error occours * * */ public void LIB_SetWindowsProxy(Boolean proxy) { UseProxy = proxy; } /** * * Get the path of PLC Messages Folder * * Compatibility: Osai * * Thrown when an internal or a library error occours * * */ public string LIB_GetPlcMsgsPath() { return OSAI_PlcMessagesPath; } /** * * Set the path of PLC Messages Folder * * Compatibility: Osai * * Thrown when an internal or a library error occours * * */ public void LIB_SetPlcMsgsPath(string folder) { OSAI_PlcMessagesPath = folder; } /** * * Get the path of Win-Nbi installation * * Compatibility: Osai * * Thrown when an internal or a library error occours * * */ public string LIB_GetWinNbiPath() { return OSAI_WinNbiPath; } /** * * Set the path of Win-Nbi installation * * Compatibility: Osai * * Thrown when an internal or a library error occours * * */ public void LIB_SetWinNbiPath(string folder) { OSAI_WinNbiPath = folder; } #endregion /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region NC High-level data (to override) /** * * Connect the NC * * Compatibility: Fanuc | Osai | Demo | Siemens * * Thrown when an internal or a library error occours * * */ public abstract void NC_Connect(); /** * * Disconnect the NC * * Compatibility: Fanuc | Osai | Demo | Siemens * * Thrown when an internal or a library error occours * * */ public abstract void NC_Disconnect(); /** * * Read Nc Status * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * */ public Boolean NC_IsConnected() { return Connected; } /** * * Read actual time of the NC-Software (sometimes it can be different from NC-Operative-System) * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Reference of a DateTime Variable where data will be saved * */ public abstract void NC_RDateTime(ref DateTime ActualTime); /** * * Read Vendor NC Serial number * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Reference of a String Variable where data will be saved * */ public abstract void NC_RSerialNumber(ref String SN); /** * * Read Model name of the NC * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Reference of a String Variable where data will be saved * */ public abstract void NC_RModelName(ref String ModelName); /** * * Read Software Version of the Nc * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Reference of a String Variable where data will be saved * */ public abstract void NC_RSoftwareVersion(ref String SWV); /** * * Read CMS Serial number of the Machine * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Reference of a String Variable where data will be saved * */ public abstract void NC_RMachineNumber(ref String MachNumber); /** * * Read number of configured Processes/Paths * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Reference of a ushort Variable where data will be saved * */ public abstract void NC_RProcessesNum(ref ushort ProcNumber); /** * * Read the configured language of the NC * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Reference of a CultureInfo Variable where data will be saved * */ public abstract void NC_RLanguage(ref CultureInfo Language); /** * * Read active alarms of the NC (Nc-Process indipendent). For OSAI Nc the list can contain only one Message * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Process to execute the action * Reference of a List of String Variables where data will be saved * */ public abstract void NC_RActiveAlarms(ref List Alarms); #endregion /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region NC Low-level data (to override) /** * Read Boolean Parameter Machine (Not compatible for Axis Parameter (Multiple values in a parameter) * * Compatibility: Fanuc * * * Thrown when an internal or a library error occours * Index of the parameter * Set the Bit to Read. (0..7) * Reference of a variable with Param values * */ public abstract void NC_RParam(short Index, short Bit, ref Boolean Value); /** * Read Byte Parameter Machine (Not compatible for Axis Parameter (Multiple values in a parameter) * * Compatibility: Fanuc * * * Thrown when an internal or a library error occours * Index of the parameter * Reference of a variable with Param values * */ public abstract void NC_RParam(short Index, ref byte Value); /** * Read 2 Byte (Short) Parameter Machine (Not compatible for Axis Parameter (Multiple values in a parameter) * * Compatibility: Fanuc * * * Thrown when an internal or a library error occours * Index of the parameter * Reference of a variable with Param values * */ public abstract void NC_RParam(short Index, ref short Value); /** * Read 4 Byte (Integer) Parameter Machine (Not compatible for Axis Parameter (Multiple values in a parameter) * * Compatibility: Fanuc * * * Thrown when an internal or a library error occours * Index of the parameter * Reference of a variable with Param values * */ public abstract void NC_RParam(short Index, ref int Value); /** * Read Real Parameter Machine (Not compatible for Axis Parameter (Multiple values in a parameter) * * Compatibility: Fanuc * * * Thrown when an internal or a library error occours * Index of the parameter * Reference of a variable with Param values * */ public abstract void NC_RParam(short Index, ref double Value); #endregion /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region PLC High-level data (to override) /** * * Read PMC active Messages * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Reference of a List of String Variables where data will be saved * */ public abstract void PLC_RActiveMessages(ref List Alarms); #endregion /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region PROCESS (PATH, CHANNEL) data (to override) /** * * Read the actual status of the Process "ProcNumber" * See for information about the PROC_Status type * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Process to execute the action * Reference of a PROC_Status Variable where data will be saved * */ public abstract void PROC_RStatus(ushort ProcNumber, ref PROC_Status Status); /** * * Read the selected Mode Process "ProcNumber" * See for information about the PROC_Status type * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Process to execute the action * Reference of a PROC_Mode Variable where data will be saved * */ public abstract void PROC_RMode(ushort ProcNumber, ref PROC_Mode Mode); /** * * Read active alarms of the process "ProcNumber". For OSAI Nc the list can contain only one Message * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Process to execute the action * Reference of a List of String Variables where data will be saved * */ public abstract void PROC_RActiveAlarms(ushort ProcNumber, ref List Alarms); /** * * Read actual & Next Lines of active PP * * Compatibility: Fanuc | Osai | Siemens * * * Thrown when an internal or a library error occours * Process to execute the action * Reference of a List of String Variables where data will be saved * */ public abstract void PROC_RPPLines(ushort ProcNumber, ref List Lines); /** * * Read active PP Name * * Compatibility: Fanuc | Osai | Siemens * * * Thrown when an internal or a library error occours * Process to execute the action * Reference of a String Variables where data will be saved * */ public abstract void PROC_RPPName(ushort ProcNumber, ref String Name); #endregion /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region AXES data (to override) /** * * Read the Interpolated position of all axes in Process "ProcNumber" * * Compatibility: Fanuc | Osai | Demo * * * Thrown when an internal or a library error occours * Process to execute the action * Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position * */ public abstract void AXES_RInterpPosition(ushort ProcNumber, ref Dictionary Axes); /** * * Read the Programmed position of all axes in Process "ProcNumber". * For Fanuc-Nc there's not "Programmed position" variables. Si it is calculated from Machine-Pos and Distance-to-go * * Compatibility: Fanuc | Osai | Demo * * * Thrown when an internal or a library error occours * Process to execute the action * Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position * */ public abstract void AXES_RProgrPosition(ushort ProcNumber, ref Dictionary Axes); /** * * Read the Machine position of all axes in Process "ProcNumber" * * Compatibility: Fanuc | Osai | Demo * * * Thrown when an internal or a library error occours * Process to execute the action * Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position * */ public abstract void AXES_RMachinePosition(ushort ProcNumber, ref Dictionary Axes); /** * * Read the Following-Error of all axes in Process "ProcNumber" * * Compatibility: Osai | Demo * * * Thrown when an internal or a library error occours * Process to execute the action * Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position * */ public abstract void AXES_RFollowingError(ushort ProcNumber, ref Dictionary Axes); /** * * Read the Distance-to-go of all axes in Process "ProcNumber" * * Compatibility: Fanuc | Osai | Demo * * * Thrown when an internal or a library error occours * Process to execute the action * Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position * */ public abstract void AXES_RDistanceToGo(ushort ProcNumber, ref Dictionary Axes); #endregion /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region MEMORY Low-level function: single valiable in memory (to override) /** * Read/Write Boolean variable from/into NC Memory Area * * Compatibility: Fanuc | Osai | Demo * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Starting Index of Memory Area * Set the Bit to Read-Write. (0..7) * Reference to variable to read/Write * */ public abstract void MEM_RWBoolean(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemBit, ref Boolean Value); /** * Read/Write Boolean variable from/into NC Memory Area (including Siemens Nc) * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Siemens Memory Table (Used only in Siemens-Nc) * Starting Index of Memory Area * Set the Bit to Read-Write. (0..7) * Reference to variable to read/Write * */ public abstract void MEM_RWBoolean(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemBit, ref Boolean Value); /** * Read/Write Byte variable from/into NC Memory Area * * Compatibility: Fanuc | Osai | Demo * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Starting Index of Memory Area * Set to 1 if the Byte is the second of a WORD (only for OSAI Nc) * Reference to variable to read/Write * */ public abstract void MEM_RWByte(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByte, ref Byte Value); /** * Read/Write Byte variable from/into NC Memory Area (including Siemens Nc) * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Siemens Memory Table (Used only in Siemens-Nc) * Starting Index of Memory Area * Set to 1 if the Byte is the second of a WORD (only for OSAI Nc) * Reference to variable to read/Write * */ public abstract void MEM_RWByte(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByte, ref Byte Value); /** * Read/Write unsigned 2 Byte (NC: Word:, .NET: ushort) variable from/into NC Memory Area * * Compatibility: Fanuc | Osai | Demo * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref ushort Value); /** * Read/Write unsigned 2 Byte (NC: Word:, .NET: ushort) variable from/into NC Memory Area (including Siemens Nc) * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Siemens Memory Table (Used only in Siemens-Nc) * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref ushort Value); /** * Read/Write signed 2 Byte (NC: Word:, .NET: short) variable from/into NC Memory Area * * Compatibility: Fanuc | Osai | Demo * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWShort(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref short Value); /** * Read/Write signed 2 Byte (NC: Word:, .NET: short) variable from/into NC Memory Area (including Siemens Nc) * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Siemens Memory Table (Used only in Siemens-Nc) * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWShort(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref short Value); /** * Read/Write signed 4 Byte (NC: DWord:, .NET: uint) variable from/into NC Memory Area * * Compatibility: Fanuc | Osai | Demo * uW * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWDWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref uint Value); /** * Read/Write signed 4 Byte (NC: DWord:, .NET: uint) variable from/into NC Memory Area (including Siemens Nc) * * Compatibility: Fanuc | Osai | Demo | Siemens * uW * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Siemens Memory Table (Used only in Siemens-Nc) * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWDWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref uint Value); /** * Read/Write signed 4 Byte (NC: DWord:, .NET: int) variable from/into NC Memory Area * * Compatibility: Fanuc | Osai | Demo * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWInteger(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref int Value); /** * Read/Write signed 4 Byte (NC: DWord:, .NET: int) variable from/into NC Memory Area (including Siemens Nc) * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Siemens Memory Table (Used only in Siemens-Nc) * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWInteger(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref int Value); #endregion /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region NC Low-level function: variables List in memory (to override) /** * Read/Write List of Byte from/into NC Memory Area * * Compatibility: Fanuc | Osai | Demo * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Starting Index of Memory Area * Set to 1 if the starting Byte is the second of a WORD (only for OSAI Nc) * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWByteList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByteStart, int Number, ref List Value); /** * Read/Write List of Byte from/into NC Memory Area (including Siemens Nc) * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Siemens Memory Table (Used only in Siemens-Nc) * Starting Index of Memory Area * Set to 1 if the starting Byte is the second of a WORD (only for OSAI Nc) * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWByteList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List Value); /** * Read/Write List of unsigned 2 Byte (NC: Word:, .NET: ushort) from/into NC Memory Area * * Compatibility: Fanuc | Osai | Demo * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List Value); /** * Read/Write List of unsigned 2 Byte (NC: Word:, .NET: ushort) from/into NC Memory Area (including Siemens Nc) * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Siemens Memory Table (Used only in Siemens-Nc) * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List Value); /** * Read/Write List of signed 2 Byte (NC: Word:, .NET: short) from/into NC Memory Area * * Compatibility: Fanuc | Osai | Demo * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWShortList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List Value); /** * Read/Write List of signed 2 Byte (NC: Word:, .NET: short) from/into NC Memory Area (including Siemens Nc) * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Siemens Memory Table (Used only in Siemens-Nc) * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWShortList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List Value); /** * Read/Write List of unsigned 4 Byte (NC: DWord:, .NET: uint) from/into NC Memory Area * * Compatibility: Fanuc | Osai | Demo * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWDWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List Value); /** * Read/Write List of unsigned 4 Byte (NC: DWord:, .NET: uint) from/into NC Memory Area (including Siemens Nc) * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or ) * Nc Memory Area. See * Siemens Memory Table (Used only in Siemens-Nc) * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWDWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List Value); /** * Read/Write List of signed 4 Byte (NC: DWord:, .NET: int) from/into NC Memory Area * * Compatibility: Fanuc | Osai | Demo * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or Nc.) * Nc Memory Area. See * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWIntegerList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List Value); /** * Read/Write List of signed 4 Byte (NC: DWord:, .NET: int) from/into NC Memory Area (including Siemens Nc) * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Set True to Write-operation (Also Allowed /) * Process to perform operation (If the area is process-indipendent use 0 or Nc.) * Nc Memory Area. See * Siemens Memory Table (Used only in Siemens-Nc) * Starting Index of Memory Area * Number of sequential data Read/Write. (Used only in Reading Operation) * List of values to read/Write * */ public abstract void MEM_RWIntegerList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List Value); #endregion /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region File Management (To override) /** * Read a Part Program by path and name * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Path of the Part Program stored in the Nc * Name of the Part Program and name of new local file * Reference to the new local file where the NC Part Program data will be saved * */ public abstract void FILES_RProgramToFile(string partProgramPath, FileStream localFile); /** * Write/Overwrite a Part Program by path and name * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Path of the Part Program stored in the Nc * Reference to the local Part Program file * */ public abstract void FILES_WProgramFromFile(string partProgramPath, FileStream localFile); /** * Copy a Part Program into another path * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Path where the Part Program is saved in the NC * Path of the copy Part Program destination * * */ public abstract void FILES_CopyProgram(string partProgramPath, string newPartProgramPath, bool failIfExist); /** * Delete a Nc Part Program * * Compatibility: Fanuc | Osai | Demo | Siemens * * * Thrown when an internal or a library error occours * Path where the Nc Part Program is saved in the NC * Name of the Part Program file * */ public abstract void FILES_DeleteProgram(string partProgramPath, string partProgramName); #endregion /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region CONSTANTS (Struct and Enum are Static for definition) // Read Write type /** Write action */ public const Boolean W = true; /** Read action */ public const Boolean R = false; /** Not-Defined Process */ public const ushort UNDEF_PROC = 0; /** Process-Status */ public enum PROC_Status : ushort { /** Idle-Status */ IDLE = 1, /** Run-Status */ RUN = 2, /** Hold-Status */ HOLD = 3, /** Error-Status */ ERROR = 4, /** Reset-Status */ RESET = 5, /** Emergency-Status */ EMERG = 6 }; /** CMS-Process-Mode */ public enum PROC_Mode : ushort { /** Automatic-Mode */ AUTO = 1, /** Edit-Mode */ EDIT = 2, /** Mdi-Mode */ MDI = 3, /** Remote-Mode */ REMOTE = 4, /** Teach-Mode */ TEACH = 5, /** Ref-Mode */ REF = 6, /** Jog-Mode */ JOG = 7, /** Joginc-Mode */ JOGINC = 8, /** Ret_on_Profile-Mode */ RETPROF = 9, /** Handle-Mode */ HANDLE = 10, /** Restart-Mode */ RESTART = 11, /** Error-Mode */ ERROR = 12 }; // R-W MEMORY Type /** Nc Memory Type (Table) */ public enum MEMORY_Type { /** Null Type */ Null = -1, /////////////////////////////////////////////////////////////////// //Fanuc Memory Type /** Fanuc G Area */ Fanuc_G = 0, /** Fanuc F Area */ Fanuc_F = 1, /** Fanuc Y Area */ Fanuc_Y = 2, /** Fanuc X Area */ Fanuc_X = 3, /** Fanuc A Area */ Fanuc_A = 4, /** Fanuc R Area */ Fanuc_R = 5, /** Fanuc T Area */ Fanuc_T = 6, /** Fanuc K Area */ Fanuc_K = 7, /** Fanuc C Area */ Fanuc_C = 8, /** Fanuc D Area */ Fanuc_D = 9, /** Fanuc M Area */ Fanuc_M = 10, /** Fanuc N Area */ Fanuc_N = 11, /** Fanuc E Area */ Fanuc_E = 12, /** Fanuc Z Area */ Fanuc_Z = 13, /** Fanuc CM Area */ Fanuc_CM = 100, /////////////////////////////////////////////////////////////////// //Osai Memory Type /** Osai I Area */ Osai_I = 0, /** Osai O Area */ Osai_O = 1, /** Osai MW Area */ Osai_MW = 20, /** Osai GW Area */ Osai_GW = 21, /** Osai SW Area */ Osai_SW = 22, /** Osai PW Area */ Osai_PW = 62, /** Osai UW Area */ Osai_UW = 63, /** Osai MD Area */ Osai_MD = 40, /** Osai GD Area */ Osai_GD = 41, /** Osai SD Area */ Osai_SD = 42, /** Osai PD Area */ Osai_PD = 43, /** Osai UD Area */ Osai_UD = 44, /** Osai L Area */ Osai_L = 145, /** Osai LS Area */ Osai_LS = 18, /** Osai AA Area */ Osai_AA = 28, /** Osai A Area */ Osai_A = 45, /** Osai SC Area */ Osai_SC = 50, /** Osai SYMO Area */ Osai_SYMO = 102, /////////////////////////////////////////////////////////////////// //Siemens Memory Type, /** Siemens DB */ Siemens_DB = 0 }; // NC Memory Type Name internal const String FANUC_MEMTYPE = "Fanuc_"; internal const String SIEMENS_MEMTYPE = "Siemens_"; internal const String OSAI_MEMTYPE = "Osai_"; internal const String DEMO_MEMTYPE = "Demo_"; internal const String UNDEFINED_MEMTYPE = "Null"; // min-time to read static data (Cached values) internal const ushort NC_MIN_SEC_READ_STATIC_DATA = 10; //Fanuc Variable & Const internal const short FANUC_MAXNVAR = 5; internal const short FANUC_MAXMSGCNC = 10; internal const short FANUC_MAXMSGPMC = 5; internal const short FANUC_ABSOLUTEPOS = 0; internal const short FANUC_MACHINEPOS = 1; internal const short FANUC_RELATIVEPOS = 2; internal const short FANUC_DISTTOGO = 3; internal const short FANUC_ALLPOS = -1; internal enum FANUC_DType : short { BYTE = 0, WORD = 1, LONG = 2 }; internal const ushort OSAI_PROGRAMMEDPOS = 1; internal const ushort OSAI_INTERPOLPOS = 2; internal const ushort OSAI_TRANSDUCERPOS = 3; internal const ushort OSAI_FOLLERROR = 4; internal const ushort OSAI_DISTTOGO = 5; internal const ushort OSAI_MACHINEPOS = 6; #endregion /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region Fixed memory area // R-W MEMORY Cell internal struct MEMORY_Cell { public readonly MEMORY_Type MemType; public readonly int Address; public readonly int SubAddress; //Only for Siemens public MEMORY_Cell(MEMORY_Type MType, int Addr, int SubAddr) { MemType = MType; Address = Addr; SubAddress = SubAddr; } } //Lingua CN internal MEMORY_Cell PARAM_LING_FANUC = new MEMORY_Cell(MEMORY_Type.Null, 3281, 0); //Matricola Macchina internal MEMORY_Cell MATR_MACCH_OSAI = new MEMORY_Cell(MEMORY_Type.Osai_MW , 3403, 0); internal MEMORY_Cell MATR_MACCH_FANUC = new MEMORY_Cell(MEMORY_Type.Fanuc_D , 4018, 0); internal MEMORY_Cell MATR_MACCH_SIEMENS = new MEMORY_Cell(MEMORY_Type.Siemens_DB, 255 , 0); #endregion /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region Error Codes internal const uint NC_PROD_ERROR = 0; internal const uint NOT_CONNECTED_ERROR = 1; internal const uint PROC_NOT_FOUND_ERROR = 2; internal const uint FUNC_NOTALL_NC_ERROR = 3; internal const uint BIT_NOT_IN_RANGE_ERROR = 4; internal const uint BYTE_NOT_IN_RANGE_ERROR = 5; internal const uint INTERNAL_ERROR = 6; internal const uint INCORRECT_PARAMETERS_ERROR = 7; internal const uint SIEMENS_ENVIRONMENT_NOT_FOUND = 8; internal const uint SIEMENS_HMI_NOT_RUNNING = 9; #endregion } }