diff --git a/CncLib/App/App.Native.Ini.vb b/CncLib/App/App.Native.Ini.vb
new file mode 100644
index 00000000..67bbb0a0
--- /dev/null
+++ b/CncLib/App/App.Native.Ini.vb
@@ -0,0 +1,113 @@
+Namespace App
+ Namespace Native
+ Public Class Ini
+ ' API functions
+ Private Declare Ansi Function GetPrivateProfileString _
+ Lib "kernel32.dll" Alias "GetPrivateProfileStringA" _
+ (ByVal lpApplicationName As String, _
+ ByVal lpKeyName As String, ByVal lpDefault As String, _
+ ByVal lpReturnedString As System.Text.StringBuilder, _
+ ByVal nSize As Integer, ByVal lpFileName As String) _
+ As Integer
+
+ Private Declare Ansi Function WritePrivateProfileString _
+ Lib "kernel32.dll" Alias "WritePrivateProfileStringA" _
+ (ByVal lpApplicationName As String, _
+ ByVal lpKeyName As String, ByVal lpString As String, _
+ ByVal lpFileName As String) As Integer
+
+ Private Declare Ansi Function GetPrivateProfileInt _
+ Lib "kernel32.dll" Alias "GetPrivateProfileIntA" _
+ (ByVal lpApplicationName As String, _
+ ByVal lpKeyName As String, ByVal nDefault As Integer, _
+ ByVal lpFileName As String) As Integer
+
+ Private Declare Ansi Function FlushPrivateProfileString _
+ Lib "kernel32.dll" Alias "WritePrivateProfileStringA" _
+ (ByVal lpApplicationName As Integer, _
+ ByVal lpKeyName As Integer, ByVal lpString As Integer, _
+ ByVal lpFileName As String) As Integer
+
+ Dim strFilename As String
+
+ ' Constructor, accepting a filename
+ Public Sub New(ByVal Filename As String)
+
+ strFilename = Filename
+
+ End Sub
+
+ ' Read-only filename property
+ ReadOnly Property FileName() As String
+ Get
+ Return strFilename
+ End Get
+ End Property
+
+ Public Function GetString(ByVal Section As String, ByVal Key As String, ByVal [Default] As String) As String
+
+ ' Returns a string from your INI file
+ Dim intCharCount As Integer
+ Dim objResult As New System.Text.StringBuilder(256)
+
+ intCharCount = GetPrivateProfileString(Section, Key, _
+ [Default], objResult, objResult.Capacity, strFilename)
+
+ If intCharCount > 0 Then
+ Return Left(objResult.ToString, intCharCount)
+ Else
+ Return ""
+ End If
+
+ End Function
+
+ Public Function GetInteger(ByVal Section As String, ByVal Key As String, ByVal [Default] As Integer) As Integer
+
+ ' Returns an integer from your INI file
+ Return GetPrivateProfileInt(Section, Key, _
+ [Default], strFilename)
+
+ End Function
+
+ Public Function GetBoolean(ByVal Section As String, ByVal Key As String, ByVal [Default] As Boolean) As Boolean
+
+ ' Returns a boolean from your INI file
+ Return (GetPrivateProfileInt(Section, Key, _
+ CInt([Default]), strFilename) = 1)
+
+ End Function
+
+ Public Sub WriteString(ByVal Section As String, ByVal Key As String, ByVal Value As String)
+
+ ' Writes a string to your INI file
+ WritePrivateProfileString(Section, Key, Value, strFilename)
+ Flush()
+
+ End Sub
+
+ Public Sub WriteInteger(ByVal Section As String, ByVal Key As String, ByVal Value As Integer)
+
+ ' Writes an integer to your INI file
+ WriteString(Section, Key, CStr(Value))
+ Flush()
+
+ End Sub
+
+ Public Sub WriteBoolean(ByVal Section As String, ByVal Key As String, ByVal Value As Boolean)
+
+ ' Writes a boolean to your INI file
+ WriteString(Section, Key, CStr(CInt(Value)))
+ Flush()
+
+ End Sub
+
+ Private Sub Flush()
+
+ ' Stores all the cached changes to your INI file
+ FlushPrivateProfileString(0, 0, 0, strFilename)
+
+ End Sub
+ End Class
+
+ End Namespace
+End Namespace
\ No newline at end of file
diff --git a/CncLib/CNC/CNC.FANUC/CNC.FANUC.vb b/CncLib/CNC/CNC.FANUC/CNC.FANUC.vb
new file mode 100644
index 00000000..0b413320
--- /dev/null
+++ b/CncLib/CNC/CNC.FANUC/CNC.FANUC.vb
@@ -0,0 +1,1848 @@
+Imports CncLib.Config.Settings
+
+Namespace CNC
+
+ Partial Public Class FANUC
+ Inherits CNC
+
+ Const N_BYTE_TYPE = 0
+ Const N_WORD_TYPE = 1
+ Const N_DWORD_TYPE = 2
+ Public Const G_PARAM = 0
+ Public Const F_PARAM = 1
+ Public Const Y_PARAM = 2
+ Public Const X_PARAM = 3
+ Public Const A_PARAM = 4
+ Public Const R_PARAM = 5
+ Public Const T_PARAM = 6
+ Public Const K_PARAM = 7
+ Public Const C_PARAM = 8
+ Public Const D_PARAM = 9
+ Public Const M_PARAM = 10
+ Public Const N_PARAM = 11
+ Public Const E_PARAM = 12
+ Public Const Z_PARAM = 13
+ Public Const CM_PARAM = 100
+
+ Const F_MAX_ITEM = 8
+ Const F_MAX_MACRO = 5
+
+
+ Public Enum MemType
+ G = 0
+ F = 1
+ Y = 2
+ X = 3
+ A = 4
+ R = 5
+ T = 6
+ K = 7
+ C = 8
+ D = 9
+ M = 10
+ N = 11
+ E = 12
+ Z = 13
+ CM = 100
+ End Enum
+
+ Private _connectionType As ConnectionType
+ Private _szIp As String
+ Private _nPortIp As Integer
+ Private _CncScreen_connectionType As ConnectionType
+ Private _nPathActive As Integer
+ Private _nMaxPath As Integer
+ Private _bMultiProcess As Boolean
+ Friend focas As Focas1
+ Friend nLibHandle(1) As Integer
+ 'Private _err As New Err
+
+ Private CncScreen_ProcessName As String
+
+ Public Enum ConnectionType
+ Ethernet = 0
+ Hssb = 1
+ End Enum
+
+ Private _Is16Series As Boolean
+ Public ReadOnly Property Is16Series() As Boolean
+ Get
+ Return _Is16Series
+ End Get
+ End Property
+ Private _Is30Series As Boolean = Not _Is16Series
+ Public ReadOnly Property Is30Series() As Boolean
+ Get
+ Return _Is30Series
+ End Get
+ End Property
+
+ Public Overrides Property Licenza() As Integer
+ Get
+ Dim uiLicence As UInteger
+ 'leggo dal cn il valore
+ Me.F_RW_DWord(R, MemType.D, 7222, uiLicence)
+ Return UnsignedToInteger(uiLicence)
+ End Get
+ Set(ByVal value As Integer)
+ 'setto sul cn il valore
+ Dim uiLicence As UInteger = IntegerToUnsigned(value)
+ Me.F_RW_DWord(W, MemType.D, 7222, uiLicence)
+ End Set
+ End Property
+
+ Public Overrides Property LicenzaScaduta() As Boolean
+ Get
+ Dim bLicenzaScaduta As Boolean
+ 'leggo dal cn il valore
+ Me.F_RW_Boolean(R, MemType.D, 7217, 5, bLicenzaScaduta)
+ Return bLicenzaScaduta
+ End Get
+ Set(ByVal value As Boolean)
+ 'setto sul cn il valore
+ Me.F_RW_Boolean(W, MemType.D, 7217, 5, value)
+ End Set
+ End Property
+
+ Public Sub New(ByRef connectionType As ConnectionType, Optional ByRef szIp As String = "192.168.1.1",
+ Optional ByRef nPortIp As Integer = 8193, Optional ByRef CncScreenHssb As ConnectionType = FANUC.ConnectionType.Ethernet)
+ MyBase.New()
+ _Type = NcType.FANUC
+
+ Try
+ focas = New Focas1
+ Catch ex As Exception
+ MsgBox(ex.Message)
+ End Try
+
+ _connectionType = connectionType
+ _szIp = szIp
+ _nPortIp = nPortIp
+ _CncScreen_connectionType = CncScreenHssb
+
+ 'Inizializzo le variabili
+ Me._Descrizione = "NC FANUC" & vbNewLine
+ Select Case _connectionType
+ Case FANUC.ConnectionType.Ethernet
+ Me._Descrizione = Me._Descrizione & "Connection type: Ethernet" & vbNewLine &
+ "Ip address: " & _szIp & vbNewLine &
+ "Port: " & _nPortIp
+ Case FANUC.ConnectionType.Hssb
+ Me._Descrizione = Me._Descrizione & "Connection type: HSSB" & vbNewLine &
+ "Hssb node: " & Hssb_node.ToString
+ Case Else
+ Me._Descrizione = Me._Descrizione & "Connection type: " & _connectionType.ToString & " !!!"
+ End Select
+
+ Select Case _CncScreen_connectionType
+ Case FANUC.ConnectionType.Ethernet
+ Me.CncScreen_ProcessName = "CNCScrnE"
+ Case FANUC.ConnectionType.Hssb
+ Me.CncScreen_ProcessName = "CNCScrn"
+ End Select
+
+ End Sub
+
+ Public Overrides Sub Connect(Optional ByRef szStatus As String = "")
+ Dim i As Integer
+ Dim nReturn As Integer
+
+ Select Case _connectionType
+ Case ConnectionType.Ethernet
+ szStatus = "TRY cnc_allclibhndl3 Connect CNC.FANUC Ip=" & _szIp & " Port=" & _nPortIp
+ nReturn = Focas1.cnc_allclibhndl3(_szIp, _nPortIp, 5, nLibHandle(1))
+ If F_CheckRetError_Cnc(nReturn, "cnc_allclibhndl3 Connect CNC.FANUC") Then
+ szStatus = "ERR cnc_allclibhndl3 Connect CNC.FANUC Return=" & nReturn
+ Focas1.cnc_freelibhndl(nLibHandle(1))
+ _bConnected = False
+ Throw New NcException("ERR cnc_allclibhndl3 Connect CNC.FANUC")
+ Exit Sub
+ Else
+ 'leggo la serie del cnc
+ szStatus = "TRY F_GetCncSeries Connect CNC.FANUC"
+ F_GetCncSeries()
+ 'leggo il numero di processi e setto il primo
+ szStatus = "TRY cnc_getpath Connect CNC.FANUC"
+ nReturn = Focas1.cnc_getpath(nLibHandle(1), _nPathActive, _nMaxPath)
+ If F_CheckRetError_Cnc(nReturn, "cnc_getpath Connect CNC.FANUC") Then
+ szStatus = "ERR cnc_getpath Connect CNC.FANUC Return=" & nReturn
+ Focas1.cnc_freelibhndl(nLibHandle(1))
+ _bConnected = False
+ Throw New NcException("ERR cnc_getpath Connect CNC.FANUC")
+ Exit Sub
+ Else
+ If _nMaxPath > 1 Then
+ _bMultiProcess = True
+ nReturn = Focas1.cnc_setpath(nLibHandle(1), 1)
+ If F_CheckRetError_Cnc(nReturn, "cnc_setpath Connect CNC.FANUC") Then
+ szStatus = "ERR cnc_setpath Connect CNC.FANUC Return=" & nReturn
+ Focas1.cnc_freelibhndl(nLibHandle(1))
+ _bConnected = False
+ Throw New NcException("ERR cnc_setpath Connect CNC.FANUC")
+ Exit Sub
+ Else
+ ReDim Preserve nLibHandle(_nMaxPath)
+ For i = 2 To _nMaxPath
+ szStatus = "TRY cnc_allclibhndl3 Connect CNC.FANUC to Path " & i & " Ip=" & _szIp & " Port=" & _nPortIp
+ nReturn = Focas1.cnc_allclibhndl3(_szIp, _nPortIp, 5, nLibHandle(i))
+ If F_CheckRetError_Cnc(nReturn, "cnc_allclibhndl3 Connect CNC.FANUC to Path " & i) Then
+ szStatus = "ERR cnc_allclibhndl3 Connect CNC.FANUC to Path " & i & " Return=" & nReturn
+ Focas1.cnc_freelibhndl(nLibHandle(i))
+ _bConnected = False
+ Throw New NcException("ERR cnc_allclibhndl3 Connect CNC.FANUC to Path " & i)
+ Exit Sub
+ Else
+ nReturn = Focas1.cnc_setpath(nLibHandle(i), i)
+ If F_CheckRetError_Cnc(nReturn, "cnc_setpath Connect CNC.FANUCto Path " & i) Then
+ szStatus = "ERR cnc_setpath Connect CNC.FANUC to Path " & i & " Return=" & nReturn
+ Focas1.cnc_freelibhndl(nLibHandle(i))
+ _bConnected = False
+ Throw New NcException("ERR cnc_setpath Connect CNC.FANUC to Path " & i)
+ Exit Sub
+ Else
+ _bConnected = True
+ End If
+ End If
+ Next i
+ End If
+
+ Else
+ _bConnected = True
+ End If
+ End If
+
+ End If
+
+ Case ConnectionType.Hssb
+ Hssb_node = HSSB_DEFAULT_NODE
+
+ szStatus = "TRY cnc_allclibhndl2 Connect CNC.FANUC"
+ nReturn = Focas1.cnc_allclibhndl2(Hssb_node, nLibHandle(1))
+ If F_CheckRetError_Cnc(nReturn, "cnc_allclibhndl2 Connect CNC.FANUC") Then
+ szStatus = "ERR cnc_allclibhndl2 Connect CNC.FANUC Return=" & nReturn
+ Focas1.cnc_freelibhndl(nLibHandle(1))
+ _bConnected = False
+ Throw New NcException("ERR cnc_allclibhndl2 Connect CNC.FANUC")
+ Exit Sub
+ Else
+ _bConnected = True
+ End If
+ End Select
+
+ End Sub
+
+ Public Overrides Sub Disconnect(Optional ByRef szStatus As String = "")
+ Dim i As Integer
+ Dim nReturn As Integer
+
+ For i = 1 To UBound(nLibHandle)
+ nReturn = Focas1.cnc_freelibhndl(nLibHandle(i))
+ If nReturn <> Focas1.EW_OK Then
+ _bConnected = False '?
+ Else
+ _bConnected = False
+ End If
+ Next i
+ End Sub
+
+ '''
+ ''' Get class series of CNC: 16 or 30
+ '''
+ ''' Series
+ ''' After, use Is16Series and Is30Series for discriminate
+ Public Function F_GetCncSeries() As Integer
+ Dim nReturn As Integer
+ Dim nOdb As Focas1.ODBSYS
+ Dim nSeries As Integer
+
+ nOdb = New Focas1.ODBSYS
+ nReturn = Focas1.cnc_sysinfo(nLibHandle(1), nOdb)
+ If F_CheckRetError_Cnc(nReturn, "cnc_sysinfo F_GetCncSeries CNC.FANUC") Then
+ Throw New NcException("ERR cnc_sysinfo F_GetCncSeries CNC.FANUC")
+ Else
+ nSeries = Val(nOdb.cnc_type)
+ If nSeries >= 30 Then
+ _Is16Series = False
+ _Is30Series = True
+ Else
+ _Is16Series = True
+ _Is30Series = False
+ End If
+ End If
+
+ Return nSeries
+ End Function
+
+ '''
+ ''' Legge le memorie di configurazione dal cn
+ '''
+ Public Overrides Sub GetStaticData()
+ Dim usValue As UShort
+ Dim uiValue As UInteger
+ Dim cVal As Byte
+
+ If Not bStaticDataReaded Then
+
+ Try
+ 'Matricola
+ F_RW_Word(R, MemType.D, 4018, usValue)
+ Me._Matricola = usValue
+ 'Teste
+ F_RW_Word(R, MemType.D, 4032, usValue)
+ Me._Teste = usValue
+ 'Magazzini
+ F_RW_Word(R, MemType.D, 4036, usValue)
+ Me._Magazzini = usValue
+
+ 'Manine per Magazzino
+ ReDim Me._ManineMagazzino(Me._Magazzini - 1)
+ Select Case Settings.MemoryMapping
+ Case MemoryMapping.ElsManager
+ Dim usValueA(8 - 1) As UShort
+ Dim cValueB(12 - 1) As Byte
+ F_RW_Word(R, MemType.D, 4038, usValueA)
+ F_RW_Byte(R, MemType.D, 6780, cValueB)
+ For i = 0 To Me._Magazzini - 1
+ If i < 8 Then
+ _ManineMagazzino(i) = CInt(usValueA(i))
+ Else
+ _ManineMagazzino(i) = CInt(cValueB(i))
+ End If
+ Next
+ Case MemoryMapping.ToolManager,
+ MemoryMapping.ToolTable,
+ MemoryMapping.Default
+ Dim cValue(20 - 1) As Byte
+ F_RW_Byte(False, MemType.D, 3040, cValue)
+ For i = 0 To Me._Magazzini - 1
+ Me._ManineMagazzino(i) = CInt(cValue(i))
+ Next
+ End Select
+
+ 'Magazzini Con Attrezzaggio Automatico (maschera)
+ F_RW_DWord(R, MemType.D, 8819, uiValue)
+ Me._MagazziniConAttrezzaggioAutomatico = UnsignedToInteger(uiValue)
+
+ 'MaxUtensili
+ Dim odbtlinf As Focas1.ODBTLINF = New Focas1.ODBTLINF
+ 'Reads the memory type of tool offset, and the available number of it.
+ Focas1.cnc_rdtofsinfo(nLibHandle(1), odbtlinf)
+ If F_CheckRetError_Cnc(Focas1.cnc_rdtofsinfo(nLibHandle(1), odbtlinf), "cnc_rdtofsinfo GetStaticData CNC.FANUC") Then
+ Throw New NcException("ERR cnc_rdtofsinfo GetStaticData CNC.FANUC")
+ End If
+
+ Me._MaxUtensiliGestibili = odbtlinf.use_no
+ Me._MaxIdUtensile = odbtlinf.use_no
+
+ 'ZoomSpeed
+ Select Case Settings.MemoryMapping
+ Case MemoryMapping.ElsManager
+ F_RW_Byte(R, MemType.D, 6792, cVal)
+ Case MemoryMapping.ToolManager,
+ MemoryMapping.ToolTable,
+ MemoryMapping.Default
+ F_RW_Byte(R, MemType.D, 3330, cVal)
+ End Select
+ If cVal > 0 And cVal <= 100 Then
+ Me._ZoomSpeed = cVal
+ Else
+ Me._ZoomSpeed = 1
+ End If
+
+ bStaticDataReaded = True
+
+ Catch ex As NcException
+ Me.CncException(ex.Message)
+ End Try
+
+ End If
+ End Sub
+
+ '''
+ ''' Legge il numero del processo attivo
+ '''
+ ''' Processo attivo
+ Public Function GetActivePath() As Integer
+ Dim bValue As Boolean
+ Dim nPathIdx As Integer
+
+ nPathIdx = 1
+
+ F_RW_Boolean(R, MemType.G, 63, 0, bValue)
+ If bValue Then nPathIdx = nPathIdx + 1
+
+ F_RW_Boolean(R, MemType.G, 62, 7, bValue)
+ If bValue Then nPathIdx = nPathIdx + 2
+
+ F_RW_Boolean(R, MemType.G, 408, 1, bValue)
+ If bValue Then nPathIdx = nPathIdx + 4
+
+ F_RW_Boolean(R, MemType.G, 408, 2, bValue)
+ If bValue Then nPathIdx = nPathIdx + 8
+
+ Return nPathIdx
+
+ ''leggo il numero del processo attivo
+ 'Dim nReturn, nPathActive, nMaxPath As Integer
+ 'nReturn = Focas1.cnc_getpath(FANUC_ref.nLibHandle(1), nPathActive, nMaxPath)
+ 'If nPathActive < 1 Or nPathActive > nMaxPath Then nPathActive = 1
+
+ '21/07/2015 Il codice sopra è ereditato da OpPaneled è funzionante
+ ' verificare se questo sopra commentato possa sostituirlo ed è più efficiente
+ End Function
+
+ '''
+ ''' Legge o scrive Boolean da MEMORIE PLC
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Tipo di memoria Fanuc
+ ''' Indice di memoria
+ ''' Bit della memoria
+ ''' Valore da scrivere su scrittura e letto su lettura
+ ''' True se andata a buon fine
+ Public Function F_RW_Boolean(ByVal bWrite As Boolean, ByVal MemType As MemType, ByVal MemIndex As Integer, ByVal MemBit As Integer, ByRef Value As Boolean) As Boolean
+ Dim iodb0 As Focas1.IODBPMC0
+ Dim nlength As Integer
+ Dim nReturn As Integer
+ Dim nValue As Short
+
+ iodb0 = New Focas1.IODBPMC0
+ iodb0.type_a = MemType
+ iodb0.type_d = N_BYTE_TYPE
+ iodb0.datano_s = MemIndex
+ iodb0.datano_e = MemIndex
+ nlength = 8 + 1
+
+ 'leggo la memoria
+ nReturn = Focas1.pmc_rdpmcrng(nLibHandle(1), iodb0.type_a, iodb0.type_d, iodb0.datano_s, iodb0.datano_e, nlength, iodb0)
+ If F_CheckRetError_Pmc(nReturn, "pmc_rdpmcrng F_RW_Boolean CNC.FANUC") Then
+ Throw New NcException("ERR pmc_rdpmcrng F_RW_Boolean CNC.FANUC")
+ Return False
+ Else
+ nValue = iodb0.cdata(0)
+
+ If bWrite Then ' *** Write
+ If Value Then 'True
+ nValue = nValue Or (2 ^ MemBit)
+ Else 'False
+ nValue = nValue And Not (2 ^ MemBit)
+ End If
+ iodb0.cdata(0) = nValue
+ nReturn = Focas1.pmc_wrpmcrng(nLibHandle(1), nlength, iodb0)
+ If nReturn = Focas1.EW_SOCKET Then
+ Throw New NcException("ERR pmc_wrpmcrng CNC.FANUC")
+ Return False
+ ElseIf nReturn <> Focas1.EW_OK Then
+ 'CncLib.App.Runtime.Log.WW("ERR pmc_wrpmcrng on F_RW_Boolean CNC.FANUC", "Return=" & nReturn, True)
+ Return False
+ End If
+
+ Else ' ************* Read
+ If (nValue And (2 ^ MemBit)) = (2 ^ MemBit) Then 'True
+ Value = True
+ Else 'False
+ Value = False
+ End If
+ End If
+ End If
+
+ Return True
+ End Function
+
+ '''
+ ''' Legge o scrive Byte da MEMORIE PLC
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Tipo di memoria Fanuc
+ ''' Indice di memoria
+ ''' Matrice di valori da scrivere su scrittura o letti su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_Byte(ByVal bWrite As Boolean, ByVal MemType As MemType, ByVal MemIndex As Integer, ByRef Value() As Byte) As Boolean
+ Dim iodb0 As Focas1.IODBPMC0
+ Dim nlength As Integer
+ Dim nReturn As Integer
+ Dim nQta As Integer
+ Dim nBlock As Integer
+ Dim nMod As Integer
+
+ If Value Is Nothing Then Throw New InvalidOperationException
+
+ 'Calcolo la dimesione dell'array
+ nBlock = Value.Length \ F_MAX_ITEM
+ nMod = Value.Length Mod F_MAX_ITEM
+ If nMod > 0 Then nBlock += 1
+
+ For b = 0 To nBlock - 1
+ If b < nBlock - 1 Then
+ nQta = F_MAX_ITEM
+ Else
+ nQta = IIf(nMod > 0, nMod, F_MAX_ITEM)
+ End If
+
+ 'Setto il tipo di memoria
+ iodb0 = New Focas1.IODBPMC0
+ iodb0.type_a = MemType
+ iodb0.type_d = N_BYTE_TYPE
+ iodb0.datano_s = MemIndex + b * F_MAX_ITEM
+ iodb0.datano_e = MemIndex + b * F_MAX_ITEM + nQta - 1
+ nlength = 8 + nQta
+
+ If bWrite Then ' *** Write
+ ReDim iodb0.cdata(8 - 1)
+ For i = 0 To nQta - 1
+ iodb0.cdata(i) = Value(i + b * F_MAX_ITEM)
+ Next
+ nReturn = Focas1.pmc_wrpmcrng(nLibHandle(1), nlength, iodb0)
+ If F_CheckRetError_Pmc(nReturn, "pmc_wrpmcrng F_RW_Byte CNC.FANUC") Then
+ Throw New NcException("ERR pmc_wrpmcrng F_RW_Byte CNC.FANUC")
+ Return False
+ End If
+
+ Else ' ************* Read
+ nReturn = Focas1.pmc_rdpmcrng(nLibHandle(1), iodb0.type_a, iodb0.type_d, iodb0.datano_s, iodb0.datano_e, nlength, iodb0)
+ If F_CheckRetError_Pmc(nReturn, "pmc_rdpmcrng F_RW_Byte CNC.FANUC") Then
+ Throw New NcException("ERR pmc_rdpmcrng F_RW_Byte CNC.FANUC")
+ Return False
+ Else
+ For i = 0 To nQta - 1
+ Value(i + b * F_MAX_ITEM) = iodb0.cdata(i)
+ Next
+ End If
+ End If
+ Next
+
+ Return True
+ End Function
+
+ '''
+ ''' Legge o scrive Byte da MEMORIE PLC
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Tipo di memoria Fanuc
+ ''' Indice di memoria
+ ''' Valore da scrivere su scrittura o letto su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_Byte(ByVal bWrite As Boolean, ByVal MemType As MemType, ByVal MemIndex As Integer, ByRef Value As Byte) As Boolean
+ Dim bRet As Boolean
+ Dim cValue(0) As Byte
+ If bWrite Then cValue(0) = Value
+ bRet = F_RW_Byte(bWrite, MemType, MemIndex, cValue)
+ If Not bWrite Then Value = cValue(0)
+ Return bRet
+ End Function
+
+ '''
+ ''' Legge o scrive Word da MEMORIE PLC
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Tipo di memoria Fanuc
+ ''' Indice di memoria
+ ''' Matrice di valori da scrivere su scrittura o letti su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_Word(ByVal bWrite As Boolean, ByVal MemType As MemType, ByVal MemIndex As Integer, ByRef Value() As UShort) As Boolean
+ Dim iodb1 As Focas1.IODBPMC1
+ Dim nlength As Integer
+ Dim nReturn As Integer
+ Dim nQta As Integer
+ Dim nBlock As Integer
+ Dim nMod As Integer
+
+ If Value Is Nothing Then Throw New InvalidOperationException
+
+ 'Calcolo la dimesione dell'array
+ nBlock = Value.Length \ F_MAX_ITEM
+ nMod = Value.Length Mod F_MAX_ITEM
+ If nMod > 0 Then nBlock += 1
+
+ For b = 0 To nBlock - 1
+ If b < nBlock - 1 Then
+ nQta = F_MAX_ITEM
+ Else
+ nQta = IIf(nMod > 0, nMod, F_MAX_ITEM)
+ End If
+
+ 'Setto il tipo di memoria
+ iodb1 = New Focas1.IODBPMC1
+ iodb1.type_a = MemType
+ iodb1.type_d = N_WORD_TYPE
+ iodb1.datano_s = MemIndex + (b * F_MAX_ITEM * 2)
+ iodb1.datano_e = MemIndex + (b * F_MAX_ITEM * 2) + (nQta * 2) - 1
+ nlength = 8 + (nQta * 2)
+
+ If bWrite Then ' *** Write
+ ReDim iodb1.idata(8 - 1)
+ For i = 0 To nQta - 1
+ iodb1.idata(i) = Value(i + b * F_MAX_ITEM)
+ Next
+ nReturn = Focas1.pmc_wrpmcrng(nLibHandle(1), nlength, iodb1)
+ If F_CheckRetError_Pmc(nReturn, "pmc_wrpmcrng F_RW_Word CNC.FANUC") Then
+ Throw New NcException("ERR pmc_wrpmcrng F_RW_Word CNC.FANUC")
+ Return False
+ End If
+
+ Else ' ************* Read
+ nReturn = Focas1.pmc_rdpmcrng(nLibHandle(1), iodb1.type_a, iodb1.type_d, iodb1.datano_s, iodb1.datano_e, nlength, iodb1)
+ If F_CheckRetError_Pmc(nReturn, "pmc_rdpmcrng F_RW_Word CNC.FANUC") Then
+ Throw New NcException("ERR pmc_rdpmcrng F_RW_Word CNC.FANUC")
+ Return False
+ Else
+ For i = 0 To nQta - 1
+ Value(i + b * F_MAX_ITEM) = iodb1.idata(i)
+ Next
+ End If
+ End If
+ Next
+
+ Return True
+ End Function
+
+ '''
+ ''' Legge o scrive Short da MEMORIE PLC
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Tipo di memoria Fanuc
+ ''' Indice di memoria
+ ''' Matrice di valori da scrivere su scrittura o letti su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_Short(ByVal bWrite As Boolean, ByVal MemType As MemType, ByVal MemIndex As Integer, ByRef Value() As Short) As Boolean
+ Dim bReturn As Boolean
+ Dim usValue(Value.Length - 1) As UShort
+
+ If bWrite Then ' *** Write
+ For i = 0 To Value.Length - 1
+ usValue(i) = ShortToUnsigned(Value(i))
+ Next
+ bReturn = F_RW_Word(bWrite, MemType, MemIndex, usValue)
+
+ Else ' ************* Read
+ bReturn = F_RW_Word(bWrite, MemType, MemIndex, usValue)
+ For i = 0 To Value.Length - 1
+ Value(i) = UnsignedToShort(usValue(i))
+ Next
+ End If
+
+ Return bReturn
+ End Function
+
+ '''
+ ''' Legge o scrive Word da MEMORIE PLC
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Tipo di memoria Fanuc
+ ''' Indice di memoria
+ ''' Valore da scrivere su scrittura o letto su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_Word(ByVal bWrite As Boolean, ByVal MemType As MemType, ByVal MemIndex As Integer, ByRef Value As UShort) As Boolean
+ Dim bRet As Boolean
+ Dim usValue(0) As UShort
+ If bWrite Then usValue(0) = Value
+ bRet = F_RW_Word(bWrite, MemType, MemIndex, usValue)
+ If Not bWrite Then Value = usValue(0)
+ Return bRet
+ End Function
+
+ '''
+ ''' Legge o scrive Short da MEMORIE PLC
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Tipo di memoria Fanuc
+ ''' Indice di memoria
+ ''' Valore da scrivere su scrittura o letto su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_Short(ByVal bWrite As Boolean, ByVal MemType As MemType, ByVal MemIndex As Integer, ByRef Value As Short) As Boolean
+ Dim bRet As Boolean
+ Dim sValue(0) As Short
+ If bWrite Then sValue(0) = Value
+ bRet = F_RW_Short(bWrite, MemType, MemIndex, sValue)
+ If Not bWrite Then Value = sValue(0)
+ Return bRet
+ End Function
+
+ '''
+ ''' Legge DWord da MEMORIE PLC
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Tipo di memoria Fanuc
+ ''' Indice di memoria
+ ''' Matrice di valori da scrivere su scrittura o letti su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_DWord(ByVal bWrite As Boolean, ByVal MemType As MemType, ByVal MemIndex As Integer, ByRef Value() As UInteger) As Boolean
+ Dim iodb2 As Focas1.IODBPMC2
+ Dim nlength As Integer
+ Dim nReturn As Integer
+ Dim nQta As Integer
+ Dim nBlock As Integer
+ Dim nMod As Integer
+
+ If Value Is Nothing Then Throw New InvalidOperationException
+
+ 'Calcolo la dimesione dell'array
+ nBlock = Value.Length \ F_MAX_ITEM
+ nMod = Value.Length Mod F_MAX_ITEM
+ If nMod > 0 Then nBlock += 1
+
+ For b = 0 To nBlock - 1
+ If b < nBlock - 1 Then
+ nQta = F_MAX_ITEM
+ Else
+ nQta = IIf(nMod > 0, nMod, F_MAX_ITEM)
+ End If
+
+ 'Setto il tipo di memoria
+ iodb2 = New Focas1.IODBPMC2
+ iodb2.type_a = MemType
+ iodb2.type_d = N_DWORD_TYPE
+ iodb2.datano_s = MemIndex + (b * F_MAX_ITEM * 4)
+ iodb2.datano_e = MemIndex + (b * F_MAX_ITEM * 4) + (nQta * 4) - 1
+ nlength = 8 + (nQta * 4)
+
+ If bWrite Then ' *** Write
+ ReDim iodb2.ldata(8 - 1)
+ For i = 0 To nQta - 1
+ iodb2.ldata(i) = Value(i + b * F_MAX_ITEM)
+ Next
+ nReturn = Focas1.pmc_wrpmcrng(nLibHandle(1), nlength, iodb2)
+ If F_CheckRetError_Pmc(nReturn, "pmc_wrpmcrng F_RW_DWord CNC.FANUC") Then
+ Throw New NcException("ERR pmc_wrpmcrng F_RW_DWord CNC.FANUC")
+ Return False
+ End If
+
+ Else ' ************* Read
+ nReturn = Focas1.pmc_rdpmcrng(nLibHandle(1), iodb2.type_a, iodb2.type_d, iodb2.datano_s, iodb2.datano_e, nlength, iodb2)
+ If F_CheckRetError_Pmc(nReturn, "pmc_rdpmcrng F_RW_DWord CNC.FANUC") Then
+ Throw New NcException("ERR pmc_rdpmcrng F_RW_DWord CNC.FANUC")
+ Return False
+ Else
+ For i = 0 To nQta - 1
+ Value(i + b * F_MAX_ITEM) = iodb2.ldata(i)
+ Next
+ End If
+ End If
+ Next
+
+ Return True
+ End Function
+
+ '''
+ ''' Legge DWord da MEMORIE PLC
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Tipo di memoria Fanuc
+ ''' Indice di memoria
+ ''' Valore da scrivere su scrittura o letto su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_DWord(ByVal bWrite As Boolean, ByVal MemType As MemType, ByVal MemIndex As Integer, ByRef Value As UInteger) As Boolean
+ Dim bRet As Boolean
+ Dim uiValue(0) As UInteger
+ If bWrite Then uiValue(0) = Value
+ bRet = F_RW_DWord(bWrite, MemType, MemIndex, uiValue)
+ If Not bWrite Then Value = uiValue(0)
+ Return bRet
+ End Function
+
+ '''
+ ''' Legge Integer da MEMORIE PLC
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Tipo di memoria Fanuc
+ ''' Indice di memoria
+ ''' Matrice di valori da scrivere su scrittura o letti su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_Integer(ByVal bWrite As Boolean, ByVal MemType As MemType, ByVal MemIndex As Integer, ByRef Value() As Integer) As Boolean
+ Dim iodb2 As Focas1.IODBPMC2
+ Dim nlength As Integer
+ Dim nReturn As Integer
+ Dim nQta As Integer
+ Dim nBlock As Integer
+ Dim nMod As Integer
+
+ If Value Is Nothing Then Throw New InvalidOperationException
+
+ 'Calcolo la dimesione dell'array
+ nBlock = Value.Length \ F_MAX_ITEM
+ nMod = Value.Length Mod F_MAX_ITEM
+ If nMod > 0 Then nBlock += 1
+
+ For b = 0 To nBlock - 1
+ If b < nBlock - 1 Then
+ nQta = F_MAX_ITEM
+ Else
+ nQta = IIf(nMod > 0, nMod, F_MAX_ITEM)
+ End If
+
+ 'Setto il tipo di memoria
+ iodb2 = New Focas1.IODBPMC2
+ iodb2.type_a = MemType
+ iodb2.type_d = N_DWORD_TYPE
+ iodb2.datano_s = MemIndex + (b * F_MAX_ITEM * 4)
+ iodb2.datano_e = MemIndex + (b * F_MAX_ITEM * 4) + (nQta * 4) - 1
+ nlength = 8 + (nQta * 4)
+
+ If bWrite Then ' *** Write
+ ReDim iodb2.ldata(8 - 1)
+ For i = 0 To nQta - 1
+ iodb2.ldata(i) = Value(i + b * F_MAX_ITEM)
+ Next
+ nReturn = Focas1.pmc_wrpmcrng(nLibHandle(1), nlength, iodb2)
+ If F_CheckRetError_Pmc(nReturn, "pmc_wrpmcrng F_RW_Integer CNC.FANUC") Then
+ Throw New NcException("ERR pmc_wrpmcrng F_RW_Integer CNC.FANUC")
+ Return False
+ End If
+
+ Else ' ************* Read
+ nReturn = Focas1.pmc_rdpmcrng(nLibHandle(1), iodb2.type_a, iodb2.type_d, iodb2.datano_s, iodb2.datano_e, nlength, iodb2)
+ If F_CheckRetError_Pmc(nReturn, "pmc_rdpmcrng F_RW_Integer CNC.FANUC") Then
+ Throw New NcException("ERR pmc_rdpmcrng F_RW_Integer CNC.FANUC")
+ Return False
+ Else
+ For i = 0 To nQta - 1
+ Value(i + b * F_MAX_ITEM) = WordsToInteger(iodb2.ldata(i) And &HFFFF, (iodb2.ldata(i) And &HFFFF0000) >> 16)
+ Next
+ End If
+ End If
+ Next
+
+ Return True
+ End Function
+
+ '''
+ ''' Legge Integer da MEMORIE PLC
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Tipo di memoria Fanuc
+ ''' Indice di memoria
+ ''' Valore da scrivere su scrittura o letto su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_Integer(ByVal bWrite As Boolean, ByVal MemType As MemType, ByVal MemIndex As Integer, ByRef Value As Integer) As Boolean
+ Dim bRet As Boolean
+ Dim iValue(0) As Integer
+ If bWrite Then iValue(0) = Value
+ bRet = F_RW_Integer(bWrite, MemType, MemIndex, iValue)
+ If Not bWrite Then Value = iValue(0)
+ Return bRet
+ End Function
+
+ '''
+ ''' Legge o scrive Length and Radius Offset da tabella Utensili CN
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Numero dell'offset utensile
+ Public Overloads Sub F_RW_ToolOffset(ByVal bWrite As Boolean, ByVal ToolOffsetNumber As Integer, ByRef CutterRadius_Wear As Double, ByRef CutterRadius_Geometry As Double, ByRef ToolLenght_Wear As Double, ByRef ToolLenght_Geometry As Double)
+ Dim iodbpsd_1 As Focas1.IODBPSD_1
+ Dim odbtofs As Focas1.ODBTOFS
+ Dim nReturn As Integer
+ Dim bNcInInch As Boolean
+ Dim bTtInInch As Boolean
+ Dim valid_fig As Short
+ Dim dec_fig_in(31) As Short
+ Dim dec_fig_out(31) As Short
+
+ iodbpsd_1 = New Focas1.IODBPSD_1
+ odbtofs = New Focas1.ODBTOFS
+
+ 'Leggo se il CN è impostato in Inch (parametro 0.2)
+ nReturn = Focas1.cnc_rdparam(nLibHandle(1), 0, 0, 4 + 1, iodbpsd_1)
+ If F_CheckRetError_Cnc(nReturn, "cnc_rdparam F_RW_LengthOffset CNC.FANUC") Then
+ Throw New NcException("ERR cnc_rdparam F_RW_LengthOffset CNC.FANUC")
+ End If
+ bNcInInch = (iodbpsd_1.cdata And MASK_BIT2) = MASK_BIT2
+
+ 'Leggo se ToolTable è impostato in Inch
+ bTtInInch = Config.Options.CurrentOptions.ToolTable_Inch
+
+ 'leggo le cifre decimali
+ nReturn = Focas1.cnc_getfigure(nLibHandle(1), 1, valid_fig, dec_fig_in, dec_fig_out)
+ If F_CheckRetError_Cnc(nReturn, "cnc_getfigure F_RW_LengthOffset CNC.FANUC") Then
+ Throw New NcException("ERR cnc_getfigure F_RW_LengthOffset CNC.FANUC")
+ End If
+
+ If bWrite Then ' *** Write
+ For i = 0 To 3
+ Dim dblTmp As Double
+ Dim nTmp As Integer
+ Select Case i
+ Case 0 : dblTmp = CutterRadius_Wear
+ Case 1 : dblTmp = CutterRadius_Geometry
+ Case 2 : dblTmp = ToolLenght_Wear
+ Case 3 : dblTmp = ToolLenght_Geometry
+ End Select
+ 'moltiplico per le cifre decimali
+ dblTmp *= 10 ^ dec_fig_in(0)
+ 'riporto all'unità di misura di Nc
+ If bNcInInch And Not bTtInInch Then
+ nTmp = dblTmp / 25.4
+ ElseIf Not bNcInInch And bTtInInch Then
+ nTmp = dblTmp * 25.4
+ Else
+ nTmp = dblTmp
+ End If
+ nReturn = Focas1.cnc_wrtofs(nLibHandle(1), ToolOffsetNumber, i, 8, nTmp)
+ If F_CheckRetError_Pmc(nReturn, "cnc_wrtofs F_RW_ToolOffset CNC.FANUC") Then
+ Throw New NcException("ERR cnc_wrtofs F_RW_ToolOffset CNC.FANUC")
+ End If
+ Next
+
+ Else ' ************* Read
+ For i = 0 To 3
+ nReturn = Focas1.cnc_rdtofs(nLibHandle(1), ToolOffsetNumber, i, 8, odbtofs)
+ If F_CheckRetError_Pmc(nReturn, "cnc_rdtofs F_RW_ToolOffset CNC.FANUC") OrElse (odbtofs.datano <> ToolOffsetNumber Or odbtofs.type <> i) Then
+ Throw New NcException("ERR cnc_rdtofs F_RW_ToolOffset CNC.FANUC")
+ Else
+ Dim dblTmp As Double
+ 'riporto all'unità di misura di ToolTable
+ If bNcInInch And Not bTtInInch Then
+ dblTmp = odbtofs.data * 25.4
+ ElseIf Not bNcInInch And bTtInInch Then
+ dblTmp = odbtofs.data / 25.4
+ Else
+ dblTmp = odbtofs.data
+ End If
+ 'divido per le cifre decimali
+ dblTmp /= 10 ^ dec_fig_in(0)
+ 'memorizzo il dato
+ Select Case i
+ Case 0 : CutterRadius_Wear = dblTmp
+ Case 1 : CutterRadius_Geometry = dblTmp
+ Case 2 : ToolLenght_Wear = dblTmp
+ Case 3 : ToolLenght_Geometry = dblTmp
+ End Select
+ End If
+ Next
+
+ End If
+
+ End Sub
+
+ '''
+ ''' Cancella la tabella Utensili CN
+ '''
+ Public Sub F_Clear_ToolOffsets()
+
+ 'Memo di tipo C
+
+ Dim nMaxUt As Integer
+ Dim iodbto_1_3 As Focas1.IODBTO_1_3
+ Dim ofs_3 As Focas1.OFS_3 'OFS_3 Modificato per permettere di eleiminare tutti e 100 gli utensili
+ Dim nReturn As Integer
+
+ iodbto_1_3 = New Focas1.IODBTO_1_3
+ ofs_3 = New Focas1.OFS_3
+
+ nMaxUt = CncLib.CNC.Runtime.NC.MaxIdUtensile
+
+ Dim n As Integer
+ n = nMaxUt \ 100
+ n += IIf(nMaxUt Mod 100, 1, 0)
+
+
+ For j = 1 To n
+
+ iodbto_1_3.datano_s = ((j - 1) * 100) + 1
+ If nMaxUt < iodbto_1_3.datano_s + 100 Then
+ iodbto_1_3.datano_e = nMaxUt
+ Else
+ iodbto_1_3.datano_e = iodbto_1_3.datano_s + 99
+ End If
+ iodbto_1_3.ofs = ofs_3
+
+ For i As Integer = 0 To 3
+ iodbto_1_3.type = i
+ nReturn = Focas1.cnc_wrtofsr(nLibHandle(1), 8 + 4 * (iodbto_1_3.datano_e - iodbto_1_3.datano_s + 1), iodbto_1_3)
+ If F_CheckRetError_Pmc(nReturn, "cnc_wrtofsr F_Clear_ToolOffsets CNC.FANUC") Then
+ Throw New NcException("ERR cnc_wrtofsr F_Clear_ToolOffsets CNC.FANUC")
+ End If
+ Next
+ Next
+
+
+ End Sub
+
+
+ '''
+ ''' Legge o scrive Parametri Interi
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' 0: assigns no axis, -1: assigns all axes
+ ''' Indice di memoria
+ ''' 1 byte, 2 word, 3 dword
+ ''' Matrice di valori da scrivere su scrittura o letti su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_Param_Integer(ByVal bWrite As Boolean, ByVal Axis As Integer, ByVal ParamIndex As Integer, ByVal Size As Integer, ByRef Value() As Object) As Boolean
+ Dim iodbpsd1 As Focas1.IODBPSD_1 = Nothing
+ Dim iodbpsd3 As Focas1.IODBPSD_3 = Nothing
+ Dim nOdb As Focas1.ODBSYS
+ Dim nlength As Integer
+ Dim nQta As Integer
+ Dim nReturn As Integer
+ Dim nMemSize As Integer
+
+ If bWrite And Value Is Nothing Then Throw New InvalidOperationException
+
+ 'Seleziono la dimensione della memoria
+ Select Case Size
+ Case 1 : nMemSize = 1
+ Case 2 : nMemSize = 2
+ Case 3 : nMemSize = 4
+ Case Else : Throw New InvalidOperationException
+ End Select
+
+ 'Setto se parametro singolo o su ogni asse
+ If Axis >= 0 Then
+ iodbpsd1 = New Focas1.IODBPSD_1
+ nQta = 1
+ nlength = 4 + (nMemSize * nQta)
+ Else 'If Axis = -1 Then
+ iodbpsd3 = New Focas1.IODBPSD_3
+ nOdb = New Focas1.ODBSYS
+ nReturn = Focas1.cnc_sysinfo(nLibHandle(1), nOdb)
+ nQta = nOdb.axes.Length
+ nlength = 4 + (nMemSize * nQta)
+ End If
+
+ If bWrite Then ' *** Write
+ If nQta = 1 Then
+ iodbpsd1.datano = ParamIndex
+ Select Case Size
+ Case 1 : iodbpsd1.cdata = Value(0)
+ Case 2 : iodbpsd1.idata = Value(0)
+ Case 3 : iodbpsd1.ldata = Value(0)
+ End Select
+ Else
+ iodbpsd3.datano = ParamIndex
+ For i = 0 To nQta - 1
+ Select Case Size
+ Case 1 : iodbpsd3.cdatas(i) = Value(i)
+ Case 2 : iodbpsd3.idatas(i) = Value(i)
+ Case 3 : iodbpsd3.ldatas(i) = Value(i)
+ End Select
+ Next
+ End If
+
+ If nQta = 1 Then
+ nReturn = Focas1.cnc_wrparam(nLibHandle(1), nlength, iodbpsd1)
+ Else
+ nReturn = Focas1.cnc_wrparam(nLibHandle(1), nlength, iodbpsd3)
+ End If
+ If F_CheckRetError_Cnc(nReturn, "cnc_wrparam F_RW_Param_DWord CNC.FANUC") Then
+ Throw New NcException("ERR cnc_wrparam F_RW_Param_DWord CNC.FANUC")
+ Return False
+ End If
+
+ Else ' ************* Read
+ If nQta = 1 Then
+ nReturn = Focas1.cnc_rdparam(nLibHandle(1), ParamIndex, Axis, nlength, iodbpsd1)
+ Else
+ nReturn = Focas1.cnc_rdparam(nLibHandle(1), ParamIndex, Axis, nlength, iodbpsd3)
+ End If
+ If F_CheckRetError_Pmc(nReturn, "cnc_rdparam F_RW_Param_DWord CNC.FANUC") Then
+ Throw New NcException("ERR cnc_rdparam F_RW_Param_DWord CNC.FANUC")
+ Return False
+ Else
+ If nQta = 1 Then
+ Select Case Size
+ Case 1 : Value(0) = iodbpsd1.cdata
+ Case 2 : Value(0) = iodbpsd1.idata
+ Case 3 : Value(0) = iodbpsd1.ldata
+ End Select
+ Else
+ For i = 0 To nQta - 1
+ Select Case Size
+ Case 1 : Value(i) = iodbpsd3.cdatas
+ Case 2 : Value(i) = iodbpsd3.idatas
+ Case 3 : Value(i) = iodbpsd3.ldatas
+ End Select
+ Next
+ End If
+ End If
+ End If
+
+ Return True
+ End Function
+
+ '''
+ ''' Legge o scrive Parametri Interi
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Indice di memoria
+ ''' 1 byte, 2 word, 3 dword
+ ''' Valore da scrivere su scrittura o letto su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_Param_Integer(ByVal bWrite As Boolean, ByVal MemIndex As Integer, ByVal Size As Integer, ByRef Value As Object) As Boolean
+ Dim bRet As Boolean
+ Dim oValue(0) As Object
+ If bWrite Then oValue(0) = Value
+ bRet = F_RW_Param_Integer(bWrite, 0, MemIndex, Size, oValue)
+ If Not bWrite Then Value = oValue(0)
+ Return bRet
+ End Function
+
+
+
+ '''
+ ''' Legge o scrive le variabile Custom Macro
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Indice di memoria
+ ''' Matrice di valori da scrivere su scrittura o letti su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_Macro_Short(ByVal bWrite As Boolean, ByVal MacroIndex As Integer, ByRef Value() As Short) As Boolean
+ Dim iodbmr As Focas1.IODBMR
+ Dim nlength As Integer
+ Dim nReturn As Integer
+ Dim nQta As Integer
+ Dim nBlock As Integer
+ Dim nMod As Integer
+ Dim nActivePath As Integer
+
+ If Value Is Nothing Then Throw New InvalidOperationException
+
+ nActivePath = GetActivePath()
+
+ 'Calcolo la dimesione dell'array
+ nBlock = Value.Length \ F_MAX_MACRO
+ nMod = Value.Length Mod F_MAX_MACRO
+ If nMod > 0 Then nBlock += 1
+
+ For b = 0 To nBlock - 1
+ If b < nBlock - 1 Then
+ nQta = F_MAX_MACRO
+ Else
+ nQta = IIf(nMod > 0, nMod, F_MAX_MACRO)
+ End If
+
+ 'Setto il tipo di memoria
+ iodbmr = New Focas1.IODBMR
+ iodbmr.datano_s = MacroIndex + (b * F_MAX_MACRO)
+ iodbmr.datano_e = MacroIndex + (b * F_MAX_MACRO) + nQta - 1
+ nlength = 8 + (nQta * 8)
+
+ If bWrite Then ' *** Write
+ iodbmr.data = New Focas1.IODBMR1
+ iodbmr.data.data1 = New Focas1.IODBMR_data
+ iodbmr.data.data2 = New Focas1.IODBMR_data
+ iodbmr.data.data3 = New Focas1.IODBMR_data
+ iodbmr.data.data4 = New Focas1.IODBMR_data
+ iodbmr.data.data5 = New Focas1.IODBMR_data
+
+ If nQta >= 1 Then iodbmr.data.data1.mcr_val = Value(0 + b * F_MAX_MACRO)
+ If nQta >= 2 Then iodbmr.data.data2.mcr_val = Value(1 + b * F_MAX_MACRO)
+ If nQta >= 3 Then iodbmr.data.data3.mcr_val = Value(2 + b * F_MAX_MACRO)
+ If nQta >= 4 Then iodbmr.data.data4.mcr_val = Value(3 + b * F_MAX_MACRO)
+ If nQta >= 5 Then iodbmr.data.data5.mcr_val = Value(4 + b * F_MAX_MACRO)
+
+ nReturn = Focas1.cnc_wrmacror(nLibHandle(nActivePath), MacroIndex, iodbmr)
+ If F_CheckRetError_Cnc(nReturn, "cnc_wrmacror F_RW_Macro_Short CNC.FANUC") Then
+ Throw New NcException("ERR cnc_wrmacror F_RW_Macro_Short CNC.FANUC")
+ Return False
+ End If
+
+ Else ' ************* Read
+ nReturn = Focas1.cnc_rdmacror(nLibHandle(nActivePath), iodbmr.datano_s, iodbmr.datano_e, nlength, iodbmr)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_rdmacror F_RW_Macro_Short CNC.FANUC") Then
+ Throw New NcException("ERR cnc_rdmacror F_RW_Macro_Short CNC.FANUC")
+ Return False
+ Else
+ If nQta >= 1 Then Value(0 + b * F_MAX_MACRO) = iodbmr.data.data1.mcr_val / (10 ^ iodbmr.data.data1.dec_val)
+ If nQta >= 2 Then Value(1 + b * F_MAX_MACRO) = iodbmr.data.data2.mcr_val / (10 ^ iodbmr.data.data2.dec_val)
+ If nQta >= 3 Then Value(2 + b * F_MAX_MACRO) = iodbmr.data.data3.mcr_val / (10 ^ iodbmr.data.data3.dec_val)
+ If nQta >= 4 Then Value(3 + b * F_MAX_MACRO) = iodbmr.data.data4.mcr_val / (10 ^ iodbmr.data.data4.dec_val)
+ If nQta >= 5 Then Value(4 + b * F_MAX_MACRO) = iodbmr.data.data5.mcr_val / (10 ^ iodbmr.data.data5.dec_val)
+ End If
+ End If
+ Next
+
+ Return True
+ End Function
+
+ '''
+ ''' Legge o scrive le variabile Custom Macro
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Indice di memoria
+ ''' Matrice di valori da scrivere su scrittura o letti su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_Macro_Short(ByVal bWrite As Boolean, ByVal MacroIndex As Integer, ByRef Value As Short) As Boolean
+ Dim bRet As Boolean
+ Dim sValue(0) As Short
+ If bWrite Then sValue(0) = Value
+ bRet = F_RW_Macro_Short(bWrite, MacroIndex, sValue)
+ If Not bWrite Then Value = sValue(0)
+ Return bRet
+ End Function
+
+ Private Function GetNumDec(ByVal dVal As Double) As Short
+ ' Determino il numero di decimali più adatto, in base al valore
+ ' (per evitare l'overflow durante le operazioni di moltiplicazione)
+ If dVal < -99999999 Or dVal > 99999999 Then
+ GetNumDec = 0
+ ElseIf dVal < -9999999 Or dVal > 9999999 Then
+ GetNumDec = 1
+ ElseIf dVal < -999999 Or dVal > 999999 Then
+ GetNumDec = 2
+ ElseIf dVal < -99999 Or dVal > 99999 Then
+ GetNumDec = 3
+ ElseIf dVal < -9999 Or dVal > 9999 Then
+ GetNumDec = 4
+ ElseIf dVal < -999 Or dVal > 999 Then
+ GetNumDec = 5
+ ElseIf dVal < -99 Or dVal > 99 Then
+ GetNumDec = 6
+ ElseIf dVal < -9 Or dVal > 9 Then
+ GetNumDec = 7
+ Else
+ GetNumDec = 8
+ End If
+ End Function
+
+
+ '''
+ ''' Legge o scrive le variabile Custom Macro
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Indice di memoria
+ ''' Matrice di valori da scrivere su scrittura o letti su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_Macro_Double(ByVal bWrite As Boolean, ByVal MacroIndex As Integer, ByRef Value() As Double) As Boolean
+ Dim iodbmr As Focas1.IODBMR
+ Dim nlength As Integer
+ Dim nReturn As Integer
+ Dim nQta As Integer
+ Dim nBlock As Integer
+ Dim nMod As Integer
+ Dim nActivePath As Integer
+
+ If Value Is Nothing Then Throw New InvalidOperationException
+
+ nActivePath = GetActivePath()
+
+ 'Calcolo la dimesione dell'array
+ nBlock = Value.Length \ F_MAX_MACRO
+ nMod = Value.Length Mod F_MAX_MACRO
+ If nMod > 0 Then nBlock += 1
+
+ For b = 0 To nBlock - 1
+ If b < nBlock - 1 Then
+ nQta = F_MAX_MACRO
+ Else
+ nQta = IIf(nMod > 0, nMod, F_MAX_MACRO)
+ End If
+
+ 'Setto il tipo di memoria
+ iodbmr = New Focas1.IODBMR
+ iodbmr.datano_s = MacroIndex + (b * F_MAX_MACRO)
+ iodbmr.datano_e = MacroIndex + (b * F_MAX_MACRO) + nQta - 1
+ nlength = 8 + (nQta * 8)
+
+ If bWrite Then ' *** Write
+ iodbmr.data = New Focas1.IODBMR1
+ iodbmr.data.data1 = New Focas1.IODBMR_data
+ iodbmr.data.data2 = New Focas1.IODBMR_data
+ iodbmr.data.data3 = New Focas1.IODBMR_data
+ iodbmr.data.data4 = New Focas1.IODBMR_data
+ iodbmr.data.data5 = New Focas1.IODBMR_data
+
+ ' Determino il numero di decimali più adatto, in base al valore
+ ' (per evitare l'overflow durante le operazioni di moltiplicazione)
+ If nQta >= 1 Then iodbmr.data.data1.dec_val = GetNumDec(Value(0 + b * F_MAX_MACRO))
+ If nQta >= 2 Then iodbmr.data.data2.dec_val = GetNumDec(Value(1 + b * F_MAX_MACRO))
+ If nQta >= 3 Then iodbmr.data.data3.dec_val = GetNumDec(Value(2 + b * F_MAX_MACRO))
+ If nQta >= 4 Then iodbmr.data.data4.dec_val = GetNumDec(Value(3 + b * F_MAX_MACRO))
+ If nQta >= 5 Then iodbmr.data.data5.dec_val = GetNumDec(Value(4 + b * F_MAX_MACRO))
+
+ If nQta >= 1 Then iodbmr.data.data1.mcr_val = Value(0 + b * F_MAX_MACRO) * (10 ^ iodbmr.data.data1.dec_val)
+ If nQta >= 2 Then iodbmr.data.data2.mcr_val = Value(1 + b * F_MAX_MACRO) * (10 ^ iodbmr.data.data2.dec_val)
+ If nQta >= 3 Then iodbmr.data.data3.mcr_val = Value(2 + b * F_MAX_MACRO) * (10 ^ iodbmr.data.data3.dec_val)
+ If nQta >= 4 Then iodbmr.data.data4.mcr_val = Value(3 + b * F_MAX_MACRO) * (10 ^ iodbmr.data.data4.dec_val)
+ If nQta >= 5 Then iodbmr.data.data5.mcr_val = Value(4 + b * F_MAX_MACRO) * (10 ^ iodbmr.data.data5.dec_val)
+
+ nReturn = Focas1.cnc_wrmacror(nLibHandle(nActivePath), MacroIndex, iodbmr)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_wrmacror F_RW_Macro_Double CNC.FANUC") Then
+ Throw New NcException("ERR cnc_wrmacror F_RW_Macro_Double CNC.FANUC")
+ Return False
+ End If
+
+ Else ' ************* Read
+ nReturn = Focas1.cnc_rdmacror(nLibHandle(nActivePath), iodbmr.datano_s, iodbmr.datano_e, nlength, iodbmr)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_rdmacror F_RW_Macro_Double CNC.FANUC") Then
+ Throw New NcException("ERR cnc_rdmacror F_RW_Macro_Double CNC.FANUC")
+ Return False
+ Else
+ If nQta >= 1 Then Value(0 + b * F_MAX_MACRO) = iodbmr.data.data1.mcr_val / (10 ^ iodbmr.data.data1.dec_val)
+ If nQta >= 2 Then Value(1 + b * F_MAX_MACRO) = iodbmr.data.data2.mcr_val / (10 ^ iodbmr.data.data2.dec_val)
+ If nQta >= 3 Then Value(2 + b * F_MAX_MACRO) = iodbmr.data.data3.mcr_val / (10 ^ iodbmr.data.data3.dec_val)
+ If nQta >= 4 Then Value(3 + b * F_MAX_MACRO) = iodbmr.data.data4.mcr_val / (10 ^ iodbmr.data.data4.dec_val)
+ If nQta >= 5 Then Value(4 + b * F_MAX_MACRO) = iodbmr.data.data5.mcr_val / (10 ^ iodbmr.data.data5.dec_val)
+ End If
+ End If
+ Next
+
+ Return True
+ End Function
+
+ '''
+ ''' Legge o scrive le variabile Custom Macro
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Indice di memoria
+ ''' Matrice di valori da scrivere su scrittura o letti su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_Macro_Double(ByVal bWrite As Boolean, ByVal MacroIndex As Integer, ByRef Value As Double) As Boolean
+ Dim bRet As Boolean
+ Dim sValue(0) As Double
+ If bWrite Then sValue(0) = Value
+ bRet = F_RW_Macro_Double(bWrite, MacroIndex, sValue)
+ If Not bWrite Then Value = sValue(0)
+ Return bRet
+ End Function
+
+ '''
+ ''' Legge o scrive le variabile P Code Macro
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Indice di memoria
+ ''' Matrice di valori da scrivere su scrittura o letti su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_PCodeMacro_Short(ByVal bWrite As Boolean, ByVal MacroIndex As Integer, ByRef Value() As Short) As Boolean
+ Dim iodbpr As Focas1.IODBPR
+ Dim nlength As Integer
+ Dim nReturn As Integer
+ Dim nQta As Integer
+ Dim nBlock As Integer
+ Dim nMod As Integer
+ Dim nActivePath As Integer
+
+ If Value Is Nothing Then Throw New InvalidOperationException
+
+ nActivePath = GetActivePath()
+
+ 'Calcolo la dimesione dell'array
+ nBlock = Value.Length \ F_MAX_MACRO
+ nMod = Value.Length Mod F_MAX_MACRO
+ If nMod > 0 Then nBlock += 1
+
+ For b = 0 To nBlock - 1
+ If b < nBlock - 1 Then
+ nQta = F_MAX_MACRO
+ Else
+ nQta = IIf(nMod > 0, nMod, F_MAX_MACRO)
+ End If
+
+ 'Setto il tipo di memoria
+ iodbpr = New Focas1.IODBPR
+ iodbpr.datano_s = MacroIndex + (b * F_MAX_MACRO)
+ iodbpr.datano_e = MacroIndex + (b * F_MAX_MACRO) + nQta - 1
+ nlength = 12 + (nQta * 8)
+
+ If bWrite Then ' *** Write
+ iodbpr.data = New Focas1.IODBPR1
+ iodbpr.data.data1 = New Focas1.IODBPR_data
+ iodbpr.data.data2 = New Focas1.IODBPR_data
+ iodbpr.data.data3 = New Focas1.IODBPR_data
+ iodbpr.data.data4 = New Focas1.IODBPR_data
+ iodbpr.data.data5 = New Focas1.IODBPR_data
+
+ If nQta >= 1 Then iodbpr.data.data1.mcr_val = Value(0 + b * F_MAX_MACRO)
+ If nQta >= 2 Then iodbpr.data.data2.mcr_val = Value(1 + b * F_MAX_MACRO)
+ If nQta >= 3 Then iodbpr.data.data3.mcr_val = Value(2 + b * F_MAX_MACRO)
+ If nQta >= 4 Then iodbpr.data.data4.mcr_val = Value(3 + b * F_MAX_MACRO)
+ If nQta >= 5 Then iodbpr.data.data5.mcr_val = Value(4 + b * F_MAX_MACRO)
+
+ nReturn = Focas1.cnc_wrpmacror(nLibHandle(nActivePath), MacroIndex, iodbpr)
+ If F_CheckRetError_Cnc(nReturn, "cnc_wrpmacror F_RW_PCodeMacro_Short CNC.FANUC") Then
+ Throw New NcException("ERR cnc_wrpmacror F_RW_PCodeMacro_Short CNC.FANUC")
+ Return False
+ End If
+
+ Else ' ************* Read
+ nReturn = Focas1.cnc_rdpmacror(nLibHandle(nActivePath), iodbpr.datano_s, iodbpr.datano_e, nlength, iodbpr)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_rdmacror F_RW_Macro_Short CNC.FANUC") Then
+ Throw New NcException("ERR cnc_rdmacror F_RW_Macro_Short CNC.FANUC")
+ Return False
+ Else
+ If nQta >= 1 Then Value(0 + b * F_MAX_MACRO) = iodbpr.data.data1.mcr_val / (10 ^ iodbpr.data.data1.dec_val)
+ If nQta >= 2 Then Value(1 + b * F_MAX_MACRO) = iodbpr.data.data2.mcr_val / (10 ^ iodbpr.data.data2.dec_val)
+ If nQta >= 3 Then Value(2 + b * F_MAX_MACRO) = iodbpr.data.data3.mcr_val / (10 ^ iodbpr.data.data3.dec_val)
+ If nQta >= 4 Then Value(3 + b * F_MAX_MACRO) = iodbpr.data.data4.mcr_val / (10 ^ iodbpr.data.data4.dec_val)
+ If nQta >= 5 Then Value(4 + b * F_MAX_MACRO) = iodbpr.data.data5.mcr_val / (10 ^ iodbpr.data.data5.dec_val)
+ End If
+ End If
+ Next
+
+ Return True
+ End Function
+
+
+ '''
+ ''' Legge o scrive le variabile P Code Macro
+ '''
+ ''' Se True SCRIVE, se False LEGGE
+ ''' Indice di memoria
+ ''' Matrice di valori da scrivere su scrittura o letti su lettura
+ ''' True se andata a buon fine
+ Public Overloads Function F_RW_PCodeMacro_Short(ByVal bWrite As Boolean, ByVal MacroIndex As Integer, ByRef Value As Short) As Boolean
+ Dim bRet As Boolean
+ Dim sValue(0) As Short
+ If bWrite Then sValue(0) = Value
+ bRet = F_RW_PCodeMacro_Short(bWrite, MacroIndex, sValue)
+ If Not bWrite Then Value = sValue(0)
+ Return bRet
+ End Function
+
+
+ Public Overloads Function F_CheckRetError_Cnc(ByVal nReturn As Short, ByVal Position As String) As Boolean
+ Dim szErrorDesc As String
+
+ If nReturn <> Focas1.EW_OK Then
+ 'Seleziono il messaggio
+ Select Case nReturn
+ Case Focas1.EW_PROTOCOL : szErrorDesc = "Protocol error (Ethernet version only)"
+ Case Focas1.EW_SOCKET : szErrorDesc = "Socket error (Ethernet version only)"
+ Case Focas1.EW_NODLL : szErrorDesc = "DLL file error"
+ Case Focas1.EW_BUS : szErrorDesc = "Bus error (HSSB version only)"
+ Case Focas1.EW_SYSTEM2 : szErrorDesc = "System error (2) (HSSB version only)"
+ Case Focas1.EW_HSSB : szErrorDesc = "Communication error of HSSB (HSSB version only)"
+ Case Focas1.EW_HANDLE : szErrorDesc = "Handle number error"
+ Case Focas1.EW_VERSION : szErrorDesc = "Version mismatch between the CNC/PMC and library"
+ Case Focas1.EW_UNEXP : szErrorDesc = "Abnormal library state"
+ Case Focas1.EW_SYSTEM : szErrorDesc = "System error (HSSB version only)"
+ Case Focas1.EW_PARITY : szErrorDesc = "Shared RAM parity error (HSSB version only)"
+ Case Focas1.EW_MMCSYS : szErrorDesc = "FANUC drivers installation error (HSSB version only)"
+ Case Focas1.EW_RESET : szErrorDesc = "Reset or stop request"
+ Case Focas1.EW_BUSY : szErrorDesc = "Busy"
+ Case Focas1.EW_OK : szErrorDesc = "Normal termination"
+ Case Focas1.EW_FUNC : szErrorDesc = "Error(function is not executed, or not available)"
+ Case Focas1.EW_LENGTH : szErrorDesc = "Error(data block length error, error of number of data)"
+ Case Focas1.EW_NUMBER : szErrorDesc = "Error(data number error)"
+ Case Focas1.EW_ATTRIB : szErrorDesc = "Error(data attribute error)"
+ Case Focas1.EW_DATA : szErrorDesc = "Error(data error)"
+ Case Focas1.EW_NOOPT : szErrorDesc = "Error(no option)"
+ Case Focas1.EW_PROT : szErrorDesc = "Error(write protection)"
+ Case Focas1.EW_OVRFLOW : szErrorDesc = "Error(memory overflow)"
+ Case Focas1.EW_PARAM : szErrorDesc = "Error(CNC parameter error)"
+ Case Focas1.EW_BUFFER : szErrorDesc = "Error(buffer empty/full)"
+ Case Focas1.EW_PATH : szErrorDesc = "Error(path number error)"
+ Case Focas1.EW_MODE : szErrorDesc = "Error(CNC mode error)"
+ Case Focas1.EW_REJECT : szErrorDesc = "Error(CNC execution rejection)"
+ Case Focas1.EW_DTSRVR : szErrorDesc = "Error(Data server error)"
+ Case Focas1.EW_ALARM : szErrorDesc = "Error(alarm)"
+ Case Focas1.EW_STOP : szErrorDesc = "Error(stop)"
+ Case Focas1.EW_PASSWD : szErrorDesc = "Error(State of data protection)"
+ Case Else : szErrorDesc = "- ERRORE CNC INESISTENTE -"
+ End Select
+
+ 'Stampo il messaggio
+ 'If Config.Settings.Settings.Debug > 0 Then
+ ' impostato a true x mostrare errore
+ If False Then
+ 'If nReturn <> Focas1.EW_SOCKET Then 'tranne su errore di connessione
+ 'CncLib.App.Runtime..Log.WW("ERR pmc_wrpmcrng on F_RW_DWord CNC.FANUC", "Return=" & nReturn, True)
+ MsgBox(szErrorDesc & vbLf & "Occurred in: " & Position, MsgBoxStyle.Exclamation + MsgBoxStyle.ApplicationModal, "Error on Fanuc CNC Data Window")
+ 'End If
+ End If
+
+ Return True 'presenza errore
+ End If
+
+ Return False 'assenza errori
+ End Function
+
+ Public Overloads Function F_CheckRetError_Pmc(ByVal nReturn As Short, ByVal Position As String) As Boolean
+ Dim szErrorDesc As String
+
+ If nReturn <> Focas1.EW_OK Then
+ 'Seleziono il messaggio
+ Select Case nReturn
+ Case Focas1.EW_PROTOCOL : szErrorDesc = "Protocol error (Ethernet version only)"
+ Case Focas1.EW_SOCKET : szErrorDesc = "Socket error (Ethernet version only)"
+ Case Focas1.EW_NODLL : szErrorDesc = "DLL file error"
+ Case Focas1.EW_BUS : szErrorDesc = "Bus error (HSSB version only)"
+ Case Focas1.EW_SYSTEM2 : szErrorDesc = "System error (2) (HSSB version only)"
+ Case Focas1.EW_HSSB : szErrorDesc = "Communication error of HSSB (HSSB version only)"
+ Case Focas1.EW_HANDLE : szErrorDesc = "Handle number error"
+ Case Focas1.EW_VERSION : szErrorDesc = "Version mismatch between the CNC/PMC and library"
+ Case Focas1.EW_UNEXP : szErrorDesc = "Abnormal library state"
+ Case Focas1.EW_SYSTEM : szErrorDesc = "System error (HSSB version only)"
+ Case Focas1.EW_PARITY : szErrorDesc = "Shared RAM parity error (HSSB version only)"
+ Case Focas1.EW_MMCSYS : szErrorDesc = "FANUC drivers installation error (HSSB version only)"
+ Case Focas1.EW_OK : szErrorDesc = "Normal termination"
+ Case Focas1.EW_NOPMC : szErrorDesc = "Error(No PMC)"
+ Case Focas1.EW_LENGTH : szErrorDesc = "Error(data block length error)"
+ Case Focas1.EW_RANGE : szErrorDesc = "Error(address range error)"
+ Case Focas1.EW_TYPE : szErrorDesc = "Error(address type/data type error)"
+ Case Focas1.EW_DATA : szErrorDesc = "Error(data error)"
+ Case Focas1.EW_NOOPT : szErrorDesc = "Error(no option)"
+ Case Focas1.EW_BUFFER : szErrorDesc = "Error(buffer empty/full)"
+ Case Focas1.EW_PASSWD : szErrorDesc = "Error(State of data protection)"
+ Case Else : szErrorDesc = "- ERRORE PMC INESISTENTE -"
+ End Select
+
+ ''Stampo il messaggio
+ 'If (Config.Settings.Settings.Debug > 0) Then
+ ' 'If nReturn <> Focas1.EW_SOCKET Then 'tranne su errore di connessione
+ ' 'CncLib.App.Runtime..Log.WW("ERR pmc_wrpmcrng on F_RW_DWord CNC.FANUC", "Return=" & nReturn, True)
+ ' MsgBox(szErrorDesc & vbLf & "Occurred in: " & Position, MsgBoxStyle.Exclamation + MsgBoxStyle.ApplicationModal, "Error on Fanuc CNC Data Window")
+ ' 'End If
+ 'End If
+ Return True 'presenza errore
+ End If
+
+ Return False 'assenza errori
+ End Function
+
+#Region "Funzioni specifiche IOT"
+
+
+ Public Function getPrgName() As Focas1.ODBEXEPRG
+ ' RIFERIMENTO:
+ ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rdposition.htm
+
+ Dim nPathIdx As Integer
+ Dim nReturn As Integer
+
+ Dim prgName As Focas1.ODBEXEPRG
+
+ prgName = New Focas1.ODBEXEPRG
+
+ 'leggo il numero del processo attivo
+ nPathIdx = GetActivePath()
+
+ If Is30Series Then
+
+ ' leggo tutto!!!
+ nReturn = Focas1.cnc_exeprgname(nLibHandle(nPathIdx), prgName)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_exeprgname CNC.FANUC.CncLib") Then
+ Throw New NcException("ERR cnc_exeprgname CNC.FANUC.CncLib")
+ End If
+ End If
+
+ Return prgName
+
+ End Function
+
+ Public Function getAllAxisPos() As Focas1.ODBPOS
+ ' RIFERIMENTO:
+ ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rdposition.htm
+
+ Dim nPathIdx As Integer
+ Dim nNumAxisRead As Integer
+ Dim nReturn As Integer
+
+ Dim posizAssi As Focas1.ODBPOS
+
+ 'leggo il numero del processo attivo
+ nPathIdx = GetActivePath()
+ 'leggo num max assi dal cn
+ nNumAxisRead = Focas1.MAX_AXIS
+
+ If Is30Series Then
+
+ ' leggo tutto!!!
+ nReturn = Focas1.cnc_rdposition(nLibHandle(nPathIdx), -1, nNumAxisRead, posizAssi)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_rdposition RefreshAxisPosition CNC.FANUC.CncLib") Then
+ Throw New NcException("ERR cnc_rdposition RefreshAxisPosition CNC.FANUC.CncLib")
+ End If
+ End If
+
+ Return posizAssi
+
+ End Function
+
+ Public Function getAllAxisLoad() As Focas1.ODBSVLOAD
+ ' RIFERIMENTO:
+ ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rdsvmeter.htm
+
+ Dim nPathIdx As Integer
+ Dim nNumAxisRead As Integer
+ Dim nReturn As Integer
+
+ Dim caricoAssi As Focas1.ODBSVLOAD
+
+ 'leggo il numero del processo attivo
+ nPathIdx = GetActivePath()
+ 'leggo num max assi dal cn
+ nNumAxisRead = Focas1.MAX_AXIS
+
+ If Is30Series Then
+
+ ' leggo tutto!!!
+ nReturn = Focas1.cnc_rdsvmeter(nLibHandle(nPathIdx), nNumAxisRead, caricoAssi)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_rdsvmeter RefreshAxisMeter CNC.FANUC.CncLib") Then
+ Throw New NcException("ERR cnc_rdsvmeter RefreshAxisMeter CNC.FANUC.CncLib")
+ End If
+ End If
+
+ Return caricoAssi
+
+ End Function
+
+ Public Function getGlobalFeedrate() As Focas1.ODBACT
+ ' RIFERIMENTO:
+ ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_actf.htm
+
+ Dim nPathIdx As Integer
+ Dim nNumAxisRead As Integer
+ Dim nReturn As Integer
+
+ Dim feedData As Focas1.ODBACT
+ ' inizializzo
+ feedData = New Focas1.ODBACT
+
+ 'leggo il numero del processo attivo
+ nPathIdx = GetActivePath()
+ 'leggo num max assi dal cn
+ nNumAxisRead = Focas1.MAX_AXIS
+
+ If Is30Series Then
+
+ ' leggo feed globale
+ nReturn = Focas1.cnc_actf(nLibHandle(nPathIdx), feedData)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_actf RefreshActFeedRate CNC.FANUC.CncLib") Then
+ Throw New NcException("ERR cnc_actf RefreshActFeedRate CNC.FANUC.CncLib")
+ End If
+ End If
+
+ Return feedData
+
+ End Function
+
+ Public Function getSpindleLoad() As Focas1.ODBSPN
+ ' RIFERIMENTO:
+ ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rdspload.htm
+ ' RICHIEDE DRIVER ESTESO!!! NON VA!!!
+
+ Dim nPathIdx As Integer
+ Dim nNumAxisRead As Integer
+ Dim nReturn As Integer
+
+ Dim allData As Focas1.ODBSPN
+ ' inizializzo
+ allData = New Focas1.ODBSPN
+
+ 'leggo il numero del processo attivo
+ nPathIdx = GetActivePath()
+ 'leggo num max assi dal cn
+ nNumAxisRead = Focas1.MAX_AXIS
+
+ If Is30Series Then
+
+ ' leggo feed globale
+ nReturn = Focas1.cnc_rdspload(nLibHandle(nPathIdx), -1, allData)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_rdspload RefreshAllSpindleLoad CNC.FANUC.CncLib") Then
+ Throw New NcException("ERR cnc_rdspload RefreshAllSpindleLoad CNC.FANUC.CncLib")
+ End If
+ End If
+
+ Return allData
+
+ End Function
+
+ Public Function getAllDynData() As Focas1.ODBDY2_1
+ ' RIFERIMENTO:
+ ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rddynamic2.htm
+
+ Dim nPathIdx As Integer
+ Dim nNumAxisRead As Integer
+ Dim nReturn As Integer
+
+ Dim allData As Focas1.ODBDY2_1
+ ' inizializzo
+ allData = New Focas1.ODBDY2_1
+
+ 'leggo il numero del processo attivo
+ nPathIdx = GetActivePath()
+ 'leggo num max assi dal cn
+ nNumAxisRead = Focas1.MAX_AXIS
+
+ If Is30Series Then
+
+ nReturn = Focas1.cnc_rddynamic2(nLibHandle(nPathIdx), 1, 28 + 4 * (4 * 1), allData)
+ '!!! non funziona: con -1 LEGGE 1 SOLO ASSE!!!
+ 'nReturn = Focas1.cnc_rddynamic2(nLibHandle(nPathIdx), -1, 28 + 4 * (4 * nNumAxisRead), allData)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_rddynamic2 RefreshAllData CNC.FANUC.CncLib") Then
+ Throw New NcException("ERR cnc_rddynamic2 RefreshAllData CNC.FANUC.CncLib")
+ End If
+ End If
+
+ Return allData
+
+ End Function
+
+ Public Function getCncAlarm() As Focas1.ODBALMMSG2
+ ' RIFERIMENTO:
+ ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Misc\cnc_rdalmmsg2.htm
+ ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Misc\cnc_rdalminfo.htm
+
+ Dim nPathIdx As Integer
+ Dim nNumAxisRead As Integer
+ Dim nReturn As Integer
+
+ Dim allData As Focas1.ODBALMMSG2
+ ' inizializzo
+ allData = New Focas1.ODBALMMSG2
+
+ 'leggo il numero del processo attivo
+ nPathIdx = GetActivePath()
+ 'leggo num max assi dal cn
+ nNumAxisRead = Focas1.MAX_AXIS
+
+ ' vettore num allarmi MAX da leggere......
+ Dim numAllarmi As Int16
+ numAllarmi = 512
+
+ If Is30Series Then
+
+ Try
+ ' leggo tutto!!!
+ nReturn = Focas1.cnc_rdalmmsg2(nLibHandle(nPathIdx), -1, numAllarmi, allData)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_rdalmmsg2 GetCncAlarm CNC.FANUC.CncLib") Then
+ Throw New NcException("ERR cnc_rdalmmsg2 GetCncAlarm CNC.FANUC.CncLib")
+ Return New Focas1.ODBALMMSG2
+ End If
+ Catch ex As Exception
+
+ End Try
+
+ End If
+
+ Return allData
+
+ End Function
+
+ Public Function getPathGCodeMod() As Focas1.ODBGCD
+ ' RIFERIMENTO:
+ ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Misc\cnc_rdgcode.htm
+
+ Dim nPathIdx As Integer
+ Dim nNumAxisRead As Integer
+ Dim nReturn As Integer
+
+ Dim actGCode As Focas1.ODBGCD
+ ' inizializzo
+ actGCode = New Focas1.ODBGCD
+
+ 'leggo il numero del processo attivo
+ nPathIdx = GetActivePath()
+ 'leggo num max assi dal cn
+ nNumAxisRead = Focas1.MAX_AXIS
+
+ If Is30Series Then
+
+ ' leggo tutto!!! 0-27 (28 elementi)
+ nReturn = Focas1.cnc_rdgcode(nLibHandle(nPathIdx), -1, 1, 37, actGCode)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_rdgcode RefreshPathGCode CNC.FANUC.CncLib") Then
+ Throw New NcException("ERR cnc_rdgcode RefreshPathGCode CNC.FANUC.CncLib")
+ End If
+ End If
+
+ Return actGCode
+
+ End Function
+
+ Public Function getPathGCode1Shot() As Focas1.ODBGCD
+ ' RIFERIMENTO:
+ ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Misc\cnc_rdgcode.htm
+
+ Dim nPathIdx As Integer
+ Dim nNumAxisRead As Integer
+ Dim nReturn As Integer
+
+ Dim actGCode As Focas1.ODBGCD
+ ' inizializzo
+ actGCode = New Focas1.ODBGCD
+
+ 'leggo il numero del processo attivo
+ nPathIdx = GetActivePath()
+ 'leggo num max assi dal cn
+ nNumAxisRead = Focas1.MAX_AXIS
+
+ If Is30Series Then
+
+ ' leggo tutto!!! 0-27 (28 elementi)
+ nReturn = Focas1.cnc_rdgcode(nLibHandle(nPathIdx), -2, 1, 4, actGCode)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_rdgcode RefreshPathGCode CNC.FANUC.CncLib") Then
+ Throw New NcException("ERR cnc_rdgcode RefreshPathGCode CNC.FANUC.CncLib")
+ End If
+ End If
+
+ Return actGCode
+
+ End Function
+
+ Public Function getPathTTCoord() As Focas1.ODB5AXMAN
+ ' RIFERIMENTO:
+ ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rd5axmandt.htm
+
+ Dim nPathIdx As Integer
+ Dim nNumAxisRead As Integer
+ Dim nReturn As Integer
+
+ Dim ttCoord As Focas1.ODB5AXMAN
+ ' inizializzo
+ ttCoord = New Focas1.ODB5AXMAN
+
+ 'leggo il numero del processo attivo
+ nPathIdx = GetActivePath()
+ 'leggo num max assi dal cn
+ nNumAxisRead = Focas1.MAX_AXIS
+
+ If Is30Series Then
+
+ ' leggo tutto!!!
+ nReturn = Focas1.cnc_rd5axmandt(nLibHandle(nPathIdx), ttCoord)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_rd3dtooltip RefreshPathTTCoord CNC.FANUC.CncLib") Then
+ Throw New NcException("ERR cnc_rd3dtooltip RefreshPathTTCoord CNC.FANUC.CncLib")
+ End If
+ End If
+
+ Return ttCoord
+
+ End Function
+
+ Public Function getSpindleSpeed() As Focas1.ODBSPEED
+ ' RIFERIMENTO:
+ ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rdspeed.htm
+
+ Dim nPathIdx As Integer
+ Dim nNumAxisRead As Integer
+ Dim nReturn As Integer
+
+ Dim speedAssi As Focas1.ODBSPEED
+
+ 'leggo il numero del processo attivo
+ nPathIdx = GetActivePath()
+ 'leggo num max assi dal cn
+ nNumAxisRead = Focas1.MAX_AXIS
+
+ If Is30Series Then
+
+ ' leggo tutto!!!
+ nReturn = Focas1.cnc_rdspeed(nLibHandle(nPathIdx), -1, speedAssi)
+
+ If F_CheckRetError_Cnc(nReturn, "cnc_rdspeed RefreshAxisSpeed CNC.FANUC.CncLib") Then
+ Throw New NcException("ERR cnc_rdspeed RefreshAxisSpeed CNC.FANUC.CncLib")
+ End If
+ End If
+
+ Return speedAssi
+
+ End Function
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/CncLib/CNC/CNC.FANUC/_/CNC.FANUC.Err.vb b/CncLib/CNC/CNC.FANUC/_/CNC.FANUC.Err.vb
new file mode 100644
index 00000000..8a0b9fb9
--- /dev/null
+++ b/CncLib/CNC/CNC.FANUC/_/CNC.FANUC.Err.vb
@@ -0,0 +1,65 @@
+Namespace CNC
+
+ Partial Public Class FANUC
+ 'Private Class Err
+
+ ' Private _Errors As Dictionary(Of Integer, String) 'Hashtable
+
+ ' Public Sub New()
+ ' _Errors = New Dictionary(Of Integer, String) 'Hashtable
+ ' _Errors.Add(Focas1.EW_PROTOCOL, "protocol error") '-17
+ ' _Errors.Add(Focas1.EW_SOCKET, "Windows socket error") '-16
+ ' _Errors.Add(Focas1.EW_NODLL, "DLL not exist error") '-15
+ ' _Errors.Add(Focas1.EW_BUS, "bus error") '-11
+ ' _Errors.Add(Focas1.EW_SYSTEM2, "system error") '-10
+ ' _Errors.Add(Focas1.EW_HSSB, "hssb communication error") '-9
+ ' _Errors.Add(Focas1.EW_HANDLE, "Windows library handle error") '-8
+ ' _Errors.Add(Focas1.EW_VERSION, "CNC/PMC version missmatch") '-7
+ ' _Errors.Add(Focas1.EW_UNEXP, "abnormal error") '-6
+ ' _Errors.Add(Focas1.EW_SYSTEM, "system error") '-5
+ ' _Errors.Add(Focas1.EW_PARITY, "shared RAM parity error") '-4
+ ' _Errors.Add(Focas1.EW_MMCSYS, "emm386 or mmcsys install error") '-3
+ ' _Errors.Add(Focas1.EW_RESET, "reset or stop occured error") '-2
+ ' _Errors.Add(Focas1.EW_BUSY, "busy error") '-1
+ ' _Errors.Add(Focas1.EW_OK, "no problem") '0
+ ' '_Errors.Add(Focas1.EW_FUNC, "command prepare error") '1
+ ' '_Errors.Add(Focas1.EW_NOPMC, "pmc not exist") '1
+ ' _Errors.Add(1, "command prepare error OR pmc not exist") '1
+ ' _Errors.Add(Focas1.EW_LENGTH, "data block length error") '2
+ ' '_Errors.Add(Focas1.EW_NUMBER, "data number error") '3
+ ' '_Errors.Add(Focas1.EW_RANGE, "address range error") '3
+ ' _Errors.Add(3, "data number error OR address range error") '3
+ ' '_Errors.Add(Focas1.EW_ATTRIB, "data attribute error") '4
+ ' '_Errors.Add(Focas1.EW_TYPE, "data type error") '4
+ ' _Errors.Add(4, "data attribute error OR data type error") '4
+ ' _Errors.Add(Focas1.EW_DATA, "data error") '5
+ ' _Errors.Add(Focas1.EW_NOOPT, "no option error") '6
+ ' _Errors.Add(Focas1.EW_PROT, "write protect error") '7
+ ' _Errors.Add(Focas1.EW_OVRFLOW, "memory overflow error") '8
+ ' _Errors.Add(Focas1.EW_PARAM, "cnc parameter not correct error") '9
+ ' _Errors.Add(Focas1.EW_BUFFER, "buffer error") '10
+ ' _Errors.Add(Focas1.EW_PATH, "path error") '11
+ ' _Errors.Add(Focas1.EW_MODE, "cnc mode error") '12
+ ' _Errors.Add(Focas1.EW_REJECT, "execution rejected error") '13
+ ' _Errors.Add(Focas1.EW_DTSRVR, "data server error") '14
+ ' _Errors.Add(Focas1.EW_ALARM, "alarm has been occurred") '15
+ ' _Errors.Add(Focas1.EW_STOP, "CNC is not running") '16
+ ' _Errors.Add(Focas1.EW_PASSWD, "protection data error") '17
+ ' End Sub
+
+ ' '''
+ ' ''' Restituisce una stringa con la descrizione dell'errore
+ ' '''
+ ' Public Function GetInfo(ByVal nError As Integer) As String
+ ' Try
+ ' Return String.Format("({0}) ""{1}""", nError, _Errors(nError)) 'es: (0) "no problem"
+ ' Catch ex As Exception
+ ' Return "!!! Error Info not available !!!"
+ ' End Try
+ ' End Function
+
+ 'End Class
+ End Class
+
+End Namespace
+
diff --git a/CncLib/CNC/CNC.FANUC/_/fwlib32.vb b/CncLib/CNC/CNC.FANUC/_/fwlib32.vb
new file mode 100644
index 00000000..94e6d90a
--- /dev/null
+++ b/CncLib/CNC/CNC.FANUC/_/fwlib32.vb
@@ -0,0 +1,10952 @@
+'-------------------------------------------------------
+' fwlib32.vb
+'
+' CNC/PMC Data Window Library for FOCAS1/Ethernet
+'
+' Copyright (C) 2003 by FANUC LTD. All rights reserved.
+'
+'-------------------------------------------------------
+Imports System
+Imports System.Runtime.InteropServices
+
+
+Public Class Focas1
+ ' Axis define
+#If FS30D Then
+ Public Const MAX_AXIS = 32
+#Else
+ #If M_AXIS2 Then
+ Public Const MAX_AXIS = 24
+ #Else
+ #If FS15D Then
+ Public Const MAX_AXIS = 10
+ #Else
+ Public Const MAX_AXIS = 8
+ #End If
+ #End If
+#End If
+
+ Public Const ALL_AXES = (-1)
+ Public Const ALL_SPINDLES = (-1)
+
+ ' Error Codes
+ Public Const EW_PROTOCOL = (-17) ' protocol error
+ Public Const EW_SOCKET = (-16) ' Windows socket error
+ Public Const EW_NODLL = (-15) ' DLL not exist error
+ Public Const EW_BUS = (-11) ' bus error
+ Public Const EW_SYSTEM2 = (-10) ' system error
+ Public Const EW_HSSB = (-9) ' hssb communication error
+ Public Const EW_HANDLE = (-8) ' Windows library handle error
+ Public Const EW_VERSION = (-7) ' CNC/PMC version missmatch
+ Public Const EW_UNEXP = (-6) ' abnormal error
+ Public Const EW_SYSTEM = (-5) ' system error
+ Public Const EW_PARITY = (-4) ' shared RAM parity error
+ Public Const EW_MMCSYS = (-3) ' emm386 or mmcsys install error
+ Public Const EW_RESET = (-2) ' reset or stop occured error
+ Public Const EW_BUSY = (-1) ' busy error
+ Public Const EW_OK = 0 ' no problem
+ Public Const EW_FUNC = 1 ' command prepare error
+ Public Const EW_NOPMC = 1 ' pmc not exist
+ Public Const EW_LENGTH = 2 ' data block length error
+ Public Const EW_NUMBER = 3 ' data number error
+ Public Const EW_RANGE = 3 ' address range error
+ Public Const EW_ATTRIB = 4 ' data attribute error
+ Public Const EW_TYPE = 4 ' data type error
+ Public Const EW_DATA = 5 ' data error
+ Public Const EW_NOOPT = 6 ' no option error
+ Public Const EW_PROT = 7 ' write protect error
+ Public Const EW_OVRFLOW = 8 ' memory overflow error
+ Public Const EW_PARAM = 9 ' cnc parameter not correct error
+ Public Const EW_BUFFER = 10 ' buffer error
+ Public Const EW_PATH = 11 ' path error
+ Public Const EW_MODE = 12 ' cnc mode error
+ Public Const EW_REJECT = 13 ' execution rejected error
+ Public Const EW_DTSRVR = 14 ' data server error
+ Public Const EW_ALARM = 15 ' alarm has been occurred
+ Public Const EW_STOP = 16 ' CNC is not running
+ Public Const EW_PASSWD = 17 ' protection data error
+
+ ' Result codes of DNC operation
+
+ Public Const DNC_NORMAL = (-1) ' normal completed
+ Public Const DNC_CANCEL = (-32768) ' DNC operation was canceled by CNC
+ Public Const DNC_OPENERR = (-514) ' file open error
+ Public Const DNC_NOFILE = (-516) ' file not found
+ Public Const DNC_READERR = (-517) ' read error
+
+ '--------------------
+ '
+ ' Structure Template
+ '
+ '--------------------
+ '-------------------------------------
+ ' CNC: Control axis / spindle related
+ '-------------------------------------
+
+ ' cnc_actf:read actual axis feedrate(F)
+ ' cnc_acts:read actual spindle speed(S)
+
+ Public Structure ODBACT
+
+ Public dummy As Short() ' dummy
+ Public data As Integer ' actual feed / actual spindle
+ End Structure 'ODBACT
+
+ ' cnc_acts2:read actual spindle speed(S)
+ ' (All or specified )
+
+ Public Structure ODBACT2
+ Public datano As Short ' spindle number
+ Public type As Short ' dummy
+
+ Public data As Integer() ' spindle data
+ End Structure 'ODBACT2
+
+ ' cnc_absolute:read absolute axis position
+ ' cnc_machine:read machine axis position
+ ' cnc_relative:read relative axis position
+ ' cnc_distance:read distance to go
+ ' cnc_skip:read skip position
+ ' cnc_srvdelay:read servo delay value
+ ' cnc_accdecdly:read acceleration/deceleration delay value
+ ' cnc_absolute2:read absolute axis position 2
+ ' cnc_relative2:read relative axis position 2
+
+ Public Structure ODBAXIS
+ Public dummy As Short ' dummy
+ Public type As Short ' axis number
+
+ Public data As Integer() ' data value
+ End Structure 'ODBAXIS
+
+ ' cnc_rddynamic:read all dynamic data
+
+ Public Structure FAXIS
+
+ Public absolute As Integer() ' absolute position
+
+ Public machine As Integer() ' machine position
+
+ Public relative As Integer() ' relative position
+
+ Public distance As Integer() ' distance to go
+ End Structure 'FAXIS
+
+ Public Structure OAXIS
+ Public absolute As Integer ' absolute position
+ Public machine As Integer ' machine position
+ Public relative As Integer ' relative position
+ Public distance As Integer ' distance to go
+ End Structure
+#If ONO8D = Nothing Then
+
+ Public Structure ODBDY_1
+ Public dummy As Short
+ Public axis As Short ' axis number
+ Public alarm As Short ' alarm status
+ Public prgnum As Short ' current program number
+ Public prgmnum As Short ' main program number
+ Public seqnum As Integer ' current sequence number
+ Public actf As Integer ' actual feedrate
+ Public acts As Integer ' actual spindle speed
+ Public pos As FAXIS
+ End Structure
+
+
+ Public Structure ODBDY_2
+ Public dummy As Short
+ Public axis As Short ' axis number
+ Public alarm As Short ' alarm status
+ Public prgnum As Short ' current program number
+ Public prgmnum As Short ' main program number
+ Public seqnum As Integer ' current sequence number
+ Public actf As Integer ' actual feedrate
+ Public acts As Integer ' actual spindle speed
+ Public pos As OAXIS
+ End Structure
+#Else
+ _
+ Public Structure ODBDY_1
+ Public dummy As Short
+ Public axis As Short ' axis number
+ Public alarm As Short ' alarm status
+ Public prgnum As Integer ' current program number
+ Public prgmnum As Integer ' main program number
+ Public seqnum As Integer ' current sequence number
+ Public actf As Integer ' actual feedrate
+ Public acts As Integer ' actual spindle speed
+ Public pos As FAXIS
+ End Structure
+ _
+ Public Structure ODBDY_2
+ Public dummy As Short
+ Public axis As Short ' axis number
+ Public alarm As Short ' alarm status
+ Public prgnum As Integer ' current program number
+ Public prgmnum As Integer ' main program number
+ Public seqnum As Integer ' current sequence number
+ Public actf As Integer ' actual feedrate
+ Public acts As Integer ' actual spindle speed
+ Public pos As OAXIS
+ End Structure
+#End If
+
+ ' cnc_rddynamic2:read all dynamic data
+
+ Public Structure ODBDY2_1
+ Public dummy As Short
+ Public axis As Short ' axis number
+ Public alarm As Integer ' alarm status
+ Public prgnum As Integer ' current program number
+ Public prgmnum As Integer ' main program number
+ Public seqnum As Integer ' current sequence number
+ Public actf As Integer ' actual feedrate
+ Public acts As Integer ' actual spindle speed
+ Public pos As FAXIS
+ End Structure
+
+ Public Structure ODBDY2_2
+ Public dummy As Short
+ Public axis As Short ' axis number
+ Public alarm As Integer ' alarm status
+ Public prgnum As Integer ' current program number
+ Public prgmnum As Integer ' main program number
+ Public seqnum As Integer ' current sequence number
+ Public actf As Integer ' actual feedrate
+ Public acts As Integer ' actual spindle speed
+ Public pos As OAXIS ' In case of 1 axis
+ End Structure
+
+ ' cnc_wrrelpos:set origin / preset relative axis position
+
+ Public Structure IDBWRR
+ Public datano As Short ' dummy
+ Public type As Short ' axis number
+
+ Public data As Integer() ' preset data
+ End Structure
+
+ ' cnc_prstwkcd:preset work coordinate
+
+ Public Structure IDBWRA
+ Public datano As Short ' dummy
+ Public type As Short ' axis number
+
+ Public data As Integer() ' preset data
+ End Structure
+
+ ' cnc_rdmovrlap:read manual overlapped motion value
+
+ Public Structure IODBOVL
+ Public datano As Short ' dummy
+ Public type As Short ' axis number
+
+ Public data As Integer() ' data value:[2][MAX_AXIS]
+ End Structure
+
+ ' cnc_rdspload:read load information of serial spindle
+ ' cnc_rdspmaxrpm:read maximum r.p.m. ratio of serial spindle
+ ' cnc_rdspgear:read gear ratio of serial spindle
+
+ Public Structure ODBSPN
+ Public datano As Short ' dummy
+ Public type As Short ' axis number
+
+ Public data As Short() ' preset data
+ End Structure
+
+ ' cnc_rdposition:read tool position
+
+ Public Structure POSELM
+ Public data As Integer ' position data
+ Public dec As Short ' place of decimal point of position data
+ Public unit As Short ' unit of position data
+ Public disp As Short ' status of display
+ Public name As Char ' axis name
+ Public suff As Char ' axis name preffix
+ End Structure
+
+
+ Public Structure POSELMALL
+ Public abs As POSELM
+ Public mach As POSELM
+ Public rel As POSELM
+ Public dist As POSELM
+ End Structure
+#If FS30D Then
+
+ Public Structure ODBPOS
+ Public p1 As POSELMALL
+ Public p2 As POSELMALL
+ Public p3 As POSELMALL
+ Public p4 As POSELMALL
+ Public p5 As POSELMALL
+ Public p6 As POSELMALL
+ Public p7 As POSELMALL
+ Public p8 As POSELMALL
+ Public p9 As POSELMALL
+ Public p10 As POSELMALL
+ Public p11 As POSELMALL
+ Public p12 As POSELMALL
+ Public p13 As POSELMALL
+ Public p14 As POSELMALL
+ Public p15 As POSELMALL
+ Public p16 As POSELMALL
+ Public p17 As POSELMALL
+ Public p18 As POSELMALL
+ Public p19 As POSELMALL
+ Public p20 As POSELMALL
+ Public p21 As POSELMALL
+ Public p22 As POSELMALL
+ Public p23 As POSELMALL
+ Public p24 As POSELMALL
+ Public p25 As POSELMALL
+ Public p26 As POSELMALL
+ Public p27 As POSELMALL
+ Public p28 As POSELMALL
+ Public p29 As POSELMALL
+ Public p30 As POSELMALL
+ Public p31 As POSELMALL
+ Public p32 As POSELMALL
+ ' In case of 32 axes.
+ ' if you need the more information, you must be add the member.
+ End Structure
+#Else
+ #If M_AXIS2 Then
+ _
+ Public Structure ODBPOS
+ Public p1 As POSELMALL
+ Public p2 As POSELMALL
+ Public p3 As POSELMALL
+ Public p4 As POSELMALL
+ Public p5 As POSELMALL
+ Public p6 As POSELMALL
+ Public p7 As POSELMALL
+ Public p8 As POSELMALL
+ Public p9 As POSELMALL
+ Public p10 As POSELMALL
+ Public p11 As POSELMALL
+ Public p12 As POSELMALL
+ Public p13 As POSELMALL
+ Public p14 As POSELMALL
+ Public p15 As POSELMALL
+ Public p16 As POSELMALL
+ Public p17 As POSELMALL
+ Public p18 As POSELMALL
+ Public p19 As POSELMALL
+ Public p20 As POSELMALL
+ Public p21 As POSELMALL
+ Public p22 As POSELMALL
+ Public p23 As POSELMALL
+ Public p24 As POSELMALL
+ ' In case of 24 axes.
+ ' if you need the more information, you must be add the member.
+ End Structure
+ #Else
+ #If FS15D Then
+ _
+ Public Structure ODBPOS
+ Public p1 As POSELMALL
+ Public p2 As POSELMALL
+ Public p3 As POSELMALL
+ Public p4 As POSELMALL
+ Public p5 As POSELMALL
+ Public p6 As POSELMALL
+ Public p7 As POSELMALL
+ Public p8 As POSELMALL
+ Public p9 As POSELMALL
+ Public p10 As POSELMALL
+ ' In case of 10 axes.
+ ' if you need the more information, you must be add the member.
+ End Structure
+ #Else
+ _
+ Public Structure ODBPOS
+ Public p1 As POSELMALL
+ Public p2 As POSELMALL
+ Public p3 As POSELMALL
+ Public p4 As POSELMALL
+ Public p5 As POSELMALL
+ Public p6 As POSELMALL
+ Public p7 As POSELMALL
+ Public p8 As POSELMALL
+ ' In case of 8 axes.
+ ' if you need the more information, you must be add the member.
+ End Structure
+ #End If
+ #End If
+#End If
+
+ ' cnc_rdhndintrpt:read handle interruption
+
+ Public Structure ODBHND_data
+ Public input As POSELM ' input unit
+ Public output As POSELM ' output unit
+ End Structure
+#If FS30D Then
+
+ Public Structure ODBHND
+ Public p1 As ODBHND_data
+ Public p2 As ODBHND_data
+ Public p3 As ODBHND_data
+ Public p4 As ODBHND_data
+ Public p5 As ODBHND_data
+ Public p6 As ODBHND_data
+ Public p7 As ODBHND_data
+ Public p8 As ODBHND_data
+ Public p9 As ODBHND_data
+ Public p10 As ODBHND_data
+ Public p11 As ODBHND_data
+ Public p12 As ODBHND_data
+ Public p13 As ODBHND_data
+ Public p14 As ODBHND_data
+ Public p15 As ODBHND_data
+ Public p16 As ODBHND_data
+ Public p17 As ODBHND_data
+ Public p18 As ODBHND_data
+ Public p19 As ODBHND_data
+ Public p20 As ODBHND_data
+ Public p21 As ODBHND_data
+ Public p22 As ODBHND_data
+ Public p23 As ODBHND_data
+ Public p24 As ODBHND_data
+ Public p25 As ODBHND_data
+ Public p26 As ODBHND_data
+ Public p27 As ODBHND_data
+ Public p28 As ODBHND_data
+ Public p29 As ODBHND_data
+ Public p30 As ODBHND_data
+ Public p31 As ODBHND_data
+ Public p32 As ODBHND_data
+ ' In case of 32 axes.
+ ' if you need the more information, you must be add the member.
+ End Structure
+#Else
+#If M_AXIS2 Then
+ _
+ Public Structure ODBHND
+ Public p1 As ODBHND_data
+ Public p2 As ODBHND_data
+ Public p3 As ODBHND_data
+ Public p4 As ODBHND_data
+ Public p5 As ODBHND_data
+ Public p6 As ODBHND_data
+ Public p7 As ODBHND_data
+ Public p8 As ODBHND_data
+ Public p9 As ODBHND_data
+ Public p10 As ODBHND_data
+ Public p11 As ODBHND_data
+ Public p12 As ODBHND_data
+ Public p13 As ODBHND_data
+ Public p14 As ODBHND_data
+ Public p15 As ODBHND_data
+ Public p16 As ODBHND_data
+ Public p17 As ODBHND_data
+ Public p18 As ODBHND_data
+ Public p19 As ODBHND_data
+ Public p20 As ODBHND_data
+ Public p21 As ODBHND_data
+ Public p22 As ODBHND_data
+ Public p23 As ODBHND_data
+ Public p24 As ODBHND_data
+ ' In case of 24 axes.
+ ' if you need the more information, you must be add the member.
+ End Structure
+#Else
+#If FS15D Then
+ _
+ Public Structure ODBHND
+ Public p1 As ODBHND_data
+ Public p2 As ODBHND_data
+ Public p3 As ODBHND_data
+ Public p4 As ODBHND_data
+ Public p5 As ODBHND_data
+ Public p6 As ODBHND_data
+ Public p7 As ODBHND_data
+ Public p8 As ODBHND_data
+ Public p9 As ODBHND_data
+ Public p10 As ODBHND_data
+ ' In case of 10 axes.
+ ' if you need the more information, you must be add the member.
+ End Structure
+#Else
+ _
+ Public Structure ODBHND
+ Public p1 As ODBHND_data
+ Public p2 As ODBHND_data
+ Public p3 As ODBHND_data
+ Public p4 As ODBHND_data
+ Public p5 As ODBHND_data
+ Public p6 As ODBHND_data
+ Public p7 As ODBHND_data
+ Public p8 As ODBHND_data
+ ' In case of 8 axes.
+ ' if you need the more information, you must be add the member.
+ End Structure
+#End If
+#End If
+#End If
+
+ ' cnc_rdspeed:read current speed
+
+ Public Structure SPEEDELM
+ Public data As Integer ' speed data
+ Public dec As Short ' decimal position
+ Public unit As Short ' data unit
+ Public disp As Short ' display flag
+ Public name As Byte ' name of data
+ Public suff As Byte ' suffix
+ End Structure
+
+
+ Public Structure ODBSPEED
+ Public actf As SPEEDELM ' actual feed rate
+ Public acts As SPEEDELM ' actual spindle speed
+ End Structure
+
+ ' cnc_rdsvmeter:read servo load meter
+ ' cnc_rdspmeter:read spindle load meter
+
+ Public Structure LOADELM
+ Public data As Integer ' load meter
+ Public dec As Short ' decimal position
+ Public unit As Short ' unit
+ Public name As Byte ' name of data
+ Public suff1 As Byte ' suffix
+ Public suff2 As Byte ' suffix
+ Public reserve As Byte ' reserve
+ End Structure
+#If FS30D Then
+
+ Public Structure ODBSVLOAD
+ Public svload1 As LOADELM ' servo load meter
+ Public svload2 As LOADELM ' servo load meter
+ Public svload3 As LOADELM ' servo load meter
+ Public svload4 As LOADELM ' servo load meter
+ Public svload5 As LOADELM ' servo load meter
+ Public svload6 As LOADELM ' servo load meter
+ Public svload7 As LOADELM ' servo load meter
+ Public svload8 As LOADELM ' servo load meter
+ Public svload9 As LOADELM ' servo load meter
+ Public svload10 As LOADELM ' servo load meter
+ Public svload11 As LOADELM ' servo load meter
+ Public svload12 As LOADELM ' servo load meter
+ Public svload13 As LOADELM ' servo load meter
+ Public svload14 As LOADELM ' servo load meter
+ Public svload15 As LOADELM ' servo load meter
+ Public svload16 As LOADELM ' servo load meter
+ Public svload17 As LOADELM ' servo load meter
+ Public svload18 As LOADELM ' servo load meter
+ Public svload19 As LOADELM ' servo load meter
+ Public svload20 As LOADELM ' servo load meter
+ Public svload21 As LOADELM ' servo load meter
+ Public svload22 As LOADELM ' servo load meter
+ Public svload23 As LOADELM ' servo load meter
+ Public svload24 As LOADELM ' servo load meter
+ Public svload25 As LOADELM ' servo load meter
+ Public svload26 As LOADELM ' servo load meter
+ Public svload27 As LOADELM ' servo load meter
+ Public svload28 As LOADELM ' servo load meter
+ Public svload29 As LOADELM ' servo load meter
+ Public svload30 As LOADELM ' servo load meter
+ Public svload31 As LOADELM ' servo load meter
+ Public svload32 As LOADELM ' servo load meter
+ End Structure
+#Else
+#If M_AXIS2 Then
+ _
+ Public Structure ODBSVLOAD
+ Public svload1 As LOADELM ' servo load meter
+ Public svload2 As LOADELM ' servo load meter
+ Public svload3 As LOADELM ' servo load meter
+ Public svload4 As LOADELM ' servo load meter
+ Public svload5 As LOADELM ' servo load meter
+ Public svload6 As LOADELM ' servo load meter
+ Public svload7 As LOADELM ' servo load meter
+ Public svload8 As LOADELM ' servo load meter
+ Public svload9 As LOADELM ' servo load meter
+ Public svload10 As LOADELM ' servo load meter
+ Public svload11 As LOADELM ' servo load meter
+ Public svload12 As LOADELM ' servo load meter
+ Public svload13 As LOADELM ' servo load meter
+ Public svload14 As LOADELM ' servo load meter
+ Public svload15 As LOADELM ' servo load meter
+ Public svload16 As LOADELM ' servo load meter
+ Public svload17 As LOADELM ' servo load meter
+ Public svload18 As LOADELM ' servo load meter
+ Public svload19 As LOADELM ' servo load meter
+ Public svload20 As LOADELM ' servo load meter
+ Public svload21 As LOADELM ' servo load meter
+ Public svload22 As LOADELM ' servo load meter
+ Public svload23 As LOADELM ' servo load meter
+ Public svload24 As LOADELM ' servo load meter
+ End Structure
+#Else
+#If FS15D Then
+ _
+ Public Structure ODBSVLOAD
+ Public svload1 As LOADELM ' servo load meter
+ Public svload2 As LOADELM ' servo load meter
+ Public svload3 As LOADELM ' servo load meter
+ Public svload4 As LOADELM ' servo load meter
+ Public svload5 As LOADELM ' servo load meter
+ Public svload6 As LOADELM ' servo load meter
+ Public svload7 As LOADELM ' servo load meter
+ Public svload8 As LOADELM ' servo load meter
+ Public svload9 As LOADELM ' servo load meter
+ Public svload10 As LOADELM ' servo load meter
+ End Structure
+#Else
+ _
+ Public Structure ODBSVLOAD
+ Public svload1 As LOADELM ' servo load meter
+ Public svload2 As LOADELM ' servo load meter
+ Public svload3 As LOADELM ' servo load meter
+ Public svload4 As LOADELM ' servo load meter
+ Public svload5 As LOADELM ' servo load meter
+ Public svload6 As LOADELM ' servo load meter
+ Public svload7 As LOADELM ' servo load meter
+ Public svload8 As LOADELM ' servo load meter
+ End Structure
+#End If
+#End If
+#End If
+
+
+ Public Structure ODBSPLOAD_data
+ Public spload As LOADELM ' spindle load meter
+ Public spspeed As LOADELM ' spindle speed
+ End Structure
+
+ Public Structure ODBSPLOAD
+ Public spload1 As ODBSPLOAD_data ' spindle load
+ Public spload2 As ODBSPLOAD_data ' spindle load
+ Public spload3 As ODBSPLOAD_data ' spindle load
+ Public spload4 As ODBSPLOAD_data ' spindle load
+ End Structure
+
+ ' cnc_rdexecpt:read execution program pointer
+
+ Public Structure PRGPNT
+ Public prog_no As Integer ' program number
+ Public blk_no As Integer ' block number
+ End Structure
+
+ ' cnc_rd5axmandt:read manual feed for 5-axis machining
+
+ Public Structure ODB5AXMAN
+ Public type1 As Short
+ Public type2 As Short
+ Public type3 As Short
+ Public data1 As Integer
+ Public data2 As Integer
+ Public data3 As Integer
+ Public c1 As Integer
+ Public c2 As Integer
+ Public dummy As Integer
+ Public td As Integer
+ Public r1 As Integer
+ Public r2 As Integer
+ Public vr As Integer
+ Public h1 As Integer
+ Public h2 As Integer
+ End Structure
+
+ '----------------------
+ ' CNC: Program related
+ '----------------------
+
+ ' cnc_rddncdgndt:read the diagnosis data of DNC operation
+
+ Public Structure ODBDNCDGN
+ Public ctrl_word As Short
+ Public can_word As Short
+
+ Public nc_file As Char()
+ Public read_ptr As Short
+ Public write_ptr As Short
+ Public empty_cnt As Short
+ Public total_size As Integer
+ End Structure
+
+ ' cnc_upload:upload NC program
+ ' cnc_cupload:upload NC program(conditional)
+
+ Public Structure ODBUP
+
+ Public dummy As Short() ' dummy
+
+ Public data As String ' data
+ End Structure ' In case that the number of data is 256
+
+ ' cnc_buff:read buffer status for downloading/verification NC program
+
+ Public Structure ODBBUF
+
+ Public dummy As Short() ' dummy
+ Public data As Short ' buffer status
+ End Structure
+
+ ' cnc_rdprogdir:read program directory
+
+ Public Structure PRGDIR
+
+ Public prg_data As Char() ' directory data
+ End Structure ' In case that the number of data is 256
+
+ ' cnc_rdproginfo:read program information
+
+ Public Structure ODBNC_1
+ Public reg_prg As Short ' registered program number
+ Public unreg_prg As Short ' unregistered program number
+ Public used_mem As Integer ' used memory area
+ Public unused_mem As Integer ' unused memory area
+ End Structure
+
+
+ Public Structure ODBNC_2
+
+ Public asc As Char() ' ASCII string type
+ End Structure
+
+ ' cnc_rdprgnum:read program number under execution
+#If ONO8D = Nothing Then
+
+ Public Structure ODBPRO
+
+ Public dummy As Short() ' dummy
+ Public data As Short ' running program number
+ Public mdata As Short ' main program number
+ End Structure
+#Else
+ _
+ Public Structure ODBPRO
+ _
+ Public dummy As Short() ' dummy
+ Public data As Integer ' running program number
+ Public mdata As Integer ' main program number
+ End Structure
+#End If
+
+ ' cnc_exeprgname:read program name under execution
+
+ Public Structure ODBEXEPRG
+
+ Public name As Char() ' running program name
+ Public o_num As Integer ' running program number
+ End Structure
+
+ ' cnc_rdseqnum:read sequence number under execution
+
+ Public Structure ODBSEQ
+
+ Public dummy As Short() ' dummy
+ Public data As Integer ' sequence number
+ End Structure
+
+ ' cnc_rdmdipntr:read execution pointer for MDI operation
+#If ONO8D = Nothing Then
+
+ Public Structure ODBMDIP
+ Public mdiprog As Short ' exec. program number
+ Public mdipntr As Integer ' exec. pointer
+ Public crntprog As Short ' prepare program number
+ Public crntpntr As Integer ' prepare pointer
+ End Structure
+#Else
+ _
+ Public Structure ODBMDIP
+ Public mdiprog As Integer ' exec. program number
+ Public mdipntr As Integer ' exec. pointer
+ Public crntprog As Integer ' prepare program number
+ Public crntpntr As Integer ' prepare pointer
+ End Structure
+#End If
+
+ ' cnc_rdaxisdata:read various axis data
+
+ Public Structure ODBAXDT_data
+
+ Public name As String ' data
+ Public data As Integer ' position data
+ Public dec As Short ' decimal position
+ Public unit As Short ' data unit
+ Public flag As Short ' flags
+ Public reserve As Short ' reserve
+ End Structure
+
+
+ Public Structure ODBAXDT
+ Public data1 As ODBAXDT_data
+ Public data2 As ODBAXDT_data
+ Public data3 As ODBAXDT_data
+ Public data4 As ODBAXDT_data
+ Public data5 As ODBAXDT_data
+ Public data6 As ODBAXDT_data
+ Public data7 As ODBAXDT_data
+ Public data8 As ODBAXDT_data
+ Public data9 As ODBAXDT_data
+ Public data10 As ODBAXDT_data
+ Public data11 As ODBAXDT_data
+ Public data12 As ODBAXDT_data
+ Public data13 As ODBAXDT_data
+ Public data14 As ODBAXDT_data
+ Public data15 As ODBAXDT_data
+ Public data16 As ODBAXDT_data
+ Public data17 As ODBAXDT_data
+ Public data18 As ODBAXDT_data
+ Public data19 As ODBAXDT_data
+ Public data20 As ODBAXDT_data
+ Public data21 As ODBAXDT_data
+ Public data22 As ODBAXDT_data
+ Public data23 As ODBAXDT_data
+ Public data24 As ODBAXDT_data
+ Public data25 As ODBAXDT_data
+ Public data26 As ODBAXDT_data
+ Public data27 As ODBAXDT_data
+ Public data28 As ODBAXDT_data
+ Public data29 As ODBAXDT_data
+ Public data30 As ODBAXDT_data
+ Public data31 As ODBAXDT_data
+ Public data32 As ODBAXDT_data
+ Public data33 As ODBAXDT_data
+ Public data34 As ODBAXDT_data
+ Public data35 As ODBAXDT_data
+ Public data36 As ODBAXDT_data
+ Public data37 As ODBAXDT_data
+ Public data38 As ODBAXDT_data
+ Public data39 As ODBAXDT_data
+ Public data40 As ODBAXDT_data
+ Public data41 As ODBAXDT_data
+ Public data42 As ODBAXDT_data
+ Public data43 As ODBAXDT_data
+ Public data44 As ODBAXDT_data
+ Public data45 As ODBAXDT_data
+ Public data46 As ODBAXDT_data
+ Public data47 As ODBAXDT_data
+ Public data48 As ODBAXDT_data
+ Public data49 As ODBAXDT_data
+ Public data50 As ODBAXDT_data
+ Public data51 As ODBAXDT_data
+ Public data52 As ODBAXDT_data
+ Public data53 As ODBAXDT_data
+ Public data54 As ODBAXDT_data
+ Public data55 As ODBAXDT_data
+ Public data56 As ODBAXDT_data
+ Public data57 As ODBAXDT_data
+ Public data58 As ODBAXDT_data
+ Public data59 As ODBAXDT_data
+ Public data60 As ODBAXDT_data
+ Public data61 As ODBAXDT_data
+ Public data62 As ODBAXDT_data
+ Public data63 As ODBAXDT_data
+ Public data64 As ODBAXDT_data
+ Public data65 As ODBAXDT_data
+ Public data66 As ODBAXDT_data
+ Public data67 As ODBAXDT_data
+ Public data68 As ODBAXDT_data
+ Public data69 As ODBAXDT_data
+ Public data70 As ODBAXDT_data
+ Public data71 As ODBAXDT_data
+ Public data72 As ODBAXDT_data
+ Public data73 As ODBAXDT_data
+ Public data74 As ODBAXDT_data
+ Public data75 As ODBAXDT_data
+ Public data76 As ODBAXDT_data
+ Public data77 As ODBAXDT_data
+ Public data78 As ODBAXDT_data
+ Public data79 As ODBAXDT_data
+ Public data80 As ODBAXDT_data
+ Public data81 As ODBAXDT_data
+ Public data82 As ODBAXDT_data
+ Public data83 As ODBAXDT_data
+ Public data84 As ODBAXDT_data
+ Public data85 As ODBAXDT_data
+ Public data86 As ODBAXDT_data
+ Public data87 As ODBAXDT_data
+ Public data88 As ODBAXDT_data
+ Public data89 As ODBAXDT_data
+ Public data90 As ODBAXDT_data
+ Public data91 As ODBAXDT_data
+ Public data92 As ODBAXDT_data
+ Public data93 As ODBAXDT_data
+ Public data94 As ODBAXDT_data
+ Public data95 As ODBAXDT_data
+ Public data96 As ODBAXDT_data
+ Public data97 As ODBAXDT_data
+ Public data98 As ODBAXDT_data
+ Public data99 As ODBAXDT_data
+ Public data100 As ODBAXDT_data
+ Public data101 As ODBAXDT_data
+ Public data102 As ODBAXDT_data
+ Public data103 As ODBAXDT_data
+ Public data104 As ODBAXDT_data
+ Public data105 As ODBAXDT_data
+ Public data106 As ODBAXDT_data
+ Public data107 As ODBAXDT_data
+ Public data108 As ODBAXDT_data
+ Public data109 As ODBAXDT_data
+ Public data110 As ODBAXDT_data
+ Public data111 As ODBAXDT_data
+ Public data112 As ODBAXDT_data
+ Public data113 As ODBAXDT_data
+ Public data114 As ODBAXDT_data
+ Public data115 As ODBAXDT_data
+ Public data116 As ODBAXDT_data
+ Public data117 As ODBAXDT_data
+ Public data118 As ODBAXDT_data
+ Public data119 As ODBAXDT_data
+ Public data120 As ODBAXDT_data
+ Public data121 As ODBAXDT_data
+ Public data122 As ODBAXDT_data
+ Public data123 As ODBAXDT_data
+ Public data124 As ODBAXDT_data
+ Public data125 As ODBAXDT_data
+ Public data126 As ODBAXDT_data
+ Public data127 As ODBAXDT_data
+ Public data128 As ODBAXDT_data
+ End Structure
+
+ ' cnc_rdspcss:read constant surface speed data
+
+ Public Structure ODBCSS
+ Public srpm As Integer ' order spindle speed
+ Public sspm As Integer ' order constant spindle speed
+ Public smax As Integer ' order maximum spindle speed
+ End Structure
+
+ ' cnc_rdpdf_drive:read program drive directory
+
+ Public Structure ODBPDFDRV
+ Public max_num As Short ' maximum drive number
+ Public dummy As Short
+
+ Public drive1 As String
+
+ Public drive2 As String
+
+ Public drive3 As String
+
+ Public drive4 As String
+
+ Public drive5 As String
+
+ Public drive6 As String
+
+ Public drive7 As String
+
+ Public drive8 As String
+
+ Public drive9 As String
+
+ Public drive10 As String
+
+ Public drive11 As String
+
+ Public drive12 As String
+
+ Public drive13 As String
+
+ Public drive14 As String
+
+ Public drive15 As String
+
+ Public drive16 As String
+ End Structure
+
+ ' cnc_rdpdf_inf:read program drive information
+
+ Public Structure ODBPDFINF
+ Public used_page As Integer ' used capacity
+ Public all_page As Integer ' all capacity
+ Public used_dir As Integer ' used directory number
+ Public all_dir As Integer ' all directory number
+ End Structure
+
+ ' cnc_rdpdf_subdir:read directory (sub directories)
+
+ Public Structure IDBPDFSDIR
+
+ Public path As String ' path name
+ Public req_num As Short ' entry number
+ Public dummy As Short
+ End Structure
+
+ ' cnc_rdpdf_subdir:read directory (sub directories)
+
+ Public Structure ODBPDFSDIR
+ Public sub_exist As Short ' existence of sub directory
+ Public dummy As Short
+
+ Public d_f As String ' directory name
+ End Structure
+
+ ' cnc_rdpdf_alldir:read directory (all files)
+
+ Public Structure IDBPDFADIR
+
+ Public path As String ' path name
+ Public req_num As Short ' entry number
+ Public size_kind As Short ' kind of size
+ Public type As Short ' kind of format
+ Public dummy As Short
+ End Structure
+
+ ' cnc_rdpdf_alldir:read directory (all files)
+
+ Public Structure ODBPDFADIR
+ Public data_kind As Short ' kinf of data
+ Public year As Short ' last date and time
+ Public mon As Short ' last date and time
+ Public day As Short ' last date and time
+ Public hour As Short ' last date and time
+ Public min As Short ' last date and time
+ Public sec As Short ' last date and time
+ Public dummy As Short
+ Public dummy2 As Integer
+ Public size As Integer ' size
+ Public attr As Integer ' attribute
+
+ Public d_f As String ' path name
+
+ Public comment As String ' comment
+
+ Public o_time As String ' comment
+ End Structure
+
+ ' cnc_rdpdf_subdirn:read file count the directory has
+
+ Public Structure ODBPDFNFIL
+ Public dir_num As Short ' directory
+ Public file_num As Short ' file
+ End Structure
+
+ ' cnc_wrpdf_attr:change attribute of program file and directory
+
+ Public Structure IDBPDFTDIR
+ Public slct As Integer ' selection
+ Public attr As Integer ' data
+ End Structure
+
+ '---------------------------
+ ' CNC: NC file data related
+ '---------------------------
+
+ ' cnc_rdtofs:read tool offset value
+
+ Public Structure ODBTOFS
+ Public datano As Short ' data number
+ Public type As Short ' data type
+ Public data As Integer ' data
+ End Structure
+
+ ' cnc_rdtofsr:read tool offset value(area specified)
+ ' cnc_wrtofsr:write tool offset value(area specified)
+
+ Public Structure OFS_1
+
+ Public m_ofs As Integer() ' M Each
+
+ Public m_ofs_a As Integer() ' M-A All
+
+ Public t_tip As Short() ' T Each, 2-byte
+
+ Public t_ofs As Integer() ' T Each, 4-byte
+ End Structure ' In case that the number of data is 5
+
+ Public Structure OFS_2
+
+ Public m_ofs_b As Integer() ' M-B All
+ End Structure ' In case that the number of data is 5
+
+ Public Structure OFS_3
+ ' _
+
+ Public m_ofs_c As Integer() ' M-C All
+ End Structure ' In case that the number of data is 5
+
+ Public Structure T_OFS_A
+ Public tip As Short
+
+ Public data As Integer()
+ End Structure ' T-A All
+
+ Public Structure T_OFS_A_data
+ Public data1 As T_OFS_A
+ Public data2 As T_OFS_A
+ Public data3 As T_OFS_A
+ Public data4 As T_OFS_A
+ Public data5 As T_OFS_A
+ End Structure ' In case that the number of data is 5
+
+ Public Structure T_OFS_B
+ Public tip As Short
+
+ Public data As Integer()
+ End Structure ' T-B All
+
+ Public Structure T_OFS_B_data
+ Public data1 As T_OFS_B
+ Public data2 As T_OFS_B
+ Public data3 As T_OFS_B
+ Public data4 As T_OFS_B
+ Public data5 As T_OFS_B
+ End Structure ' In case that the number of data is 5
+
+ Public Structure IODBTO_1_1
+ Public datano_s As Short ' start offset number
+ Public type As Short ' offset type
+ Public datano_e As Short ' end offset number
+ Public ofs As OFS_1
+ End Structure
+
+ Public Structure IODBTO_1_2
+ Public datano_s As Short ' start offset number
+ Public type As Short ' offset type
+ Public datano_e As Short ' end offset number
+ Public ofs As OFS_2
+ End Structure
+
+ Public Structure IODBTO_1_3
+ Public datano_s As Short ' start offset number
+ Public type As Short ' offset type
+ Public datano_e As Short ' end offset number
+ Public ofs As OFS_3
+ End Structure
+
+ Public Structure IODBTO_2
+ Public datano_s As Short ' start offset number
+ Public type As Short ' offset type
+ Public datano_e As Short ' end offset number
+ Public tofsa As T_OFS_A_data
+ End Structure
+
+ Public Structure IODBTO_3
+ Public datano_s As Short ' start offset number
+ Public type As Short ' offset type
+ Public datano_e As Short ' end offset number
+ Public tofsb As T_OFS_B_data
+ End Structure
+
+ ' cnc_rdzofs:read work zero offset value
+ ' cnc_wrzofs:write work zero offset value
+
+ Public Structure IODBZOFS
+ Public datano As Short ' offset NO.
+ Public type As Short ' axis number
+
+ Public data As Integer() ' data value
+ End Structure
+
+ ' cnc_rdzofsr:read work zero offset value(area specified)
+ ' cnc_wrzofsr:write work zero offset value(area specified)
+
+ Public Structure IODBZOR
+ Public datano_s As Short ' start offset number
+ Public type As Short ' axis number
+ Public datano_e As Short ' end offset number
+
+ Public data As Integer() ' offset value
+ End Structure ' In case that the number of axes is MAX_AXIS, the number of data is 7
+
+ ' cnc_rdmsptype:read mesured point value
+ ' cnc_wrmsptype:write mesured point value
+
+ Public Structure IODBMSTP
+ Public datano_s As Short ' start offset number
+ Public dummy As Short ' dummy
+ Public datano_e As Short ' end offset number
+
+ Public data As SByte() ' mesured point value
+ End Structure
+
+ ' cnc_rdparam:read parameter
+ ' cnc_wrparam:write parameter
+ ' cnc_rdset:read setting data
+ ' cnc_wrset:write setting data
+ ' cnc_rdparar:read parameter(area specified)
+ ' cnc_wrparas:write parameter(plural specified)
+ ' cnc_rdsetr:read setting data(area specified)
+ ' cnc_wrsets:write setting data(plural specified)
+
+ Public Structure REALPRM
+ Public prm_val As Integer ' data of real parameter
+ Public dec_val As Integer ' decimal point of real parameter
+ End Structure
+#If FS30D Then
+
+ Public Structure REALPRMS
+ Public rdata1 As REALPRM
+ Public rdata2 As REALPRM
+ Public rdata3 As REALPRM
+ Public rdata4 As REALPRM
+ Public rdata5 As REALPRM
+ Public rdata6 As REALPRM
+ Public rdata7 As REALPRM
+ Public rdata8 As REALPRM
+ Public rdata9 As REALPRM
+ Public rdata10 As REALPRM
+ Public rdata11 As REALPRM
+ Public rdata12 As REALPRM
+ Public rdata13 As REALPRM
+ Public rdata14 As REALPRM
+ Public rdata15 As REALPRM
+ Public rdata16 As REALPRM
+ Public rdata17 As REALPRM
+ Public rdata18 As REALPRM
+ Public rdata19 As REALPRM
+ Public rdata20 As REALPRM
+ Public rdata21 As REALPRM
+ Public rdata22 As REALPRM
+ Public rdata23 As REALPRM
+ Public rdata24 As REALPRM
+ Public rdata25 As REALPRM
+ Public rdata26 As REALPRM
+ Public rdata27 As REALPRM
+ Public rdata28 As REALPRM
+ Public rdata29 As REALPRM
+ Public rdata30 As REALPRM
+ Public rdata31 As REALPRM
+ Public rdata32 As REALPRM
+ End Structure ' In case that the number of alarm is 32
+#Else
+#If M_AXIS2 Then
+ _
+ Public Structure REALPRMS
+ Public rdata1 As REALPRM
+ Public rdata2 As REALPRM
+ Public rdata3 As REALPRM
+ Public rdata4 As REALPRM
+ Public rdata5 As REALPRM
+ Public rdata6 As REALPRM
+ Public rdata7 As REALPRM
+ Public rdata8 As REALPRM
+ Public rdata9 As REALPRM
+ Public rdata10 As REALPRM
+ Public rdata11 As REALPRM
+ Public rdata12 As REALPRM
+ Public rdata13 As REALPRM
+ Public rdata14 As REALPRM
+ Public rdata15 As REALPRM
+ Public rdata16 As REALPRM
+ Public rdata17 As REALPRM
+ Public rdata18 As REALPRM
+ Public rdata19 As REALPRM
+ Public rdata20 As REALPRM
+ Public rdata21 As REALPRM
+ Public rdata22 As REALPRM
+ Public rdata23 As REALPRM
+ Public rdata24 As REALPRM
+ End Structure ' In case that the number of alarm is 24
+#Else
+#If FS15D Then
+ _
+ Public Structure REALPRMS
+ Public rdata1 As REALPRM
+ Public rdata2 As REALPRM
+ Public rdata3 As REALPRM
+ Public rdata4 As REALPRM
+ Public rdata5 As REALPRM
+ Public rdata6 As REALPRM
+ Public rdata7 As REALPRM
+ Public rdata8 As REALPRM
+ Public rdata9 As REALPRM
+ Public rdata10 As REALPRM
+ End Structure ' In case that the number of alarm is 10
+#Else
+ _
+ Public Structure REALPRMS
+ Public rdata1 As REALPRM
+ Public rdata2 As REALPRM
+ Public rdata3 As REALPRM
+ Public rdata4 As REALPRM
+ Public rdata5 As REALPRM
+ Public rdata6 As REALPRM
+ Public rdata7 As REALPRM
+ Public rdata8 As REALPRM
+ End Structure ' In case that the number of alarm is 8
+#End If
+#End If
+#End If
+
+
+ Public Structure IODBPSD_1
+
+ Public datano As Short ' data number
+
+ Public type As Short ' axis number
+
+ Public cdata As Byte ' parameter / setting data
+
+ Public idata As Short
+
+ Public ldata As Integer
+ End Structure
+
+ Public Structure IODBPSD_2
+ Public datano As Short ' data number
+ Public type As Short ' axis number
+ Public rdata As REALPRM
+ End Structure
+
+ Public Structure IODBPSD_3
+
+ Public datano As Short ' data number
+
+ Public type As Short ' axis number
+
+ Public cdatas As Byte()
+
+ Public idatas As Short()
+
+ Public ldatas As Integer()
+ End Structure
+
+ Public Structure IODBPSD_4
+ Public datano As Short ' data number
+ Public type As Short ' axis number
+ Public rdatas As REALPRMS
+ End Structure
+
+ Public Structure IODBPSD_A
+ Public data1 As IODBPSD_1
+ Public data2 As IODBPSD_1
+ Public data3 As IODBPSD_1
+ Public data4 As IODBPSD_1
+ Public data5 As IODBPSD_1
+ Public data6 As IODBPSD_1
+ Public data7 As IODBPSD_1
+ End Structure ' (sample) must be modified
+
+ Public Structure IODBPSD_B
+ Public data1 As IODBPSD_2
+ Public data2 As IODBPSD_2
+ Public data3 As IODBPSD_2
+ Public data4 As IODBPSD_2
+ Public data5 As IODBPSD_2
+ Public data6 As IODBPSD_2
+ Public data7 As IODBPSD_2
+ End Structure ' (sample) must be modified
+
+ Public Structure IODBPSD_C
+ Public data1 As IODBPSD_3
+ Public data2 As IODBPSD_3
+ Public data3 As IODBPSD_3
+ Public data4 As IODBPSD_3
+ Public data5 As IODBPSD_3
+ Public data6 As IODBPSD_3
+ Public data7 As IODBPSD_3
+ End Structure ' (sample) must be modified
+
+ Public Structure IODBPSD_D
+ Public data1 As IODBPSD_4
+ Public data2 As IODBPSD_4
+ Public data3 As IODBPSD_4
+ Public data4 As IODBPSD_4
+ Public data5 As IODBPSD_4
+ Public data6 As IODBPSD_4
+ Public data7 As IODBPSD_4
+ End Structure ' (sample) must be modified
+
+ ' cnc_rdparam_ext:read parameAers
+ ' cnc_rddiag_ext:read diagnosis data
+ ' cnc_start_async_wrparam:async parameter write start
+
+ Public Structure IODBPRMNO
+
+ Public prm As Integer()
+ End Structure
+
+ Public Structure IODBPRM_data
+ Public prm_val As Integer ' parameter / setting data
+ Public dec_val As Integer
+ End Structure
+
+ Public Structure IODBPRM1
+ Public data1 As IODBPRM_data
+ Public data2 As IODBPRM_data
+ Public data3 As IODBPRM_data
+ Public data4 As IODBPRM_data
+ Public data5 As IODBPRM_data
+ Public data6 As IODBPRM_data
+ Public data7 As IODBPRM_data
+ Public data8 As IODBPRM_data
+ Public data9 As IODBPRM_data
+ Public data10 As IODBPRM_data
+ Public data11 As IODBPRM_data
+ Public data12 As IODBPRM_data
+ Public data13 As IODBPRM_data
+ Public data14 As IODBPRM_data
+ Public data15 As IODBPRM_data
+ Public data16 As IODBPRM_data
+ Public data17 As IODBPRM_data
+ Public data18 As IODBPRM_data
+ Public data19 As IODBPRM_data
+ Public data20 As IODBPRM_data
+ Public data21 As IODBPRM_data
+ Public data22 As IODBPRM_data
+ Public data23 As IODBPRM_data
+ Public data24 As IODBPRM_data
+ Public data25 As IODBPRM_data
+ Public data26 As IODBPRM_data
+ Public data27 As IODBPRM_data
+ Public data28 As IODBPRM_data
+ Public data29 As IODBPRM_data
+ Public data30 As IODBPRM_data
+ Public data31 As IODBPRM_data
+ Public data32 As IODBPRM_data
+ End Structure
+
+ Public Structure IODBPRM2
+ Public datano As Integer ' data number
+ Public type As Short ' data type
+ Public axis As Short ' axis information
+ Public info As Short ' misc information
+ Public unit As Short ' unit information
+ Public data As IODBPRM1
+ End Structure
+
+ Public Structure IODBPRM
+ Public prm1 As IODBPRM2
+ Public prm2 As IODBPRM2
+ Public prm3 As IODBPRM2
+ Public prm4 As IODBPRM2
+ Public prm5 As IODBPRM2
+ Public prm6 As IODBPRM2
+ Public prm7 As IODBPRM2
+ Public prm8 As IODBPRM2
+ Public prm9 As IODBPRM2
+ Public prm10 As IODBPRM2
+ End Structure ' In case that the number of alarm is 10
+
+ ' cnc_rdpitchr:read pitch error compensation data(area specified)
+ ' cnc_wrpitchr:write pitch error compensation data(area specified)
+
+ Public Structure IODBPI
+ Public datano_s As Short ' start pitch number
+ Public dummy As Short ' dummy
+ Public datano_e As Short ' end pitch number
+
+ Public data As SByte() ' offset value
+ End Structure ' In case that the number of data is 5
+
+ ' cnc_rdmacro:read custom macro variable
+
+ Public Structure ODBM
+ Public datano As Short ' variable number
+ Public dummy As Short ' dummy
+ Public mcr_val As Integer ' macro variable
+ Public dec_val As Short ' decimal point
+ End Structure
+
+ ' cnc_rdmacror:read custom macro variables(area specified)
+ ' cnc_wrmacror:write custom macro variables(area specified)
+
+ Public Structure IODBMR_data
+ Public mcr_val As Integer ' macro variable
+ Public dec_val As Short ' decimal point
+ End Structure
+
+ Public Structure IODBMR1
+ Public data1 As IODBMR_data
+ Public data2 As IODBMR_data
+ Public data3 As IODBMR_data
+ Public data4 As IODBMR_data
+ Public data5 As IODBMR_data
+ End Structure ' In case that the number of data is 5
+
+ Public Structure IODBMR
+ Public datano_s As Short ' start macro number
+ Public dummy As Short ' dummy
+ Public datano_e As Short ' end macro number
+ Public data As IODBMR1
+ End Structure
+
+ ' cnc_rdpmacro:read P code macro variable
+
+ Public Structure ODBPM
+ Public datano As Integer ' variable number
+ Public dummy As Short ' dummy
+ Public mcr_val As Integer ' macro variable
+ Public dec_val As Short ' decimal point
+ End Structure
+
+ ' cnc_rdpmacror:read P code macro variables(area specified)
+ ' cnc_wrpmacror:write P code macro variables(area specified)
+ Public Structure IODBPR_data
+ Public mcr_val As Integer ' macro variable
+ Public dec_val As Short ' decimal point
+ End Structure
+
+ Public Structure IODBPR1
+ Public data1 As IODBPR_data
+ Public data2 As IODBPR_data
+ Public data3 As IODBPR_data
+ Public data4 As IODBPR_data
+ Public data5 As IODBPR_data
+ End Structure ' In case that the number of data is 5
+
+ Public Structure IODBPR
+ Public datano_s As Integer ' start macro number
+ Public dummy As Short ' dummy
+ Public datano_e As Integer ' end macro number
+ Public data As IODBPR1
+ End Structure
+
+ ' cnc_rdtofsinfo:read tool offset information
+
+ Public Structure ODBTLINF
+ Public ofs_type As Short
+ Public use_no As Short
+ End Structure
+
+ ' cnc_rdtofsinfo2:read tool offset information(2)
+
+ Public Structure ODBTLINF2
+ Public ofs_type As Short
+ Public use_no As Short
+ Public ofs_enable As Short
+ End Structure
+
+ ' cnc_rdmacroinfo:read custom macro variable information
+
+ Public Structure ODBMVINF
+ Public use_no1 As Short
+ Public use_no2 As Short
+ End Structure
+
+ ' cnc_rdpmacroinfo:read P code macro variable information
+
+ Public Structure ODBPMINF
+ Public use_no1 As Short
+#If PCD_UWORD Then
+ Public use_no2 As Short ' C# ushort
+#Else
+ Public use_no2 As Short
+#End If
+ Public v2_type As Short
+ End Structure
+
+ ' cnc_tofs_rnge:read validity of tool offset
+
+ Public Structure ODBDATRNG
+ Public data_min As Integer ' lower limit
+ Public data_max As Integer ' upper limit
+ Public status As Integer ' status of setting
+ End Structure
+
+ ' cnc_rdhsprminfo:read the information for function cnc_rdhsparam()
+
+ Public Structure HSPINFO_data
+
+ Public data1 As Byte()
+
+ Public data2 As Byte()
+
+ Public data3 As Byte()
+
+ Public data4 As Byte()
+
+ Public data5 As Byte()
+
+ Public data6 As Byte()
+
+ Public data7 As Byte()
+
+ Public data8 As Byte()
+ End Structure
+
+
+ Public Structure HSPINFO
+ Public prminfo1 As HSPINFO_data
+ Public prminfo2 As HSPINFO_data
+ Public prminfo3 As HSPINFO_data
+ Public prminfo4 As HSPINFO_data
+ Public prminfo5 As HSPINFO_data
+ Public prminfo6 As HSPINFO_data
+ Public prminfo7 As HSPINFO_data
+ Public prminfo8 As HSPINFO_data
+ Public prminfo9 As HSPINFO_data
+ Public prminfo10 As HSPINFO_data
+ End Structure ' In case that the number of data is 10
+
+ ' cnc_rdhsparam:read parameters at the high speed
+
+ Public Structure HSPDATA_1
+
+ Public cdatas1 As Byte()
+
+ Public cdatas2 As Byte()
+
+ Public cdatas3 As Byte()
+
+ Public cdatas4 As Byte()
+
+ Public cdatas5 As Byte()
+
+ Public cdatas6 As Byte()
+
+ Public cdatas7 As Byte()
+
+ Public cdatas8 As Byte()
+
+ Public cdatas9 As Byte()
+
+ Public cdatas10 As Byte()
+ End Structure ' In case that the number of data is 10
+
+
+ Public Structure HSPDATA_2
+
+ Public idatas1 As Short()
+
+ Public idatas2 As Short()
+
+ Public idatas3 As Short()
+
+ Public idatas4 As Short()
+
+ Public idatas5 As Short()
+
+ Public idatas6 As Short()
+
+ Public idatas7 As Short()
+
+ Public idatas8 As Short()
+
+ Public idatas9 As Short()
+
+ Public idatas10 As Short()
+ End Structure ' In case that the number of data is 10
+
+
+ Public Structure HSPDATA_3
+
+ Public ldatas1 As Integer()
+
+ Public ldatas2 As Integer()
+
+ Public ldatas3 As Integer()
+
+ Public ldatas4 As Integer()
+
+ Public ldatas5 As Integer()
+
+ Public ldatas6 As Integer()
+
+ Public ldatas7 As Integer()
+
+ Public ldatas8 As Integer()
+
+ Public ldatas9 As Integer()
+
+ Public ldatas10 As Integer()
+ End Structure ' In case that the number of data is 10
+
+ '----------------------------------------
+ ' CNC: Tool life management data related
+ '----------------------------------------
+
+ ' cnc_rdgrpid:read tool life management data(tool group number)
+
+ Public Structure ODBTLIFE1
+ Public dummy As Short ' dummy
+ Public type As Short ' data type
+ Public data As Integer ' data
+ End Structure
+
+ ' cnc_rdngrp:read tool life management data(number of tool groups)
+
+ Public Structure ODBTLIFE2
+
+ Public dummy As Short() ' dummy
+ Public data As Integer ' data
+ End Structure
+
+ ' cnc_rdntool:read tool life management data(number of tools)
+ ' cnc_rdlife:read tool life management data(tool life)
+ ' cnc_rdcount:read tool life management data(tool lift counter)
+
+ Public Structure ODBTLIFE3
+ Public datano As Short ' data number
+ Public dummy As Short ' dummy
+ Public data As Integer ' data
+ End Structure
+
+ ' cnc_rd1length:read tool life management data(tool length number-1)
+ ' cnc_rd2length:read tool life management data(tool length number-2)
+ ' cnc_rd1radius:read tool life management data(cutter compensation no.-1)
+ ' cnc_rd2radius:read tool life management data(cutter compensation no.-2)
+ ' cnc_t1info:read tool life management data(tool information-1)
+ ' cnc_t2info:read tool life management data(tool information-2)
+ ' cnc_toolnum:read tool life management data(tool number)
+
+ Public Structure ODBTLIFE4
+ Public datano As Short ' data number
+ Public type As Short ' data type
+ Public data As Integer ' data
+ End Structure
+
+ ' cnc_rdgrpid2:read tool life management data(tool group number) 2
+
+ Public Structure ODBTLIFE5
+ Public dummy As Integer ' dummy
+ Public type As Integer ' data type
+ Public data As Integer ' data
+ End Structure
+
+ ' cnc_rdtoolrng:read tool life management data(tool number, tool life, tool life counter)(area specified)
+
+ Public Structure IODBTR_data
+ Public ntool As Integer ' tool number
+ Public life As Integer ' tool life
+ Public count As Integer ' tool life counter
+ End Structure
+
+ Public Structure IODBTR1
+ Public data1 As IODBTR_data
+ Public data2 As IODBTR_data
+ Public data3 As IODBTR_data
+ Public data4 As IODBTR_data
+ Public data5 As IODBTR_data
+ End Structure ' In case that the number of data is 5
+
+ Public Structure IODBTR
+ Public datano_s As Short ' start group number
+ Public dummy As Short ' dummy
+ Public datano_e As Short ' end group number
+ Public data As IODBTR1
+ End Structure
+
+ ' cnc_rdtoolgrp:read tool life management data(all data within group)
+
+ Public Structure ODBTG_data
+ Public tuse_num As Integer ' tool number
+ Public tool_num As Integer ' tool life
+ Public length_num As Integer ' tool life counter
+ Public radius_num As Integer ' tool life counter
+ Public tinfo As Integer ' tool life counter
+ End Structure
+
+ Public Structure ODBTG1
+ Public data1 As ODBTG_data
+ Public data2 As ODBTG_data
+ Public data3 As ODBTG_data
+ Public data4 As ODBTG_data
+ Public data5 As ODBTG_data
+ End Structure ' In case that the number of data is 5
+
+ Public Structure ODBTG
+ Public grp_num As Short ' start group number
+
+ Public dummy As Short() ' dummy
+ Public ntool As Integer ' tool number
+ Public life As Integer ' tool life
+ Public count As Integer ' tool life counter
+ Public data As ODBTG1
+ End Structure
+
+ ' cnc_wrcountr:write tool life management data(tool life counter) (area specified)
+
+ Public Structure IDBWRC_data
+
+ Public dummy As Integer() ' dummy
+ Public count As Integer ' tool life counter
+ End Structure
+
+ Public Structure IDBWRC1
+ Public data1 As IDBWRC_data
+ Public data2 As IDBWRC_data
+ Public data3 As IDBWRC_data
+ Public data4 As IDBWRC_data
+ Public data5 As IDBWRC_data
+ End Structure ' In case that the number of data is 5
+
+ Public Structure IDBWRC
+ Public datano_s As Short ' start group number
+ Public dummy As Short ' dummy
+ Public datano_e As Short ' end group number
+ Public data As IDBWRC1
+ End Structure
+
+ ' cnc_rdusegrpid:read tool life management data(used tool group number)
+
+ Public Structure ODBUSEGR
+ Public datano As Short ' dummy
+ Public type As Short ' dummy
+ Public iNext As Integer ' next use group number
+ Public use As Integer ' using group number
+ Public slct As Integer ' selecting group number
+ End Structure
+
+ ' cnc_rdmaxgrp:read tool life management data(max. number of tool groups)
+ ' cnc_rdmaxtool:read tool life management data(maximum number of tool within group)
+
+ Public Structure ODBLFNO
+ Public datano As Short ' dummy
+ Public type As Short ' dummy
+ Public data As Short ' number of data
+ End Structure
+
+ ' cnc_rdusetlno:read tool life management data(used tool no within group)
+
+ Public Structure ODBTLUSE
+ Public s_grp As Short ' start group number
+ Public dummy As Short ' dummy
+ Public e_grp As Short ' end group number
+
+ Public data As Integer() ' tool using number
+ End Structure ' In case that the number of group is 5
+
+ ' cnc_rd1tlifedata:read tool life management data(tool data1)
+ ' cnc_rd2tlifedata:read tool life management data(tool data2)
+ ' cnc_wr1tlifedata:write tool life management data(tool data1)
+ ' cnc_wr2tlifedata:write tool life management data(tool data2)
+
+ Public Structure IODBTD
+ Public datano As Short ' tool group number
+ Public type As Short ' tool using number
+ Public tool_num As Integer ' tool number
+ Public h_code As Integer ' H code
+ Public d_code As Integer ' D code
+ Public tool_inf As Integer ' tool information
+ End Structure
+
+ ' cnc_rd1tlifedat2:read tool life management data(tool data1) 2
+ ' cnc_wr1tlifedat2:write tool life management data(tool data1) 2
+
+ Public Structure IODBTD2
+ Public datano As Short ' tool group number
+ Public dummy As Short ' dummy
+ Public type As Integer ' tool using number
+ Public tool_num As Integer ' tool number
+ Public h_code As Integer ' H code
+ Public d_code As Integer ' D code
+ Public tool_inf As Integer ' tool information
+ End Structure
+
+ ' cnc_rdgrpinfo:read tool life management data(tool group information)
+ ' cnc_wrgrpinfo:write tool life management data(tool group information)
+
+ Public Structure IODBTGI_data
+ Public n_tool As Integer ' number of tool
+ Public count_value As Integer ' tool life
+ Public counter As Integer ' tool life counter
+ Public count_type As Integer ' tool life counter type
+ End Structure
+
+ Public Structure IODBTGI1
+ Public data1 As IODBTGI_data
+ Public data2 As IODBTGI_data
+ Public data3 As IODBTGI_data
+ Public data4 As IODBTGI_data
+ Public data5 As IODBTGI_data
+ End Structure ' In case that the number of data is 5
+
+ Public Structure IODBTGI
+ Public s_grp As Short ' start group number
+ Public dummy As Short ' dummy
+ Public e_grp As Short ' end group number
+ Public data As IODBTGI1
+ End Structure
+
+ ' cnc_rdgrpinfo2:read tool life management data(tool group information 2)
+ ' cnc_wrgrpinfo2:write tool life management data(tool group information 2)
+
+ Public Structure IODBTGI2
+ Public s_grp As Short ' start group number
+ Public dummy As Short ' dummy
+ Public e_grp As Short ' end group number
+
+ Public opt_grpno As Integer() ' optional group number of tool
+ End Structure ' In case that the number of group is 5
+
+ ' cnc_rdgrpinfo3:read tool life management data(tool group information 3)
+ ' cnc_wrgrpinfo3:write tool life management data(tool group information 3)
+
+ Public Structure IODBTGI3
+ Public s_grp As Short ' start group number
+ Public dummy As Short ' dummy
+ Public e_grp As Short ' end group number
+
+ Public life_rest As Integer() ' tool life rest count
+ End Structure ' In case that the number of group is 5
+
+ ' cnc_rdgrpinfo4:read tool life management data(tool group information 4)
+
+ Public Structure IODBTGI4
+ Public grp_no As Short
+ Public n_tool As Integer
+ Public count_value As Integer
+ Public counter As Integer
+ Public count_type As Integer
+ Public opt_grpno As Integer
+ Public life_rest As Integer
+ End Structure
+
+ ' cnc_instlifedt:insert tool life management data(tool data)
+
+ Public Structure IDBITD
+ Public datano As Short ' tool group number
+ Public type As Short ' tool using number
+ Public data As Integer ' tool number
+ End Structure
+
+ ' cnc_rdtlinfo:read tool life management data
+
+ Public Structure ODBTLINFO
+ Public max_group As Integer ' maximum number of tool groups
+ Public max_tool As Integer ' maximum number of tool within group
+ Public max_minute As Integer ' maximum number of life count (minutes)
+ Public max_cycle As Integer ' maximum number of life count (cycles)
+ End Structure
+
+ ' cnc_rdtlusegrp:read tool life management data(used tool group number)
+
+ Public Structure ODBUSEGRP
+ Public iNext As Integer ' next use group number
+ Public use As Integer ' using group number
+ Public slct As Integer ' selecting group number
+ Public opt_next As Integer ' next use optional group number
+ Public opt_use As Integer ' using optional group number
+ Public opt_slct As Integer ' selecting optional group number
+ End Structure
+
+ ' cnc_rdtlgrp:read tool life management data(tool group information 2)
+
+ Public Structure IODBTLGRP_data
+ Public ntool As Integer ' number of all tool
+ Public nfree As Integer ' number of free tool
+ Public life As Integer ' tool life
+ Public count As Integer ' tool life counter
+ Public use_tool As Integer ' using tool number
+ Public opt_grpno As Integer ' optional group number
+ Public life_rest As Integer ' tool life rest count
+ Public rest_sig As Short ' tool life rest signal
+ Public count_type As Short ' tool life counter type
+ End Structure
+
+ Public Structure IODBTLGRP
+ Public data1 As IODBTLGRP_data
+ Public data2 As IODBTLGRP_data
+ Public data3 As IODBTLGRP_data
+ Public data4 As IODBTLGRP_data
+ Public data5 As IODBTLGRP_data
+ End Structure ' In case that the number of group is 5
+
+ ' cnc_rdtltool:read tool life management data (tool data1)
+