Gestione Assi lineare in pollici e migliorata SawTilted
This commit is contained in:
@@ -154,6 +154,7 @@ Friend Module CamAuto
|
||||
Return ResetAllMachinings(nWarn)
|
||||
End Function
|
||||
|
||||
' Ricalcola tutte le lavorazioni
|
||||
Friend Function ResetAllMachinings(ByRef nWarn As Integer) As Boolean
|
||||
' Cancello tutte le lavorazioni
|
||||
EraseMachinings(GDB_ID.NULL)
|
||||
@@ -170,6 +171,7 @@ Friend Module CamAuto
|
||||
Return True
|
||||
End Function
|
||||
|
||||
' Elimina da ogni entità il nome della lavorazione asseganta
|
||||
Friend Function RestoreDef_Machinig(Optional bOnlySideAng As Boolean = True)
|
||||
Dim sSawingTilted As String = m_MainWindow.m_CurrentMachine.sCurrSawingTilted
|
||||
Dim bApplySawingTilted As Boolean = m_MainWindow.m_CurrentMachine.bApplySawingTilted
|
||||
@@ -180,6 +182,11 @@ Friend Module CamAuto
|
||||
Dim nIdLayerOutLoop As Integer = EgtGetFirstNameInGroup(nIdPart, NAME_OUTLOOP)
|
||||
Dim nEntId As Integer = EgtGetFirstInGroup(nIdLayerOutLoop)
|
||||
SetResetDef_Machining(nEntId, sSawingTilted, bApplySawingTilted, bOnlySideAng)
|
||||
'nIdLayerOutLoop = EgtGetFirstNameInGroup(nIdPart, NAME_OUTLOOP & ".orig")
|
||||
'If nIdLayerOutLoop <> GDB_ID.NULL Then
|
||||
' nEntId = EgtGetFirstInGroup(nIdLayerOutLoop)
|
||||
' SetResetDef_Machining(nEntId, sSawingTilted, bApplySawingTilted, bOnlySideAng)
|
||||
'End If
|
||||
nIdPart = EgtGetNextPart(nIdPart)
|
||||
End While
|
||||
Dim nRawId As Integer = CamAuto.GetCurrentRaw()
|
||||
@@ -189,6 +196,11 @@ Friend Module CamAuto
|
||||
Dim nIdLayerOutLoop As Integer = EgtGetFirstNameInGroup(nIdPart, NAME_OUTLOOP)
|
||||
Dim nEntId As Integer = EgtGetFirstInGroup(nIdLayerOutLoop)
|
||||
SetResetDef_Machining(nEntId, sSawingTilted, bApplySawingTilted, bOnlySideAng)
|
||||
nIdLayerOutLoop = EgtGetFirstNameInGroup(nIdPart, NAME_OUTLOOP & ".orig")
|
||||
If nIdLayerOutLoop <> GDB_ID.NULL Then
|
||||
nEntId = EgtGetFirstInGroup(nIdLayerOutLoop)
|
||||
SetResetDef_Machining(nEntId, sSawingTilted, bApplySawingTilted, bOnlySideAng)
|
||||
End If
|
||||
nIdPart = EgtGetNextPartInRawPart(nIdPart)
|
||||
End While
|
||||
Return bOk
|
||||
|
||||
@@ -12,24 +12,34 @@
|
||||
Public Const K_SIMULATIONAXESNUM As String = "SimulationAxesNum"
|
||||
Public Const K_L1NAME As String = "L1Name"
|
||||
Public Const K_L1ID As String = "L1Id"
|
||||
Public Const K_L1TYPE As String = "L1Type"
|
||||
Public Const K_L2NAME As String = "L2Name"
|
||||
Public Const K_L2ID As String = "L2Id"
|
||||
Public Const K_L2TYPE As String = "L2Type"
|
||||
Public Const K_L3NAME As String = "L3Name"
|
||||
Public Const K_L3ID As String = "L3Id"
|
||||
Public Const K_L3TYPE As String = "L3Type"
|
||||
Public Const K_R1NAME As String = "R1Name"
|
||||
Public Const K_R1ID As String = "R1Id"
|
||||
Public Const K_R1TYPE As String = "R1Type"
|
||||
Public Const K_R2NAME As String = "R2Name"
|
||||
Public Const K_R2ID As String = "R2Id"
|
||||
Public Const K_R2TYPE As String = "R2Type"
|
||||
Public Const K_A6NAME As String = "A6Name"
|
||||
Public Const K_A6ID As String = "A6Id"
|
||||
Public Const K_A6TYPE As String = "A6Type"
|
||||
Public Const K_A7NAME As String = "A7Name"
|
||||
Public Const K_A7ID As String = "A7Id"
|
||||
Public Const K_A7TYPE As String = "A7Type"
|
||||
Public Const K_A8NAME As String = "A8Name"
|
||||
Public Const K_A8ID As String = "A8Id"
|
||||
Public Const K_A8TYPE As String = "A8Type"
|
||||
Public Const K_A9NAME As String = "A9Name"
|
||||
Public Const K_A9ID As String = "A9Id"
|
||||
Public Const K_A9TYPE As String = "A9Type"
|
||||
Public Const K_A10NAME As String = "A10Name"
|
||||
Public Const K_A10ID As String = "A10Id"
|
||||
Public Const K_A10TYPE As String = "A10Type"
|
||||
Public Const K_DELTA_C As String = "DeltaC"
|
||||
Public Const K_ININCHES As String = "InInches"
|
||||
Public Const K_CPOS As String = "CPos"
|
||||
|
||||
@@ -1465,7 +1465,7 @@ Public Class SideAngleUC
|
||||
EgtSetInfo(CurrEntity.nGeomId, INFO_SIDE_ANGLE, dSideAngle)
|
||||
EgtSetInfo(CurrEntity.nGeomId, INFO_ORIG_SIDE_ANGLE, dSideAngle)
|
||||
Dim sSawingTilted As String = m_MainWindow.m_CurrentMachine.sCurrSawingTilted
|
||||
If Not String.IsNullOrEmpty(sSawingTilted) Then
|
||||
If Not String.IsNullOrEmpty(sSawingTilted) And m_MainWindow.m_CurrentMachine.bApplySawingTilted Then
|
||||
EgtSetInfo(CurrEntity.nGeomId, DEF_MACHINING_TILTED, sSawingTilted)
|
||||
End If
|
||||
' Cancello inclinazione nell'apposito campo info
|
||||
|
||||
@@ -236,6 +236,10 @@ Public Class MachineStatusUC
|
||||
End Sub
|
||||
|
||||
Sub DisplayPosition()
|
||||
Dim nNumDec As Integer = -3
|
||||
If m_MainWindow.m_CNCommunication.GetMachineInInches() Then
|
||||
nNumDec = -4
|
||||
End If
|
||||
' Recupero le posizioni macchina
|
||||
Dim dL1, dL2, dL3, dR1, dR2, dA6, dA7, dA8, dA9, dA10 As Double
|
||||
m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2, dA6, dA7, dA8, dA9, dA10)
|
||||
@@ -247,33 +251,37 @@ Public Class MachineStatusUC
|
||||
dL3 = ptTip.z
|
||||
End If
|
||||
' Visualizzazione
|
||||
Axis1TxBx.Text = LenToString(dL1, -3, True)
|
||||
Axis2TxBx.Text = LenToString(dL2, -3, True)
|
||||
Axis3TxBx.Text = LenToString(dL3, -3, True)
|
||||
Axis1TxBx.Text = LenToString(dL1, nNumDec, True)
|
||||
Axis2TxBx.Text = LenToString(dL2, nNumDec, True)
|
||||
Axis3TxBx.Text = LenToString(dL3, nNumDec, True)
|
||||
Axis4TxBx.Text = DoubleToString(dR1, -3)
|
||||
Axis5TxBx.Text = DoubleToString(dR2, -3)
|
||||
If m_AxesNumber >= 6 Then Axis6TxBx.Text = DoubleToString(dA6, -3)
|
||||
If m_AxesNumber >= 7 Then Axis7TxBx.Text = LenToString(dA7, -3, True)
|
||||
If m_AxesNumber >= 8 Then Axis8TxBx.Text = LenToString(dA8, -3, True)
|
||||
If m_AxesNumber >= 9 Then Axis9TxBx.Text = LenToString(dA9, -3, True)
|
||||
If m_AxesNumber >= 10 Then Axis10TxBx.Text = LenToString(dA10, -3, True)
|
||||
If m_AxesNumber >= 7 Then Axis7TxBx.Text = LenToString(dA7, nNumDec, True)
|
||||
If m_AxesNumber >= 8 Then Axis8TxBx.Text = LenToString(dA8, nNumDec, True)
|
||||
If m_AxesNumber >= 9 Then Axis9TxBx.Text = LenToString(dA9, nNumDec, True)
|
||||
If m_AxesNumber >= 10 Then Axis10TxBx.Text = LenToString(dA10, nNumDec, True)
|
||||
End Sub
|
||||
|
||||
Sub DisplayPositionDelta()
|
||||
Dim nNumDec As Integer = -3
|
||||
If m_MainWindow.m_CNCommunication.GetMachineInInches() Then
|
||||
nNumDec = -4
|
||||
End If
|
||||
' Recupero le posizioni macchina
|
||||
Dim dL1, dL2, dL3, dR1, dR2, dA6, dA7, dA8, dA9, dA10 As Double
|
||||
m_MainWindow.m_CNCommunication.GetAxesDeltas(dL1, dL2, dL3, dR1, dR2, dA6, dA7, dA8, dA9, dA10)
|
||||
' Visualizzazione
|
||||
DeltaAxis1TxBx.Text = LenToString(dL1, -3, True)
|
||||
DeltaAxis2TxBx.Text = LenToString(dL2, -3, True)
|
||||
DeltaAxis3TxBx.Text = LenToString(dL3, -3, True)
|
||||
DeltaAxis1TxBx.Text = LenToString(dL1, nNumDec, True)
|
||||
DeltaAxis2TxBx.Text = LenToString(dL2, nNumDec, True)
|
||||
DeltaAxis3TxBx.Text = LenToString(dL3, nNumDec, True)
|
||||
DeltaAxis4TxBx.Text = DoubleToString(dR1, -3)
|
||||
DeltaAxis5TxBx.Text = DoubleToString(dR2, -3)
|
||||
If m_AxesNumber >= 6 Then DeltaAxis6TxBx.Text = DoubleToString(dA6, -3)
|
||||
If m_AxesNumber >= 7 Then DeltaAxis7TxBx.Text = LenToString(dA7, -3, True)
|
||||
If m_AxesNumber >= 8 Then DeltaAxis8TxBx.Text = LenToString(dA8, -3, True)
|
||||
If m_AxesNumber >= 9 Then DeltaAxis9TxBx.Text = LenToString(dA9, -3, True)
|
||||
If m_AxesNumber >= 10 Then DeltaAxis10TxBx.Text = LenToString(dA10, -3, True)
|
||||
If m_AxesNumber >= 7 Then DeltaAxis7TxBx.Text = LenToString(dA7, nNumDec, True)
|
||||
If m_AxesNumber >= 8 Then DeltaAxis8TxBx.Text = LenToString(dA8, nNumDec, True)
|
||||
If m_AxesNumber >= 9 Then DeltaAxis9TxBx.Text = LenToString(dA9, nNumDec, True)
|
||||
If m_AxesNumber >= 10 Then DeltaAxis10TxBx.Text = LenToString(dA10, nNumDec, True)
|
||||
End Sub
|
||||
|
||||
Sub DisplayFeed()
|
||||
@@ -335,16 +343,16 @@ Public Class MachineStatusUC
|
||||
|
||||
Sub DisplayActiveMode(Mode As Integer)
|
||||
Select Case Mode
|
||||
Case 0
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Auto.png", UriKind.Relative))
|
||||
Case 1
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Single.png", UriKind.Relative))
|
||||
Case 2
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Mdi.png", UriKind.Relative))
|
||||
Case 7
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Manual.png", UriKind.Relative))
|
||||
Case 8
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Home.png", UriKind.Relative))
|
||||
Case 0
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Auto.png", UriKind.Relative))
|
||||
Case 1
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Single.png", UriKind.Relative))
|
||||
Case 2
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Mdi.png", UriKind.Relative))
|
||||
Case 7
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Manual.png", UriKind.Relative))
|
||||
Case 8
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Home.png", UriKind.Relative))
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -62,5 +62,5 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.7.8.1")>
|
||||
<Assembly: AssemblyFileVersion("2.7.8.1")>
|
||||
<Assembly: AssemblyVersion("2.7.8.2")>
|
||||
<Assembly: AssemblyFileVersion("2.7.8.2")>
|
||||
|
||||
+143
-60
@@ -73,6 +73,11 @@ Public Class CNCommunication
|
||||
Private m_nA10 As Integer = 9
|
||||
Private m_bInInches As Boolean = False ' Solo per comandi diretti (assi sempre in mm)
|
||||
|
||||
' NUVO! ver. 2.7h2: m_sA1=nome (in grafica), tipo (Linear/Rotary), m_nA1=indice (nel vettore CN)
|
||||
Private m_ListAxesData As New List(Of AxisData)
|
||||
Public Function GetListAxesData() As List(Of AxisData)
|
||||
Return m_ListAxesData
|
||||
End Function
|
||||
|
||||
Friend Sub CNCommunication_Initialization()
|
||||
|
||||
@@ -164,83 +169,149 @@ Public Class CNCommunication
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region "ver 2.7h2 NUOVA LETTURA ASSI"
|
||||
|
||||
' Dal nome della chiave cerca di estrarre la definizione del tipo di asse
|
||||
Private Sub GetDefaultTypeAxis(sKeyAxis As String, ByRef bIsLinear As Boolean)
|
||||
' non è stato definito il tipo asse: cerco di assegnarlo di default
|
||||
Dim sMsg As String = String.Empty
|
||||
If sKeyAxis.StartsWith("L") Then
|
||||
sMsg = "Linear"
|
||||
bIsLinear = True
|
||||
ElseIf sKeyAxis.StartsWith("R") Then
|
||||
sMsg = "Rotary"
|
||||
bIsLinear = False
|
||||
Else
|
||||
sMsg = "Linear"
|
||||
bIsLinear = True
|
||||
End If
|
||||
EgtOutLog("In file *.ini machine in section '[Axes]' axis type '" & sKeyAxis & "' has been defined by default as " & sMsg)
|
||||
End Sub
|
||||
|
||||
' Legge da file *.ini macchina la definizione del tipo di asse
|
||||
Private Function GetTypeAxis(sKeyAxis As String)
|
||||
Dim bIsLinear As Boolean = True
|
||||
Dim sValue As String = String.Empty
|
||||
GetPrivateProfileString(S_AXES, sKeyAxis, "", sValue, m_MainWindow.GetMachIniFile())
|
||||
If Not String.IsNullOrEmpty(sValue) Then
|
||||
If sValue.ToLower = "linear" Then
|
||||
bIsLinear = True
|
||||
ElseIf sValue.ToLower = "rotary" Then
|
||||
bIsLinear = False
|
||||
Else
|
||||
GetDefaultTypeAxis(sKeyAxis, bIsLinear)
|
||||
End If
|
||||
Else
|
||||
GetDefaultTypeAxis(sKeyAxis, bIsLinear)
|
||||
End If
|
||||
' Ritorno il booleano che definisce il tipo di asse che è stato letto
|
||||
Return bIsLinear
|
||||
End Function
|
||||
|
||||
' Imposto il vettore dei tipi asse macchina
|
||||
Private Sub SetArrayAxisIsLinear()
|
||||
For Each Item As AxisData In m_ListAxesData
|
||||
m_CN.b_axis_is_linear(Item.nIndex) = Item.bIsLinear
|
||||
Next
|
||||
End Sub
|
||||
|
||||
' Legge da file *.ini macchina il nome dell'asse, se non esiste impone il valore di default e restituisce FALSE
|
||||
Private Function SetNameAxis(sKeyAxis As String, sAxisDefaultName As String, ByRef sAxisName As String) As Boolean
|
||||
Dim bAxisExist As Boolean = False
|
||||
Dim sValue As String = String.Empty
|
||||
bAxisExist = (GetPrivateProfileString(S_AXES, sKeyAxis, "", sValue, m_MainWindow.GetMachIniFile()) > 0)
|
||||
If String.IsNullOrEmpty(sValue) Then
|
||||
sAxisName = sAxisDefaultName
|
||||
Else
|
||||
sAxisName = sValue
|
||||
End If
|
||||
Return bAxisExist
|
||||
End Function
|
||||
|
||||
Private Function SetIndexAxis(sKeyAxis As String, nAxisDefaultIndex As Integer, ByRef nAxisIndex As String) As Boolean
|
||||
Dim bAxisExist As Boolean = True
|
||||
nAxisIndex = GetPrivateProfileInt(S_AXES, sKeyAxis, nAxisDefaultIndex, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(nAxisIndex) Then
|
||||
nAxisIndex = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on " & sKeyAxis)
|
||||
bAxisExist = False
|
||||
End If
|
||||
Return bAxisExist
|
||||
End Function
|
||||
|
||||
Private Sub ReadAxesData()
|
||||
' Nomi e indici degli assi macchina: definisco il nome degli assi da satampare nella pagina MachineStatusUC
|
||||
m_bAxesOk = True
|
||||
GetPrivateProfileString(S_AXES, K_L1NAME, "X", m_sA1, m_MainWindow.GetMachIniFile())
|
||||
m_nA1 = GetPrivateProfileInt(S_AXES, K_L1ID, 0, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA1) Then
|
||||
m_nA1 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on L1ID")
|
||||
Dim bAxisExist As Boolean = False
|
||||
bAxisExist = SetNameAxis(K_L1NAME, "X", m_sA1)
|
||||
If SetIndexAxis(K_L1ID, 0, m_nA1) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_L1TYPE), m_sA1, m_nA1))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_L2NAME, "Y", m_sA2, m_MainWindow.GetMachIniFile())
|
||||
m_nA2 = GetPrivateProfileInt(S_AXES, K_L2ID, 1, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA2) Then
|
||||
m_nA2 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on L2ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_L2NAME, "Y", m_sA2)
|
||||
If SetIndexAxis(K_L2ID, 1, m_nA2) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_L2TYPE), m_sA2, m_nA2))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_L3NAME, "Z", m_sA3, m_MainWindow.GetMachIniFile())
|
||||
m_nA3 = GetPrivateProfileInt(S_AXES, K_L3ID, 2, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA3) Then
|
||||
m_nA3 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on L3ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_L3NAME, "Z", m_sA3)
|
||||
If SetIndexAxis(K_L3ID, 2, m_nA3) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_L3TYPE), m_sA3, m_nA3))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_R1NAME, "C", m_sA4, m_MainWindow.GetMachIniFile())
|
||||
m_nA4 = GetPrivateProfileInt(S_AXES, K_R1ID, 8, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA4) Then
|
||||
m_nA4 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on R1ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_R1NAME, "C", m_sA4)
|
||||
If SetIndexAxis(K_R1ID, 8, m_nA4) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_R1TYPE), m_sA4, m_nA4))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_R2NAME, "B", m_sA5, m_MainWindow.GetMachIniFile())
|
||||
m_nA5 = GetPrivateProfileInt(S_AXES, K_R2ID, 7, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA5) Then
|
||||
m_nA5 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on R2ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_R2NAME, "B", m_sA5)
|
||||
If SetIndexAxis(K_R2ID, 7, m_nA5) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_R2TYPE), m_sA5, m_nA5))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_A6NAME, "A", m_sA6, m_MainWindow.GetMachIniFile())
|
||||
m_nA6 = GetPrivateProfileInt(S_AXES, K_A6ID, 6, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA6) Then
|
||||
m_nA6 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on A6ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_A6NAME, "A", m_sA6)
|
||||
If SetIndexAxis(K_A6ID, 6, m_nA6) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_A6TYPE), m_sA6, m_nA6))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_A7NAME, "U", m_sA7, m_MainWindow.GetMachIniFile())
|
||||
m_nA7 = GetPrivateProfileInt(S_AXES, K_A7ID, 3, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA7) Then
|
||||
m_nA7 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on A7ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_A7NAME, "U", m_sA7)
|
||||
If SetIndexAxis(K_A7ID, 3, m_nA7) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_A7TYPE), m_sA7, m_nA7))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_A8NAME, "V", m_sA8, m_MainWindow.GetMachIniFile())
|
||||
m_nA8 = GetPrivateProfileInt(S_AXES, K_A8ID, 4, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA8) Then
|
||||
m_nA8 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on A8ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_A8NAME, "V", m_sA8)
|
||||
If SetIndexAxis(K_A8ID, 4, m_nA8) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_A8TYPE), m_sA8, m_nA8))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_A9NAME, "W", m_sA9, m_MainWindow.GetMachIniFile())
|
||||
m_nA9 = GetPrivateProfileInt(S_AXES, K_A9ID, 5, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA9) Then
|
||||
m_nA9 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on A9ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_A9NAME, "W", m_sA9)
|
||||
If SetIndexAxis(K_A9ID, 5, m_nA9) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_A9TYPE), m_sA9, m_nA9))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_A10NAME, "P", m_sA10, m_MainWindow.GetMachIniFile())
|
||||
m_nA10 = GetPrivateProfileInt(S_AXES, K_A10ID, 5, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA10) Then
|
||||
m_nA10 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on A10ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_A10NAME, "P", m_sA10)
|
||||
If SetIndexAxis(K_A10ID, 5, m_nA10) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_A10TYPE), m_sA10, m_nA10))
|
||||
End If
|
||||
|
||||
' Unità di misura
|
||||
m_bInInches = (GetPrivateProfileInt(S_AXES, K_ININCHES, 0, m_MainWindow.GetMachIniFile()) <> 0)
|
||||
' Crea il vettore che ad ogni posizione definisce il tipo di asse assegnato
|
||||
SetArrayAxisIsLinear()
|
||||
End Sub
|
||||
|
||||
#End Region ' ver 2.7h2 nuova gestione
|
||||
|
||||
Private Sub KillSimensCom(sProcessName As String)
|
||||
Dim sAppName As String = Path.GetFileNameWithoutExtension(sProcessName)
|
||||
Dim pList() As System.Diagnostics.Process = System.Diagnostics.Process.GetProcesses
|
||||
@@ -1808,4 +1879,16 @@ Public Class IndexArrayToBit
|
||||
m_sNameVar = NameVar
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
' Utlizzata per definire la lista degli assi impostati in macchina
|
||||
Public Class AxisData
|
||||
Public bIsLinear As Boolean
|
||||
Public sName As String
|
||||
Public nIndex As Integer
|
||||
Sub New(_bIsLinear As Boolean, _sName As String, _nINdex As Integer)
|
||||
bIsLinear = _bIsLinear
|
||||
sName = _sName
|
||||
nIndex = _nINdex
|
||||
End Sub
|
||||
End Class
|
||||
@@ -131,6 +131,8 @@ Public MustInherit Class CN_generico
|
||||
Public d_axis_position(MAX_AXES) As Double
|
||||
Public d_axis_delta(MAX_AXES) As Double
|
||||
Public b_axis_valid(MAX_AXES) As Boolean
|
||||
' ver. 2.7h2: gestione del tipo di asse per eseguire una corretta conversione dei dati inch/mm
|
||||
Public b_axis_is_linear(MAX_AXES) As Boolean
|
||||
|
||||
Public d_DReadELS_value As Double
|
||||
Public n_DReadELS_handle As Short
|
||||
|
||||
+884
-866
File diff suppressed because it is too large
Load Diff
+19
-8
@@ -734,15 +734,26 @@ Module M_MMFiles
|
||||
' Copia delle quote degli assi
|
||||
For nI As Integer = 0 To (m_Axes_Id.Count() - 1)
|
||||
Dim nId As Short = m_Axes_Id(nI)
|
||||
' agli assi lineari devo applicare il coefficiente
|
||||
If (nId Mod 10) < 3 Then
|
||||
CurrCN.d_axis_position(nI) = SiemensRet.d_interf_axis_position(nId) * LinCoeff
|
||||
CurrCN.d_axis_delta(nI) = SiemensRet.d_interf_axis_delta(nId) * LinCoeff
|
||||
' gli assi rotanti sono sempre in gradi
|
||||
Else
|
||||
CurrCN.d_axis_position(nI) = SiemensRet.d_interf_axis_position(nId)
|
||||
CurrCN.d_axis_delta(nI) = SiemensRet.d_interf_axis_delta(nId)
|
||||
|
||||
'' agli assi lineari devo applicare il coefficiente
|
||||
'If (nId Mod 10) < 3 Then
|
||||
' CurrCN.d_axis_position(nI) = SiemensRet.d_interf_axis_position(nId) * LinCoeff
|
||||
' CurrCN.d_axis_delta(nI) = SiemensRet.d_interf_axis_delta(nId) * LinCoeff
|
||||
' ' gli assi rotanti sono sempre in gradi
|
||||
'Else
|
||||
' CurrCN.d_axis_position(nI) = SiemensRet.d_interf_axis_position(nId)
|
||||
' CurrCN.d_axis_delta(nI) = SiemensRet.d_interf_axis_delta(nId)
|
||||
'End If
|
||||
|
||||
' ver 2.7h2
|
||||
CurrCN.d_axis_position(nI) = SiemensRet.d_interf_axis_position(nId)
|
||||
CurrCN.d_axis_delta(nI) = SiemensRet.d_interf_axis_delta(nId)
|
||||
' verifico se l'indice 'i' è associato ad un asse rotativo oppure lineare
|
||||
If CurrCN.b_axis_is_linear(nI) Then
|
||||
CurrCN.d_axis_position(nI) *= LinCoeff
|
||||
CurrCN.d_axis_delta(nI) *= LinCoeff
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
' Copia variabili R
|
||||
|
||||
+1
-132
@@ -45,140 +45,9 @@ Module Utility
|
||||
|
||||
'--------------------------------------------------------------------------------------------------
|
||||
#Region "INCHES FRACTIONS"
|
||||
'Enum FractionPattern
|
||||
' None
|
||||
' Feet_Inches
|
||||
' Inches
|
||||
'End Enum
|
||||
|
||||
'' seleziona il tipo di Pattern con cui stamoare i dati
|
||||
' seleziona il tipo di Pattern di stampa dei dati
|
||||
Friend nCurrFractionPattern As FractionStringConverter.FractionPattern = FractionPattern.Feet_Inches
|
||||
Friend dPrecision As Double = 64
|
||||
|
||||
'Friend Function StringFractionToStringDecimal(dVal As Double, dBase As Double) As String
|
||||
' Dim sSign As String = String.Empty
|
||||
' If dVal < 0 Then
|
||||
' sSign = "-"
|
||||
' dVal = Math.Abs(dVal)
|
||||
' End If
|
||||
' Dim sFraction As String = String.Empty
|
||||
' ' integer and decima part of the value
|
||||
' Dim dInteger As Double = Math.Floor(dVal)
|
||||
' Dim dFraction As Double = dVal - dInteger
|
||||
' ' the nearest decimal numerator
|
||||
' Dim dNumeretor As Double = dFraction * dBase
|
||||
' Dim dRound As Double = Math.Round(dNumeretor)
|
||||
' ' estimates the irreducible fraction
|
||||
' If dRound = 0 Then
|
||||
' ' no decimal part
|
||||
' ElseIf dRound = dBase Then
|
||||
' ' no decimal part
|
||||
' dInteger = dInteger + 1
|
||||
' Else
|
||||
' ' simplify fraction
|
||||
' While dRound Mod 2 = 0
|
||||
' dRound = dRound / 2
|
||||
' dBase = dBase / 2
|
||||
' End While
|
||||
' sFraction = DoubleToString(dRound, 0) & "/" & DoubleToString(dBase, 0)
|
||||
' End If
|
||||
' ' sVal: dFeet'dInteger"sFraction --- dInteger sFraction
|
||||
' Return WriteFraction(dInteger, sFraction)
|
||||
'End Function
|
||||
|
||||
'' trasforma il valore da pollici a piedi
|
||||
'Private Sub ConvertInchesToFeet(ByRef dFeet As Double, ByRef dInches As Double)
|
||||
' If dInches = 0 Then Return
|
||||
' While dInches - 12 >= 0
|
||||
' dFeet = dFeet + 1
|
||||
' dInches = dInches - 12
|
||||
' End While
|
||||
'End Sub
|
||||
|
||||
'' stampa dati in funzione del pattern dichiarato
|
||||
'Private Function WriteFraction(ByVal dInches As Double, sFraction As String) As String
|
||||
' Dim sVal As String = String.Empty
|
||||
' Select Case nCurrFractionPattern
|
||||
' Case FractionPattern.Feet_Inches
|
||||
' Dim dFeet As Double = 0
|
||||
' ConvertInchesToFeet(dFeet, dInches)
|
||||
' If dFeet > 0 Then
|
||||
' sVal = String.Format("{0}'{1}""{2}", DoubleToString(dFeet, 0), DoubleToString(dInches, 0), sFraction).Trim
|
||||
' Else
|
||||
' sVal = String.Format("{0}""{1}", DoubleToString(dInches, 0), sFraction).Trim
|
||||
' End If
|
||||
' Case FractionPattern.Inches
|
||||
' sVal = DoubleToString(dInches, 0) & " " & sFraction
|
||||
' sVal = String.Format("{0}""{1}", DoubleToString(dInches, 0), sFraction).Trim
|
||||
' End Select
|
||||
' Return sVal
|
||||
'End Function
|
||||
|
||||
'' riceve la stringa sorgente e restituisce la nuova strunga in formato decimale (senza eseguire conversioni di unità)
|
||||
'Friend Function StringFractionToDouble(sVal As String, ByRef sValConverted As String) As Boolean
|
||||
' Dim dVal As Double = 0
|
||||
' ' dato in ingresso: sVal = 2'3"23/32
|
||||
' Dim sFeet As String = String.Empty
|
||||
' Dim sFeetPattern As String = "^.*?(?=')"
|
||||
' Dim dFeet As Double = 0
|
||||
' Dim bOkFeet As Boolean = True
|
||||
' Dim bFeetExists As Boolean = False
|
||||
' Dim sInch As String = String.Empty
|
||||
' Dim sInchPattern As String = "(?<=')(.*?)(?="")" ' se la stringa contiene l'apice singolo
|
||||
' Dim sInchPattern1 As String = "(.*?)(?="")" ' se la stringa NON contiene l'apice singolo
|
||||
' Dim dInch As Double = 0
|
||||
' Dim bOkInch As Boolean = True
|
||||
' Dim bInchExists As Boolean = False
|
||||
' Dim sFraction As String = String.Empty
|
||||
' Dim sFractionPattern As String = "(?<="")(.*)" ' se la stringa contiene l'apice doppio
|
||||
' Dim sFractionPattern1 As String = "(?<=')(.*)" ' se la stringa NON contiene l'apice doppio ma solo quello singolo
|
||||
' Dim dFraction As Double = 0
|
||||
' Dim bOkFraction As Boolean = True
|
||||
' Dim bFractionExists As Boolean = False
|
||||
|
||||
' ' recupero il valore di Feet (2')
|
||||
' Dim sMyMatch As String = Regex.Match(sVal, sFeetPattern).Groups(1).Value
|
||||
' If Not String.IsNullOrEmpty(sMyMatch) Or Not String.IsNullOrWhiteSpace(sMyMatch) Then
|
||||
' sFeet = sMyMatch.Trim
|
||||
' bOkFeet = StringToDouble(sFeet, dFeet)
|
||||
' bFeetExists = True
|
||||
' End If
|
||||
|
||||
' ' recupero il valore di Inch (3") dopo i Feet - oppure direttamente i pollici
|
||||
' If bFeetExists Then
|
||||
' sMyMatch = Regex.Match(sVal, sInchPattern).Groups(1).Value
|
||||
' Else
|
||||
' sMyMatch = Regex.Match(sVal, sInchPattern1).Groups(1).Value
|
||||
' End If
|
||||
' If Not String.IsNullOrEmpty(sMyMatch) Or Not String.IsNullOrWhiteSpace(sMyMatch) Then
|
||||
' sInch = sMyMatch.Trim
|
||||
' bOkInch = StringToDouble(sInch, dInch)
|
||||
' bInchExists = True
|
||||
' End If
|
||||
|
||||
' ' recupero il valore frazionario (23/32) dopo i pollici - oppure dopo i feet - oppure direttamente i valore inteso come pollici
|
||||
' If bInchExists Then
|
||||
' sMyMatch = Regex.Match(sVal, sFractionPattern).Groups(1).Value
|
||||
' ElseIf bFeetExists And Not bInchExists Then
|
||||
' sMyMatch = Regex.Match(sVal, sFractionPattern1).Groups(1).Value
|
||||
' ElseIf Not bFeetExists And Not bInchExists Then
|
||||
' sMyMatch = sVal
|
||||
' End If
|
||||
' If Not String.IsNullOrEmpty(sMyMatch) Or Not String.IsNullOrWhiteSpace(sMyMatch) Then
|
||||
' sFraction = sMyMatch
|
||||
' bOkFraction = StringToDouble(sFraction, dFraction)
|
||||
' End If
|
||||
|
||||
' ' calcolo il valore decimale dell'espressione
|
||||
' If bOkFeet And bOkInch And bOkFraction Then
|
||||
' dVal = dFeet / 12 + dInch + dFraction
|
||||
' sValConverted = DoubleToString(dVal, 4)
|
||||
' Return True
|
||||
' Else
|
||||
' Return False
|
||||
' End If
|
||||
'End Function
|
||||
|
||||
#End Region ' Inches Fraction
|
||||
'--------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user