From aa4bc8c486e692e6595595a97f1016c05d55f0fb Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 16 Jan 2018 12:31:48 +0100 Subject: [PATCH] Inserita chiamata a getInfo3 deglia ssi x avere ID oltre a nome x processo OSAI --- .../CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb | 1 + .../CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb | 121 ++++++++++++------ MTC_Adapter/MTC_Adapter/AdapterOsai.cs | 9 ++ 3 files changed, 93 insertions(+), 38 deletions(-) diff --git a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb index cf82f29..2ecc1e6 100644 --- a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb +++ b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb @@ -884,6 +884,7 @@ Namespace CNC Public Overridable Function O_ReadCurrentAnomalyMsg(ByRef CurrMsgAnomaly As OPENcontrol.MSGANOMALY) As Boolean Return True End Function + ''' ''' Restituisce posizione assi (tutti) ''' diff --git a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb index 763456a..f577ce4 100644 --- a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb +++ b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb @@ -841,47 +841,47 @@ Retry: nRetry += 1 End Function - ''' - ''' Legge la tabella assi - ''' - ''' Processo selezionato - ''' Valore di ritorno Assi del processo selezionato - ''' True se andata a buon fine - Public Overloads Overrides Function O_GetAxisTab(ByVal ProcessId As Short, ByRef AxisTable() As Char, ByRef AxisIdTable() As Short) As Boolean - Dim szReturn As String = "" - Dim i, j As Integer - Dim myGetAxesInfo3R As OPENcontrol.GetAxesInfo3R - Dim myGetAxesInfo3 As New OPENcontrol.GetAxesInfo3 - Dim nRetry As Integer -Retry: nRetry += 1 + ' ''' + ' ''' Legge la tabella assi + ' ''' + ' ''' Processo selezionato + ' ''' Valore di ritorno Assi del processo selezionato + ' ''' True se andata a buon fine + ' Public Overloads Overrides Function O_GetAxisTab(ByVal ProcessId As Short, ByRef AxisTable() As Char, ByRef AxisIdTable() As Short) As Boolean + ' Dim szReturn As String = "" + ' Dim i, j As Integer + ' Dim myGetAxesInfo3R As OPENcontrol.GetAxesInfo3R + ' Dim myGetAxesInfo3 As New OPENcontrol.GetAxesInfo3 + ' Dim nRetry As Integer + 'Retry: nRetry += 1 - Try - myGetAxesInfo3.AxesNum = 64 - myGetAxesInfo3R = OPENws.GetAxesInfo3(myGetAxesInfo3) - If O_CheckRetError(myGetAxesInfo3R.retval, myGetAxesInfo3R.ErrClass, myGetAxesInfo3R.ErrNum, "GetAxesInfo3() O_RW_Word CNC.OSAI_OPEN", szReturn) Then - Throw New CmsNcException(szReturn) - Return False - End If + ' Try + ' myGetAxesInfo3.AxesNum = 64 + ' myGetAxesInfo3R = OPENws.GetAxesInfo3(myGetAxesInfo3) + ' If O_CheckRetError(myGetAxesInfo3R.retval, myGetAxesInfo3R.ErrClass, myGetAxesInfo3R.ErrNum, "GetAxesInfo3() O_RW_Word CNC.OSAI_OPEN", szReturn) Then + ' Throw New CmsNcException(szReturn) + ' Return False + ' End If - For i = 0 To 63 - If myGetAxesInfo3R.AxOwnerList(i) = ProcessId Then - If (myGetAxesInfo3R.AxNameList(i) < Asc("a") Or myGetAxesInfo3R.AxNameList(i) > Asc("z")) And myGetAxesInfo3R.AxNameList(i) <> Asc("S") Then - AxisTable(j) = Chr(myGetAxesInfo3R.AxNameList(i)) - AxisIdTable(j) = i + 1 - j += 1 - End If - 'ElseIf myGetAxesInfo3R.AxOwnerList(i) = &HFFFF& Then 'Non esco perchè gli assi potrebbero non essere in fila - ' Exit For - End If - Next i + ' For i = 0 To 63 + ' If myGetAxesInfo3R.AxOwnerList(i) = ProcessId Then + ' If (myGetAxesInfo3R.AxNameList(i) < Asc("a") Or myGetAxesInfo3R.AxNameList(i) > Asc("z")) And myGetAxesInfo3R.AxNameList(i) <> Asc("S") Then + ' AxisTable(j) = Chr(myGetAxesInfo3R.AxNameList(i)) + ' AxisIdTable(j) = i + 1 + ' j += 1 + ' End If + ' 'ElseIf myGetAxesInfo3R.AxOwnerList(i) = &HFFFF& Then 'Non esco perchè gli assi potrebbero non essere in fila + ' ' Exit For + ' End If + ' Next i - Return True - Catch ex As System.ServiceModel.CommunicationException - If nRetry < MAXRET Then GoTo Retry - Throw New CmsNcException(ex.Message) - Return False - End Try - End Function + ' Return True + ' Catch ex As System.ServiceModel.CommunicationException + ' If nRetry < MAXRET Then GoTo Retry + ' Throw New CmsNcException(ex.Message) + ' Return False + ' End Try + ' End Function #Region "Funzioni specifiche IOT" @@ -1005,6 +1005,49 @@ Retry: nRetry += 1 End Try End Function + + ''' + ''' Legge la tabella assi + ''' + ''' Processo selezionato + ''' Valore di ritorno Assi del processo selezionato + ''' True se andata a buon fine + Public Overloads Overrides Function O_GetAxisTab(ByVal ProcessId As Short, ByRef AxisTable() As Char, ByRef AxisIdTable() As Short) As Boolean + Dim szReturn As String = "" + Dim i, j As Integer + Dim myGetAxesInfo3R As OPENcontrol.GetAxesInfo3R + Dim myGetAxesInfo3 As New OPENcontrol.GetAxesInfo3 + Dim nRetry As Integer +Retry: nRetry += 1 + + Try + myGetAxesInfo3.AxesNum = 64 + myGetAxesInfo3R = OPENws.GetAxesInfo3(myGetAxesInfo3) + If O_CheckRetError(myGetAxesInfo3R.retval, myGetAxesInfo3R.ErrClass, myGetAxesInfo3R.ErrNum, "GetAxesInfo3() O_RW_Word CNC.OSAI_OPEN", szReturn) Then + Throw New CmsNcException(szReturn) + Return False + End If + + For i = 0 To 63 + If myGetAxesInfo3R.AxOwnerList(i) = ProcessId Then + If (myGetAxesInfo3R.AxNameList(i) < Asc("a") Or myGetAxesInfo3R.AxNameList(i) > Asc("z")) And myGetAxesInfo3R.AxNameList(i) <> Asc("S") Then + AxisTable(j) = Chr(myGetAxesInfo3R.AxNameList(i)) + AxisIdTable(j) = i + 1 + j += 1 + End If + 'ElseIf myGetAxesInfo3R.AxOwnerList(i) = &HFFFF& Then 'Non esco perchè gli assi potrebbero non essere in fila + ' Exit For + End If + Next i + + Return True + Catch ex As System.ServiceModel.CommunicationException + If nRetry < MAXRET Then GoTo Retry + Throw New CmsNcException(ex.Message) + Return False + End Try + End Function + Public Overloads Overrides Function getAllAxisPos(tipoPos As Int16, ByRef AxisPos As OPENcontrol.GETINTDATA()) As Boolean ' RIFERIMENTO: ' CndexLinkUser.pdf | pag 146, 266 @@ -1030,6 +1073,8 @@ Retry: nRetry += 1 End If AxisPos = myGetAxesPositionR.IntPos + + Return True Catch ex As System.ServiceModel.CommunicationException If nRetry < MAXRET Then GoTo Retry diff --git a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs index 876b846..8638318 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs @@ -995,6 +995,15 @@ namespace MTC_Adapter string tipoAsse = ""; string direzione = ""; char axName; + + // 2018.01.16 cerco info assi... + char[] axisTable1 = new char[64]; + short[] axisIdTable1 = new short[64]; + char[] axisTable2 = new char[64]; + short[] axisIdTable2 = new short[64]; + OSAI_ref.O_GetAxisTab(1, ref axisTable1, ref axisIdTable1); + OSAI_ref.O_GetAxisTab(2, ref axisTable2, ref axisIdTable2); + // ciclo x assi for (int i = 0; i < currAdpConf.nAxis; i++) {