From f7cafdda8eb7921f4a8c813cd975238d8b35f8e0 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 19 Apr 2017 16:38:14 +0200 Subject: [PATCH] spostato in coda tutti i metodi IOT x FANUC... --- .../CMSCncLib/CNC/CNC.FANUC/CNC.FANUC.vb | 730 ++++++------------ 1 file changed, 244 insertions(+), 486 deletions(-) diff --git a/MTC_Adapter/CMSCncLib/CNC/CNC.FANUC/CNC.FANUC.vb b/MTC_Adapter/CMSCncLib/CNC/CNC.FANUC/CNC.FANUC.vb index 448939b..d619b8c 100644 --- a/MTC_Adapter/CMSCncLib/CNC/CNC.FANUC/CNC.FANUC.vb +++ b/MTC_Adapter/CMSCncLib/CNC/CNC.FANUC/CNC.FANUC.vb @@ -520,322 +520,6 @@ Namespace CNC Return True 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.CMS_CncLib") Then - Throw New CmsNcException("ERR cnc_rdposition RefreshAxisPosition CNC.FANUC.CMS_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.CMS_CncLib") Then - Throw New CmsNcException("ERR cnc_rdsvmeter RefreshAxisMeter CNC.FANUC.CMS_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.CMS_CncLib") Then - Throw New CmsNcException("ERR cnc_actf RefreshActFeedRate CNC.FANUC.CMS_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.CMS_CncLib") Then - Throw New CmsNcException("ERR cnc_rdspload RefreshAllSpindleLoad CNC.FANUC.CMS_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.CMS_CncLib") Then - Throw New CmsNcException("ERR cnc_rddynamic2 RefreshAllData CNC.FANUC.CMS_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 - - ' leggo tutto!!! - nReturn = Focas1.cnc_rdalmmsg2(nLibHandle(nPathIdx), -1, numAllarmi, allData) - - If F_CheckRetError_Cnc(nReturn, "cnc_rdalmmsg2 GetCncAlarm CNC.FANUC.CMS_CncLib") Then - Throw New CmsNcException("ERR cnc_rdalmmsg2 GetCncAlarm CNC.FANUC.CMS_CncLib") - End If - 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.CMS_CncLib") Then - Throw New CmsNcException("ERR cnc_rdgcode RefreshPathGCode CNC.FANUC.CMS_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.CMS_CncLib") Then - Throw New CmsNcException("ERR cnc_rdgcode RefreshPathGCode CNC.FANUC.CMS_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.CMS_CncLib") Then - Throw New CmsNcException("ERR cnc_rd3dtooltip RefreshPathTTCoord CNC.FANUC.CMS_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.CMS_CncLib") Then - Throw New CmsNcException("ERR cnc_rdspeed RefreshAxisSpeed CNC.FANUC.CMS_CncLib") - End If - End If - - Return speedAssi - - End Function - - ''' ''' Legge o scrive Byte da MEMORIE PLC ''' @@ -1825,245 +1509,319 @@ Namespace CNC Return False 'assenza errori End Function +#Region "Funzioni specifiche IOT" -#Region "FunzioniFanuc NOTA: Deprecarle e creare una funzione unica" - 'Public Function F_ReadByteFromR(ByVal nHandle As Integer, ByVal nVar As Integer, ByRef nValue As Byte) As Boolean + Public Function getAllAxisPos() As Focas1.ODBPOS + ' RIFERIMENTO: + ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rdposition.htm - ' Dim iodb As Focas1.IODBPMC0 = New Focas1.IODBPMC0 - ' Dim nlength As Integer, nError As Integer - ' nValue = 0 + Dim nPathIdx As Integer + Dim nNumAxisRead As Integer + Dim nReturn As Integer - ' iodb.type_a = R_PARAM - ' iodb.type_d = N_BYTE_TYPE - ' iodb.datano_s = nVar - ' iodb.datano_e = nVar - ' nlength = 8 + 1 + Dim posizAssi As Focas1.ODBPOS - ' nError = Focas1.pmc_rdpmcrng(nHandle, R_PARAM, N_BYTE_TYPE, nVar, nVar, nlength, iodb) + 'leggo il numero del processo attivo + nPathIdx = GetActivePath() + 'leggo num max assi dal cn + nNumAxisRead = Focas1.MAX_AXIS - ' If (nError <> 0) Then - ' If Config.Settings.Settings.Debug >= 0 Then MessageBox.Show("Errore nella lettura a byte della variabile R" + Str(nVar) + " errore nr." + Str(nError)) - ' Return False - ' Exit Function - ' End If + If Is30Series Then - ' nValue = iodb.cdata(0) + ' leggo tutto!!! + nReturn = Focas1.cnc_rdposition(nLibHandle(nPathIdx), -1, nNumAxisRead, posizAssi) - ' Return True - 'End Function + If F_CheckRetError_Cnc(nReturn, "cnc_rdposition RefreshAxisPosition CNC.FANUC.CMS_CncLib") Then + Throw New CmsNcException("ERR cnc_rdposition RefreshAxisPosition CNC.FANUC.CMS_CncLib") + End If + End If - 'Public Function F_ReadByteFromD(ByVal nHandle As Integer, ByVal nVar As Integer, ByRef nValue As Byte) As Boolean + Return posizAssi - ' Dim iodb As Focas1.IODBPMC0 = New Focas1.IODBPMC0 - ' Dim nlength As Integer, nError As Integer - ' nValue = 0 + End Function - ' iodb.type_a = D_PARAM - ' iodb.type_d = N_BYTE_TYPE - ' iodb.datano_s = nVar - ' iodb.datano_e = nVar - ' nlength = 8 + 1 + Public Function getAllAxisLoad() As Focas1.ODBSVLOAD + ' RIFERIMENTO: + ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rdsvmeter.htm - ' nError = Focas1.pmc_rdpmcrng(nHandle, D_PARAM, N_BYTE_TYPE, nVar, nVar, nlength, iodb) + Dim nPathIdx As Integer + Dim nNumAxisRead As Integer + Dim nReturn As Integer - ' If (nError <> 0) Then - ' If Config.Settings.Settings.Debug >= 0 Then MessageBox.Show("Errore nella lettura a byte della variabile D" + Str(nVar) + " errore nr." + Str(nError)) - ' Return False - ' Exit Function - ' End If + Dim caricoAssi As Focas1.ODBSVLOAD - ' nValue = iodb.cdata(0) + 'leggo il numero del processo attivo + nPathIdx = GetActivePath() + 'leggo num max assi dal cn + nNumAxisRead = Focas1.MAX_AXIS - ' Return True - 'End Function + If Is30Series Then - 'Public Function F_WriteByteToR(ByVal nHandle As Integer, ByVal nVar As Integer, ByVal nValue As Byte) As Boolean + ' leggo tutto!!! + nReturn = Focas1.cnc_rdsvmeter(nLibHandle(nPathIdx), nNumAxisRead, caricoAssi) - ' Dim iodb As Focas1.IODBPMC0 = New Focas1.IODBPMC0 - ' Dim nLength, nError As Integer + If F_CheckRetError_Cnc(nReturn, "cnc_rdsvmeter RefreshAxisMeter CNC.FANUC.CMS_CncLib") Then + Throw New CmsNcException("ERR cnc_rdsvmeter RefreshAxisMeter CNC.FANUC.CMS_CncLib") + End If + End If - ' ReDim iodb.cdata(7) - ' iodb.type_a = R_PARAM - ' iodb.type_d = N_BYTE_TYPE - ' iodb.datano_s = nVar - ' iodb.datano_e = nVar - ' iodb.cdata(0) = nValue - ' nLength = 8 + 1 + Return caricoAssi - ' nError = Focas1.pmc_wrpmcrng(nHandle, nLength, iodb) + End Function - ' If (nError <> 0) Then - ' If Config.Settings.Settings.Debug >= 0 Then MessageBox.Show("Errore nella scrittura a byte della variabile R" + Str(nVar) + " errore nr." + Str(nError)) - ' Return False - ' Exit Function - ' End If + Public Function getGlobalFeedrate() As Focas1.ODBACT + ' RIFERIMENTO: + ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_actf.htm - ' Return True - 'End Function + Dim nPathIdx As Integer + Dim nNumAxisRead As Integer + Dim nReturn As Integer - 'Public Function F_WriteByteToD(ByVal nHandle As Integer, ByVal nVar As Integer, ByVal nValue As Byte) As Boolean + Dim feedData As Focas1.ODBACT + ' inizializzo + feedData = New Focas1.ODBACT - ' Dim iodb As Focas1.IODBPMC0 = New Focas1.IODBPMC0 - ' Dim nLength, nError As Integer + 'leggo il numero del processo attivo + nPathIdx = GetActivePath() + 'leggo num max assi dal cn + nNumAxisRead = Focas1.MAX_AXIS - ' ReDim iodb.cdata(7) - ' iodb.type_a = D_PARAM - ' iodb.type_d = N_BYTE_TYPE - ' iodb.datano_s = nVar - ' iodb.datano_e = nVar - ' iodb.cdata(0) = nValue - ' nLength = 8 + 1 + If Is30Series Then - ' nError = Focas1.pmc_wrpmcrng(nHandle, nLength, iodb) + ' leggo feed globale + nReturn = Focas1.cnc_actf(nLibHandle(nPathIdx), feedData) - ' If (nError <> 0) Then - ' If Config.Settings.Settings.Debug >= 0 Then MessageBox.Show("Errore nella scrittura a byte della variabile D" + Str(nVar) + " errore nr." + Str(nError)) - ' Return False - ' Exit Function - ' End If + If F_CheckRetError_Cnc(nReturn, "cnc_actf RefreshActFeedRate CNC.FANUC.CMS_CncLib") Then + Throw New CmsNcException("ERR cnc_actf RefreshActFeedRate CNC.FANUC.CMS_CncLib") + End If + End If - ' Return True - 'End Function + Return feedData - 'Public Function F_ReadUInt16FromR(ByVal nHandle As Integer, ByVal nVar As Integer, ByRef nValue As UInt16) As Boolean + End Function - ' Dim iodb As Focas1.IODBPMC1 = New Focas1.IODBPMC1 - ' Dim nLength, nError As Integer - ' nValue = 0 + 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!!! - ' iodb.type_a = R_PARAM - ' iodb.type_d = N_WORD_TYPE - ' iodb.datano_s = nVar - ' iodb.datano_e = nVar + 1 - ' nLength = 8 + (1 * 2) + Dim nPathIdx As Integer + Dim nNumAxisRead As Integer + Dim nReturn As Integer - ' nError = Focas1.pmc_rdpmcrng(nHandle, R_PARAM, N_WORD_TYPE, nVar, nVar + 1, nLength, iodb) + Dim allData As Focas1.ODBSPN + ' inizializzo + allData = New Focas1.ODBSPN - ' If (nError <> 0) Then - ' If Config.Settings.Settings.Debug >= 0 Then MessageBox.Show("Errore nella lettura UInt16 (2 Byte) della variabile R" + Str(nVar) + " errore nr." + Str(nError)) - ' Return False - ' Exit Function - ' End If + 'leggo il numero del processo attivo + nPathIdx = GetActivePath() + 'leggo num max assi dal cn + nNumAxisRead = Focas1.MAX_AXIS - ' nValue = iodb.idata(0) + If Is30Series Then - ' Return True - 'End Function + ' leggo feed globale + nReturn = Focas1.cnc_rdspload(nLibHandle(nPathIdx), -1, allData) + If F_CheckRetError_Cnc(nReturn, "cnc_rdspload RefreshAllSpindleLoad CNC.FANUC.CMS_CncLib") Then + Throw New CmsNcException("ERR cnc_rdspload RefreshAllSpindleLoad CNC.FANUC.CMS_CncLib") + End If + End If - 'Public Function F_ReadUInt32FromR(ByVal nHandle As Integer, ByVal nVar As Integer, ByRef nValue As UInt32) As Boolean + Return allData - ' Dim iodb As Focas1.IODBPMC2 = New Focas1.IODBPMC2 - ' Dim nLength, nError As Integer - ' nValue = 0 + End Function - ' iodb.type_a = R_PARAM - ' iodb.type_d = N_DWORD_TYPE - ' iodb.datano_s = nVar - ' iodb.datano_e = nVar + 3 - ' nLength = 8 + (1 * 4) + Public Function getAllDynData() As Focas1.ODBDY2_1 + ' RIFERIMENTO: + ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rddynamic2.htm - ' nError = Focas1.pmc_rdpmcrng(nHandle, R_PARAM, N_DWORD_TYPE, nVar, nVar + 3, nLength, iodb) + Dim nPathIdx As Integer + Dim nNumAxisRead As Integer + Dim nReturn As Integer - ' If (nError <> 0) Then - ' If Config.Settings.Settings.Debug >= 0 Then MessageBox.Show("Errore nella lettura Integer (4 Byte) della variabile R" + Str(nVar) + " errore nr." + Str(nError)) - ' Return False - ' Exit Function - ' End If + Dim allData As Focas1.ODBDY2_1 + ' inizializzo + allData = New Focas1.ODBDY2_1 - ' nValue = iodb.ldata(0) + 'leggo il numero del processo attivo + nPathIdx = GetActivePath() + 'leggo num max assi dal cn + nNumAxisRead = Focas1.MAX_AXIS - ' Return True - 'End Function + If Is30Series Then - 'Public Function F_ReadUInt32FromD(ByVal nHandle As Integer, ByVal nVar As Integer, ByRef nValue As UInt32) As Boolean + 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) - ' Dim iodb As Focas1.IODBPMC2 = New Focas1.IODBPMC2 - ' Dim nLength, nError As Integer - ' nValue = 0 + If F_CheckRetError_Cnc(nReturn, "cnc_rddynamic2 RefreshAllData CNC.FANUC.CMS_CncLib") Then + Throw New CmsNcException("ERR cnc_rddynamic2 RefreshAllData CNC.FANUC.CMS_CncLib") + End If + End If - ' iodb.type_a = D_PARAM - ' iodb.type_d = N_DWORD_TYPE - ' iodb.datano_s = nVar - ' iodb.datano_e = nVar + 3 - ' nLength = 8 + (1 * 4) + Return allData - ' nError = Focas1.pmc_rdpmcrng(nHandle, D_PARAM, N_DWORD_TYPE, nVar, nVar + 3, nLength, iodb) + End Function - ' If (nError <> 0) Then - ' If Config.Settings.Settings.Debug >= 0 Then MessageBox.Show("Errore nella lettura Integer (4 Byte) della variabile D" + Str(nVar) + " errore nr." + Str(nError)) - ' Return False - ' Exit Function - ' End If + 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 - ' nValue = iodb.ldata(0) + Dim nPathIdx As Integer + Dim nNumAxisRead As Integer + Dim nReturn As Integer - ' Return True - 'End Function + Dim allData As Focas1.ODBALMMSG2 + ' inizializzo + allData = New Focas1.ODBALMMSG2 - 'Public Function F_ReadByteFromF(ByVal nHandle As Integer, ByVal nVar As Integer, ByRef nValue As Byte) As Boolean + 'leggo il numero del processo attivo + nPathIdx = GetActivePath() + 'leggo num max assi dal cn + nNumAxisRead = Focas1.MAX_AXIS - ' Dim iodb As Focas1.IODBPMC0 = New Focas1.IODBPMC0 - ' Dim nlength As Integer, nError As Integer - ' nValue = 0 + ' vettore num allarmi MAX da leggere...... + Dim numAllarmi As Int16 + numAllarmi = 512 - ' iodb.type_a = F_PARAM - ' iodb.type_d = N_BYTE_TYPE - ' iodb.datano_s = nVar - ' iodb.datano_e = nVar - ' nlength = 8 + 1 + If Is30Series Then - ' nError = Focas1.pmc_rdpmcrng(nHandle, F_PARAM, N_BYTE_TYPE, nVar, nVar, nlength, iodb) + ' leggo tutto!!! + nReturn = Focas1.cnc_rdalmmsg2(nLibHandle(nPathIdx), -1, numAllarmi, allData) - ' If (nError <> 0) Then - ' If Config.Settings.Settings.Debug >= 0 Then MessageBox.Show("Errore nella lettura a byte della variabile F" + Str(nVar) + " errore nr." + Str(nError)) - ' Return False - ' Exit Function - ' End If + If F_CheckRetError_Cnc(nReturn, "cnc_rdalmmsg2 GetCncAlarm CNC.FANUC.CMS_CncLib") Then + Throw New CmsNcException("ERR cnc_rdalmmsg2 GetCncAlarm CNC.FANUC.CMS_CncLib") + End If + End If - ' nValue = iodb.cdata(0) + Return allData - ' Return True - 'End Function + End Function - ''leggo dalla variabile #100-#999 e #1000-#9999 un valore di tipo integer - 'Public Function F_ReadMacroInteger(ByVal nHandle As Integer, ByVal nMacro As Integer, ByRef nValue As Integer) As Boolean + Public Function getPathGCodeMod() As Focas1.ODBGCD + ' RIFERIMENTO: + ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Misc\cnc_rdgcode.htm - ' Dim macro As Focas1.ODBM - ' Dim nError As Integer + Dim nPathIdx As Integer + Dim nNumAxisRead As Integer + Dim nReturn As Integer - ' nValue = 0 + Dim actGCode As Focas1.ODBGCD + ' inizializzo + actGCode = New Focas1.ODBGCD - ' nError = Focas1.cnc_rdmacro(nHandle, nMacro, 10, macro) + 'leggo il numero del processo attivo + nPathIdx = GetActivePath() + 'leggo num max assi dal cn + nNumAxisRead = Focas1.MAX_AXIS - ' If nError <> 0 Then - ' If Config.Settings.Settings.Debug >= 0 Then MsgBox("Errore nella F_ReadMacroInteger della variabile macro #" + Trim(Str(nMacro)) + " errore n°" + Str(nError)) - ' Return False - ' Exit Function - ' End If + If Is30Series Then - ' nValue = Int(macro.mcr_val / 10 ^ macro.dec_val) + ' leggo tutto!!! 0-27 (28 elementi) + nReturn = Focas1.cnc_rdgcode(nLibHandle(nPathIdx), -1, 1, 37, actGCode) - ' Return True - 'End Function + If F_CheckRetError_Cnc(nReturn, "cnc_rdgcode RefreshPathGCode CNC.FANUC.CMS_CncLib") Then + Throw New CmsNcException("ERR cnc_rdgcode RefreshPathGCode CNC.FANUC.CMS_CncLib") + End If + End If - ''scrivo nella variabile #100-#999 e #1000-#9999 passando mantissa e posizioni decimali - 'Public Function F_WriteMacro(ByVal nHandle As Integer, ByVal nMacro As Integer, ByVal lMantissa As Long, ByVal nExp As Integer) As Boolean + Return actGCode - ' Dim nError As Integer + End Function - ' nError = Focas1.cnc_wrmacro(nHandle, nMacro, 10, lMantissa, nExp) + Public Function getPathGCode1Shot() As Focas1.ODBGCD + ' RIFERIMENTO: + ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Misc\cnc_rdgcode.htm - ' If nError <> 0 Then - ' If Config.Settings.Settings.Debug >= 0 Then MsgBox("Error on writing the custom macro (byte) #" + Trim(Str(nMacro)) + " error nr." + Str(nError)) - ' Return False - ' Exit Function - ' End If + Dim nPathIdx As Integer + Dim nNumAxisRead As Integer + Dim nReturn As Integer - ' Return True + Dim actGCode As Focas1.ODBGCD + ' inizializzo + actGCode = New Focas1.ODBGCD - 'End Function + '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.CMS_CncLib") Then + Throw New CmsNcException("ERR cnc_rdgcode RefreshPathGCode CNC.FANUC.CMS_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.CMS_CncLib") Then + Throw New CmsNcException("ERR cnc_rd3dtooltip RefreshPathTTCoord CNC.FANUC.CMS_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.CMS_CncLib") Then + Throw New CmsNcException("ERR cnc_rdspeed RefreshAxisSpeed CNC.FANUC.CMS_CncLib") + End If + End If + + Return speedAssi + + End Function #End Region