OmagCUT :
- correzioni a test lavorazione specie con laser.
This commit is contained in:
@@ -40,25 +40,8 @@ Public Class ChooseTestToolWD
|
||||
End Sub
|
||||
|
||||
Private Function LoadSetUpTool() As Boolean
|
||||
Dim sNameTool As String = String.Empty
|
||||
Dim sHeadTool As String = String.Empty
|
||||
Dim nExitTool As Integer = 0
|
||||
|
||||
'sNameTool = m_MainWindow.m_CurrentMachine.sCurrSaw
|
||||
'If Not String.IsNullOrEmpty(sNameTool) Then
|
||||
' ' Imposto la lama
|
||||
' m_SetUpToolList.Add(New TestTool(sNameTool, sNameTool, True))
|
||||
'End If
|
||||
'sNameTool = m_MainWindow.m_CurrentMachine.sCurrMill
|
||||
'If Not String.IsNullOrEmpty(sNameTool) Then
|
||||
' ' Imposto la fresa
|
||||
' m_SetUpToolList.Add(New TestTool(sNameTool, sNameTool, False))
|
||||
'End If
|
||||
'sNameTool = m_MainWindow.m_CurrentMachine.sCurrDrill
|
||||
'If Not String.IsNullOrEmpty(sNameTool) Then
|
||||
' ' Imposto il foretto
|
||||
' m_SetUpToolList.Add(New TestTool(sNameTool, sNameTool, False))
|
||||
'End If
|
||||
Dim sNameTool As String = String.Empty
|
||||
|
||||
sNameTool = "Laser point"
|
||||
If Not String.IsNullOrEmpty(sNameTool) Then
|
||||
|
||||
+3
-3
@@ -476,11 +476,11 @@ Class MainWindow
|
||||
End If
|
||||
End If
|
||||
|
||||
' abilito il bottone per la gestione del comando di Check-Up-Start (posziona lama prelavorazione)
|
||||
If GetPrivateProfileInt(S_GENERAL, "Test", "0", m_sIniFile) = 0 OrElse
|
||||
' Abilito il bottone per la gestione del comando di Check-Up-Start (posiziono utensile scelto prelavorazione)
|
||||
If GetPrivateProfileInt(S_GENERAL, "Test", 0, m_sIniFile) = 0 OrElse
|
||||
Not File.Exists(m_CurrentMachine.sMachDir() & "\DirectCmd\TestWork.lua") Then
|
||||
m_CadCutPageUC.m_ProjectMgr.TestBtn.Visibility = Visibility.Collapsed
|
||||
EgtOutLog("Warning: Missing file 'TestWork.lua' in folder 'DirectCmd', buttun 'TEST' collapsed!")
|
||||
EgtOutLog("Warning: Missing file 'TestWork.lua' in folder 'DirectCmd', button 'TEST' collapsed!")
|
||||
Else
|
||||
m_CadCutPageUC.m_ProjectMgr.TestBtn.Visibility = Visibility.Visible
|
||||
End If
|
||||
|
||||
@@ -461,7 +461,7 @@ Public Class ProjectMgrUC
|
||||
#If TRIAL Then
|
||||
m_CurrProjPage.SetWarningMessage("Trial Version")
|
||||
#Else
|
||||
' se sono in modalità Test allora eseguo solo il posizionamento della lama
|
||||
' Se sono in modalità Test Posizione lavorazione
|
||||
If m_MainWindow.m_CadCutPageUC.m_NestPage.m_bSelectCurv Then
|
||||
' Verifico non sia versione Ufficio
|
||||
If m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.OFFICE_TYPE) Then
|
||||
@@ -481,9 +481,6 @@ Public Class ProjectMgrUC
|
||||
If Not TestToolWD.DialogResult Then Return
|
||||
Dim CurrTestTool As TestTool = TestToolWD.GetSelectedTool
|
||||
|
||||
'Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
|
||||
'EgtTdbSetCurrTool(sSaw)
|
||||
|
||||
Dim dThick As Double = 0
|
||||
Dim dHeight As Double = 0
|
||||
If CurrTestTool.ToolIsSaw Then
|
||||
@@ -517,16 +514,14 @@ Public Class ProjectMgrUC
|
||||
vtDirT.Normalize()
|
||||
' calcolo la direzione di offset da applicare all'utensile
|
||||
Dim vtOffset As New Vector3d(vtDirT.x, vtDirT.y, vtDirT.z)
|
||||
vtOffset.Rotate(Vector3d.Z_AX, 90)
|
||||
vtOffset.Rotate(Vector3d.Z_AX(), 90)
|
||||
|
||||
If CurrTestTool.ToolIsSaw Then
|
||||
' calcolo il versore perpendicolare alla linea di taglio (diretto verso l'interno del pezzo)
|
||||
vtDirT.Rotate(Vector3d.Z_AX, 90)
|
||||
vtDirT.Rotate(Vector3d.Z_AX(), 90)
|
||||
Else
|
||||
' calcolo il versore perpendicolare alla linea di taglio (diretto verso l'interno del pezzo)
|
||||
vtDirT.Rotate(Vector3d.Z_AX, 90)
|
||||
' calcolo il versore perpendicolare al piano di taglio (diretto verso l'interno dell'utensile)
|
||||
vtDirT.Rotate(vtDirLine, 90)
|
||||
' direzione utensile sempre Z+
|
||||
vtDirT = Vector3d.Z_AX()
|
||||
End If
|
||||
|
||||
' Calcolo punto di posizionamemto (punto medio)
|
||||
@@ -544,50 +539,66 @@ Public Class ProjectMgrUC
|
||||
Dim dL1, dL2, dL3, dR1, dR2 As Double
|
||||
If Not m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2) Then Return
|
||||
|
||||
' Imposto la lama corrente, preso dalla scelta precedente
|
||||
'If Not EgtSetCalcTool(sSaw, "H1", 1) Then Return
|
||||
' Imposto l'utensile corrente, preso dalla scelta precedente
|
||||
If Not EgtSetCalcTool(CurrTestTool.ToolName, CurrTestTool.ToolHead, CurrTestTool.ToolExit) Then Return
|
||||
Dim vsAxNames As String() = Nothing
|
||||
EgtGetAllCurrAxesNames( vsAxNames)
|
||||
Dim nRotAxCnt As Integer = vsAxNames.Count() - 3
|
||||
|
||||
' calcolo la posizione degli assi rotanti C, B
|
||||
Dim nStat As Integer
|
||||
Dim dC1, dB1, dC2, dB2 As Double
|
||||
' Se utensile LAMA
|
||||
If CurrTestTool.ToolIsSaw Then
|
||||
' Se LAMA
|
||||
EgtGetCalcAngles(vtDirT, Vector3d.Z_AX(), nStat, dC1, dB1, dC2, dB2)
|
||||
' Se LASER
|
||||
ElseIf CurrTestTool.ToolIsLaser Then
|
||||
' Se LASER
|
||||
Dim dHomeC As Double = 90
|
||||
EgtGetAxisHomePos("C", dHomeC)
|
||||
Dim vtPrefAuxDir As Vector3d = -Vector3d.X_AX()
|
||||
vtPrefAuxDir.Rotate(Vector3d.Z_AX, dHomeC)
|
||||
EgtGetCalcAngles(vtDirT, vtPrefAuxDir, nStat, dC1, dB1, dC2, dB2)
|
||||
' Forzo B90
|
||||
' Se asse C non calcolato, imposto il valore di Home
|
||||
If nRotAxCnt = 0 Or nStat < 0 Then
|
||||
dC1 = dHomeC
|
||||
dC2 = dHomeC
|
||||
End If
|
||||
' Forzo asse B a 90 (per le lame)
|
||||
dB1 = 90
|
||||
' Forzo la pozione in Z alla quota di Home (per evitare l'errore di fine corsa asse Z)
|
||||
Dim dHomeZ As Double = 0
|
||||
EgtGetAxisHomePos("Z", dHomeZ)
|
||||
ptMid.z = dHomeZ
|
||||
Else
|
||||
' Se utensile speciale
|
||||
If CurrTestTool.ToolType = MCH_TY.MILL_STD Or CurrTestTool.ToolType = MCH_TY.DRILL_STD Then
|
||||
' Se FRESA/FORETTO
|
||||
Dim nStepRotC As Integer = GetPrivateProfileInt(S_NEST, K_MACH_DRILL_MILL_C90, 1, m_MainWindow.GetMachIniFile())
|
||||
Dim vtPrefAuxDir As Vector3d = -Vector3d.X_AX()
|
||||
vtPrefAuxDir.Rotate(Vector3d.Z_AX, 90 * nStepRotC)
|
||||
EgtGetCalcAngles(vtDirT, vtPrefAuxDir, nStat, dC1, dB1, dC2, dB2)
|
||||
ElseIf CurrTestTool.ToolType = MCH_TY.WATERJET Then
|
||||
' Se WJ
|
||||
Dim dHomeC As Double = 90
|
||||
EgtGetAxisHomePos("C", dHomeC)
|
||||
Dim vtPrefAuxDir As Vector3d = Vector3d.X_AX()
|
||||
vtPrefAuxDir.Rotate(Vector3d.Z_AX, dHomeC)
|
||||
EgtGetCalcAngles(vtDirT, vtPrefAuxDir, nStat, dC1, dB1, dC2, dB2)
|
||||
' Se FRESA o FORETTO
|
||||
ElseIf CurrTestTool.ToolType = MCH_TY.MILL_STD Or CurrTestTool.ToolType = MCH_TY.DRILL_STD Then
|
||||
Dim nStepRotC As Integer = GetPrivateProfileInt(S_NEST, K_MACH_DRILL_MILL_C90, 1, m_MainWindow.GetMachIniFile())
|
||||
Dim vtPrefAuxDir As Vector3d = -Vector3d.X_AX()
|
||||
vtPrefAuxDir.Rotate(Vector3d.Z_AX, 90 * nStepRotC)
|
||||
EgtGetCalcAngles(vtDirT, vtPrefAuxDir, nStat, dC1, dB1, dC2, dB2)
|
||||
' Se asse C non calcolato, imposto il valore preferenziale
|
||||
If nStat < 0 Then
|
||||
dC1 = nStepRotC
|
||||
dC2 = nStepRotC
|
||||
End If
|
||||
' Se WATERJET
|
||||
ElseIf CurrTestTool.ToolType = MCH_TY.WATERJET Then
|
||||
Dim dHomeC As Double = 90
|
||||
EgtGetAxisHomePos("C", dHomeC)
|
||||
Dim vtPrefAuxDir As Vector3d = Vector3d.X_AX()
|
||||
vtPrefAuxDir.Rotate(Vector3d.Z_AX, dHomeC)
|
||||
EgtGetCalcAngles(vtDirT, vtPrefAuxDir, nStat, dC1, dB1, dC2, dB2)
|
||||
' Se asse C non calcolato, imposto il valore di Home
|
||||
If nStat < 0 Then
|
||||
dC1 = dHomeC
|
||||
dC2 = dHomeC
|
||||
End If
|
||||
End If
|
||||
|
||||
' calcolo la posizione degli assi lineari X, Y, Z
|
||||
Dim dX, dY, dZ As Double
|
||||
EgtGetCalcPositions(ptMid, dC1, dB1, nStat, dX, dY, dZ)
|
||||
' Se laser, forzo la Z alla quota di Home
|
||||
If CurrTestTool.ToolIsLaser Then
|
||||
Dim dHomeZ As Double = 0
|
||||
EgtGetAxisHomePos("Z", dHomeZ)
|
||||
dZ = dHomeZ
|
||||
End If
|
||||
|
||||
' verifica assi lineari
|
||||
EgtVerifyOutstroke(dX, dY, dZ, dC1, dB1, nStat)
|
||||
@@ -595,35 +606,56 @@ Public Class ProjectMgrUC
|
||||
EgtOutLog("Out of stroke: " & nStat)
|
||||
vtDirT = -vtDirT
|
||||
ptMid -= vtDirT * dThick
|
||||
' Se LAMA
|
||||
If CurrTestTool.ToolIsSaw Then
|
||||
EgtGetCalcAngles(vtDirT, Vector3d.Z_AX(), nStat, dC1, dB1, dC2, dB2)
|
||||
' Se LASER
|
||||
ElseIf CurrTestTool.ToolIsLaser Then
|
||||
' Se LASER
|
||||
Dim dHomeC As Double = 90
|
||||
EgtGetAxisHomePos("C", dHomeC)
|
||||
Dim vtPrefAuxDir As Vector3d = -Vector3d.X_AX()
|
||||
vtPrefAuxDir.Rotate(Vector3d.Z_AX, dHomeC)
|
||||
EgtGetCalcAngles(vtDirT, vtPrefAuxDir, nStat, dC1, dB1, dC2, dB2)
|
||||
' Se asse C non calcolato, imposto il valore di Home
|
||||
If nRotAxCnt = 0 Or nStat < 0 Then
|
||||
dC1 = dHomeC
|
||||
dC2 = dHomeC
|
||||
End If
|
||||
' Forzo B90
|
||||
dB1 = 90
|
||||
Else
|
||||
If CurrTestTool.ToolType = MCH_TY.MILL_STD Or CurrTestTool.ToolType = MCH_TY.DRILL_STD Then
|
||||
' Se FRESA/FORETTO
|
||||
Dim nStepRotC As Integer = GetPrivateProfileInt(S_NEST, K_MACH_DRILL_MILL_C90, 1, m_MainWindow.GetMachIniFile())
|
||||
Dim vtPrefAuxDir As Vector3d = -Vector3d.X_AX()
|
||||
vtPrefAuxDir.Rotate(Vector3d.Z_AX, 90 * nStepRotC)
|
||||
EgtGetCalcAngles(vtDirT, vtPrefAuxDir, nStat, dC1, dB1, dC2, dB2)
|
||||
ElseIf CurrTestTool.ToolType = MCH_TY.WATERJET Then
|
||||
' Se WJ
|
||||
Dim dHomeC As Double = 90
|
||||
EgtGetAxisHomePos("C", dHomeC)
|
||||
Dim vtPrefAuxDir As Vector3d = Vector3d.X_AX()
|
||||
vtPrefAuxDir.Rotate(Vector3d.Z_AX, dHomeC)
|
||||
EgtGetCalcAngles(vtDirT, vtPrefAuxDir, nStat, dC1, dB1, dC2, dB2)
|
||||
' Se FRESA/FORETTO
|
||||
ElseIf CurrTestTool.ToolType = MCH_TY.MILL_STD Or CurrTestTool.ToolType = MCH_TY.DRILL_STD Then
|
||||
Dim nStepRotC As Integer = GetPrivateProfileInt(S_NEST, K_MACH_DRILL_MILL_C90, 1, m_MainWindow.GetMachIniFile())
|
||||
Dim vtPrefAuxDir As Vector3d = -Vector3d.X_AX()
|
||||
vtPrefAuxDir.Rotate(Vector3d.Z_AX, 90 * nStepRotC)
|
||||
EgtGetCalcAngles(vtDirT, vtPrefAuxDir, nStat, dC1, dB1, dC2, dB2)
|
||||
' Se asse C non calcolato, imposto il valore preferenziale
|
||||
If nStat < 0 Then
|
||||
dC1 = nStepRotC
|
||||
dC2 = nStepRotC
|
||||
End If
|
||||
' Se WATERJET
|
||||
ElseIf CurrTestTool.ToolType = MCH_TY.WATERJET Then
|
||||
' Se WJ
|
||||
Dim dHomeC As Double = 90
|
||||
EgtGetAxisHomePos("C", dHomeC)
|
||||
Dim vtPrefAuxDir As Vector3d = Vector3d.X_AX()
|
||||
vtPrefAuxDir.Rotate(Vector3d.Z_AX, dHomeC)
|
||||
EgtGetCalcAngles(vtDirT, vtPrefAuxDir, nStat, dC1, dB1, dC2, dB2)
|
||||
' Se asse C non calcolato, imposto il valore di Home
|
||||
If nStat < 0 Then
|
||||
dC1 = dHomeC
|
||||
dC2 = dHomeC
|
||||
End If
|
||||
End If
|
||||
' calcolo la posizione degli assi lineari X, Y, Z ( correggere il punto ptMid.z sommando il raggio utensile)
|
||||
' calcolo la posizione degli assi lineari X, Y, Z
|
||||
EgtGetCalcPositions(ptMid, dC1, dB1, nStat, dX, dY, dZ)
|
||||
' Se laser, forzo la Z alla quota di Home
|
||||
If CurrTestTool.ToolIsLaser Then
|
||||
Dim dHomeZ As Double = 0
|
||||
EgtGetAxisHomePos("Z", dHomeZ)
|
||||
dZ = dHomeZ
|
||||
End If
|
||||
|
||||
' verifica assi lineari
|
||||
EgtVerifyOutstroke(dX, dY, dZ, dC1, dB1, nStat)
|
||||
@@ -633,12 +665,12 @@ Public Class ProjectMgrUC
|
||||
End If
|
||||
|
||||
'--------------------------- Comunico i movimenti in origine macchina al CN ----------------------------------------
|
||||
Dim ptMachine As Point3d = New Point3d(dX, dY, If(CurrTestTool.ToolIsLaser, 0, dZ))
|
||||
ExecuteCommandCNC(ptMachine, dC1, dB1, CurrTestTool)
|
||||
ExecuteTestMoveCNC(New Point3d(dX, dY, dZ), dC1, dB1, CurrTestTool)
|
||||
Return
|
||||
End If
|
||||
' ---------------------------- Fine modalità test --------------------------------------------
|
||||
' se esiste salvo il nome del progetto
|
||||
' ---------------------------- Fine modalità test posizione lavorazione --------------------------------------------
|
||||
|
||||
' Se esiste salvo il nome del progetto
|
||||
Dim sCurrProjName As String = String.Empty
|
||||
GetPrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, "", sCurrProjName, m_MainWindow.GetIniFile())
|
||||
If Not String.IsNullOrEmpty(sCurrProjName) Then
|
||||
@@ -1175,7 +1207,7 @@ Public Class ProjectMgrUC
|
||||
End Sub
|
||||
|
||||
' ------------------------------------------------ GENERA COMANDI CNC MOVIMENTO ------------------------------------------------
|
||||
Private Sub ExecuteCommandCNC(ptMid As Point3d, dAngC As Double, dAngB As Double, SelTestTool As TestTool)
|
||||
Private Sub ExecuteTestMoveCNC(ptMid As Point3d, dAngC As Double, dAngB As Double, SelTestTool As TestTool)
|
||||
|
||||
Dim CmdString As String = String.Empty
|
||||
If Not EgtLuaExecFile(m_MainWindow.m_CurrentMachine.sMachDir() & "\DirectCmd\TestWork.lua") Then
|
||||
@@ -1201,13 +1233,6 @@ Public Class ProjectMgrUC
|
||||
EgtLuaSetGlobNumVar("CMD.R1", dR1)
|
||||
EgtLuaSetGlobNumVar("CMD.R2", dR2)
|
||||
|
||||
'' Recupero spessore lama corrente
|
||||
'Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
|
||||
'EgtTdbSetCurrTool(sSaw)
|
||||
'Dim dThick As Double = 0
|
||||
'EgtTdbGetCurrToolParam(MCH_TP.THICK, dThick)
|
||||
'EgtLuaSetGlobNumVar("CMD.SAWTH", dThick)
|
||||
|
||||
EgtTdbSetCurrTool(SelTestTool.ToolName)
|
||||
EgtLuaSetGlobStringVar("CMD.TLNAME", SelTestTool.ToolName)
|
||||
EgtLuaSetGlobStringVar("CMD.TLALIAS", SelTestTool.ToolAlias)
|
||||
@@ -1218,7 +1243,6 @@ Public Class ProjectMgrUC
|
||||
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sTCPos)
|
||||
EgtLuaSetGlobStringVar("CMD.TCPOS", sTCPos)
|
||||
|
||||
|
||||
'----------- ASSEGNO POSIZIONE DI ARRIVO MACCHINA -----------
|
||||
' Assegno valore ad ogni asse da muovere (in zero macchina)
|
||||
EgtLuaSetGlobNumVar("CMD.X_AXISMOVE", ptMid.x)
|
||||
@@ -1238,9 +1262,7 @@ Public Class ProjectMgrUC
|
||||
' Log del comando
|
||||
EgtOutLog("CmdString=" & CmdString)
|
||||
|
||||
' Reset lua
|
||||
EgtLuaResetGlobVar("CMD")
|
||||
' Modifico stringa per inserire i newline ( in questo caso non c'è bisogno perchè tutto sulla stessa linea)
|
||||
' Modifico stringa per inserire i newline
|
||||
CmdString = CmdString.Replace("<br/>", Environment.NewLine)
|
||||
' Creo file...
|
||||
Dim FilePath As String = m_MainWindow.GetCncDir() & "\TestWork" & m_MainWindow.m_CurrentMachine.sIsoFileExt
|
||||
@@ -1265,8 +1287,7 @@ Public Class ProjectMgrUC
|
||||
|
||||
End Sub
|
||||
|
||||
' ------------------------------------------------ GENERA COMANDI CNC MOVIMENTO ------------------------------------------------
|
||||
|
||||
' ------------------------------------------------------------------------------------------------
|
||||
Private Sub TestBtn_Click(sender As Object, e As RoutedEventArgs) Handles TestBtn.Click
|
||||
If TestBtn.IsChecked Then
|
||||
m_MainWindow.m_CadCutPageUC.m_NestPage.m_bSelectCurv = True
|
||||
|
||||
Reference in New Issue
Block a user