Inserita chiamata a getInfo3 deglia ssi x avere ID oltre a nome x processo OSAI

This commit is contained in:
Samuele E. Locatelli
2018-01-16 12:31:48 +01:00
parent 6ab6e6bf0a
commit aa4bc8c486
3 changed files with 93 additions and 38 deletions
@@ -884,6 +884,7 @@ Namespace CNC
Public Overridable Function O_ReadCurrentAnomalyMsg(ByRef CurrMsgAnomaly As OPENcontrol.MSGANOMALY) As Boolean
Return True
End Function
''' <summary>
''' Restituisce posizione assi (tutti)
''' </summary>
@@ -841,47 +841,47 @@ Retry: nRetry += 1
End Function
''' <summary>
''' Legge la tabella assi
''' </summary>
''' <param name="ProcessId">Processo selezionato</param>
''' <param name="AxisTable">Valore di ritorno Assi del processo selezionato</param>
''' <returns>True se andata a buon fine</returns>
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
' ''' <summary>
' ''' Legge la tabella assi
' ''' </summary>
' ''' <param name="ProcessId">Processo selezionato</param>
' ''' <param name="AxisTable">Valore di ritorno Assi del processo selezionato</param>
' ''' <returns>True se andata a buon fine</returns>
' 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
''' <summary>
''' Legge la tabella assi
''' </summary>
''' <param name="ProcessId">Processo selezionato</param>
''' <param name="AxisTable">Valore di ritorno Assi del processo selezionato</param>
''' <returns>True se andata a buon fine</returns>
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
+9
View File
@@ -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++)
{