OmagCUT 2.3c3:

-> aggiunti bottoni per gestire porte anche nella pagina IN LAVORAZIONE,
-> nuova comunicazione con NUM.
This commit is contained in:
Nicola Pievani
2021-03-18 18:46:50 +00:00
parent 0cabbea411
commit fb1095344b
8 changed files with 733 additions and 259 deletions
+2
View File
@@ -324,6 +324,8 @@ Module ConstGen
' utensile per le lavorazioni manuali
Public Const DUMMY_SAW As String = "DummySAW"
' lavorazione manuale
Public Const DUMMY_SAWING As String = "DummySAWING"
' Nome di pezzo per tagli diretti
Public Const NAME_DIRECTCUT As String = "DirectCut"
+1
View File
@@ -42,6 +42,7 @@ Module ConstIni
Public Const K_REGISTRATION As String = "Registration"
Public Const K_VIRTUALKEYBOARD As String = "VirtualKeyboard"
Public Const K_THEME As String = "Theme"
Public Const K_MANUAL_CUT As String = "ManualCut"
Public Const S_LANGUAGES As String = "Languages"
Public Const K_LANGUAGE As String = "Language"
+42 -11
View File
@@ -398,6 +398,7 @@ Public MustInherit Class MachineButton
Friend Const BTN_STATE_SPINDLE As String = "Spindle"
Friend Const BTN_STATE_COOLANT As String = "Coolant"
Friend Const BTN_STATE_LASER As String = "Laser"
Friend Const BTN_STATE_LASERTRAC As String = "LaserTrac"
Friend Const BTN_STATE_THREEAXIS As String = "ThreeAxis"
Friend Const BTN_STATE_FIVEAXIS As String = "FiveAxis"
Friend Const BTN_STATE_NOTHING As String = "Nothing"
@@ -474,6 +475,9 @@ Public MustInherit Class MachineButton
If m_CN.m_NewVariable And m_MainWindow.m_CNCommunication.m_nNCType = 2 Then
' solo per Flexium
m_CN.DPlcVariables_WriteVariables(ENumber, EValue)
If Not IsNothing(ENumber2) And Not IsNothing(EValue2) Then
m_CN.DPlcVariables_WriteVariables(ENumber2, EValue2)
End If
' altrimenti scrittura delle variabili E
Else
m_CN.DVariables_WriteVariables2(ENumber, EValue)
@@ -531,20 +535,22 @@ Public MustInherit Class MachineButton
Case 3
'Per il siemens non devo fare nulla
End Select
' comunico il comando che deve essere scritto nel codice MDI
' salvo la stringa di comando ricevuta dal file lua
m_CN.sz_ManualDataInput = CmdString
' esguo la funzione che ha il compito di scrivere il comando MDI
m_CN.MDI_command()
' avvio l'esecuzione del comando
Select Case m_MainWindow.m_CNCommunication.m_nNCType
Case 1, 2
System.Threading.Thread.Sleep(300)
System.Threading.Thread.Sleep(500)
m_CN.DGeneralFunctions_CycleStart()
Case 3
'Per il siemens non devo fare nulla
End Select
' se richiesto ripeto l'operazione
If b2Start Then
System.Threading.Thread.Sleep(300)
EgtOutLog("Avvio secondo cliclo start")
System.Threading.Thread.Sleep(800)
m_CN.DGeneralFunctions_CycleStart()
End If
System.Threading.Thread.Sleep(300)
@@ -555,8 +561,12 @@ Public MustInherit Class MachineButton
' lettura delle variavili scritte nel file Lua
Friend Sub ExecuteDirectCmdLua(LuaFileName As String, ByRef CmdString As String, ByRef b2Start As Boolean, ByRef EActive As Boolean, ByRef ENumber As String, ByRef EValue As String, ByRef EType As String, ByRef ENumber2 As String, ByRef EValue2 As String, ByRef EType2 As String)
Dim sBaseDir As String = m_MainWindow.m_CurrentMachine.sMachDir & "\DirectCmd\"
EgtLuaExecFile(sBaseDir & LuaFileName)
EgtOutLog("Lua eseguito")
If EgtLuaExecFile(sBaseDir & LuaFileName) Then
EgtOutLog("Lua " & sBaseDir & LuaFileName & " eseguito")
Else
EgtOutLog("Lua " & sBaseDir & LuaFileName & " non eseguito")
End If
Dim dFeed As Double = 0
If Not String.IsNullOrWhiteSpace(m_DirectCutPage.m_ManualAxesMove.FeedTxBx.Text) Then
StringToLen(m_DirectCutPage.m_ManualAxesMove.FeedTxBx.Text, dFeed)
@@ -607,7 +617,15 @@ Public MustInherit Class MachineButton
EgtLuaResetGlobVar("CmdString")
EgtLuaResetGlobVar("CMD")
' Log del comando
EgtOutLog("CmdString=" & CmdString & " b2Start=" & b2Start.ToString() & " EActive=" & EActive & " ENumber=" & ENumber & " EValue=" & EValue & " EType=" & If(Not String.IsNullOrEmpty(EType), CInt(EType).ToString, "") & " ENumber2=" & ENumber2 & " EValue2=" & EValue2 & " EType2=" & If(Not String.IsNullOrEmpty(EType2), CInt(EType2).ToString, ""))
EgtOutLog("CmdString=" & If(Not String.IsNullOrEmpty(CmdString), CmdString, "") &
" b2Start=" & b2Start.ToString() &
" EActive=" & EActive.ToString &
" ENumber=" & If(Not String.IsNullOrEmpty(ENumber), ENumber, "") &
" EValue=" & If(Not String.IsNullOrEmpty(EValue), EValue, "") &
" EType=" & If(Not String.IsNullOrEmpty(EType), CInt(EType).ToString, "") &
" ENumber2=" & If(Not String.IsNullOrEmpty(ENumber2), ENumber2, "") &
" EValue2=" & If(Not String.IsNullOrEmpty(EValue2), EValue2, "") &
" EType2=" & If(Not String.IsNullOrEmpty(EType2), CInt(EType2).ToString, ""))
End Sub
#End Region ' METHODS
@@ -870,7 +888,7 @@ Public Class PressedCommandButton
sNewIcons = "NewIcons\"
End If
' Se variabile di stato "Nothing" o non collegato a CN, imposto immagine fissa
If StateFlag = BTN_STATE_NOTHING Or Not m_MainWindow.m_bNCLink Or IsNothing(FImageName) Or String.IsNullOrWhiteSpace(FImageName) Then
If StateFlag = BTN_STATE_NOTHING OrElse Not m_MainWindow.m_bNCLink OrElse IsNothing(FImageName) OrElse String.IsNullOrWhiteSpace(FImageName) Then
' ritorno immagine dello stato true
Return m_MainWindow.GetResourcesDir() & "\MachineButtonsImage\" & sNewIcons & TImageName
End If
@@ -891,13 +909,26 @@ Public Class PressedCommandButton
End Sub
Friend Sub OnMouseDown()
ExecuteMDICommand(TLuaScriptName)
SetIsPressed(True)
Try
ExecuteMDICommand(TLuaScriptName)
EgtOutLog("Comando MDI eseguito")
SetIsPressed(True)
EgtOutLog("Aggiornamento immagine bottone eseguito")
Catch ex As Exception
EgtOutLog("Eccezione riga 909 di ControlsMachineButtonUC.xaml.vb : " & ex.ToString)
End Try
End Sub
Friend Sub OnMouseUp()
ExecuteMDICommand(FLuaScriptName)
SetIsPressed(False)
Try
ExecuteMDICommand(FLuaScriptName)
EgtOutLog("Comando MDI eseguito")
SetIsPressed(False)
EgtOutLog("Aggiornamento immagine bottone eseguito")
Catch ex As Exception
EgtOutLog("Eccezione riga 925 di ControlsMachineButtonUC.xaml.vb : " & ex.ToString)
End Try
End Sub
#End Region ' METHODS
+34 -11
View File
@@ -8,8 +8,8 @@ Public Class DirectCutPageUC
Friend m_MachineButtons As MachineButtonsUC
Friend m_ManualAxesMove As ManualAxesMoveUC
Friend m_SingleCut As SingleCutUC
'' sostituisco la pagina attuale con la MIA
'Friend m_SingleCut As SingleCutAuto
' nuova finestra per i comandi per il taglio manuale nuovo
Friend m_SingleCutAuto As SingleCutAuto
Friend m_MultipleCut As MultipleCut
Friend m_GridCut As GridCut
Friend m_FlatteningCut As FlatteningCut
@@ -31,6 +31,8 @@ Public Class DirectCutPageUC
' Variabile che indica se sono attivi i bottoni macchina nuovi o vecchi
Friend m_NewMachineButtonsType As Boolean
' Indica che la finestra del talio Singolo deve essere di tipo manuale
Friend m_bManulaCut As Boolean = False
Enum DirectCutPages
DirectCut
@@ -42,15 +44,16 @@ Public Class DirectCutPageUC
Polishing
CopyTemplate
SawTest
SingleCutAuto
End Enum
Private Sub DirectCutPage_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
' leggo la configurazione del programma per i nuovi tagli manuali
m_bManulaCut = GetPrivateProfileInt(S_GENERAL, K_MANUAL_CUT, 0, m_MainWindow.GetIniFile()) <> 0
'Creazione delle Page UserControl
m_MachineButtons = New MachineButtonsUC
m_ManualAxesMove = New ManualAxesMoveUC
'' sostituisco la pagina attuale con la MIA
'm_SingleCut = New SingleCutAuto
m_SingleCut = New SingleCutUC
m_MultipleCut = New MultipleCut
m_GridCut = New GridCut
@@ -60,12 +63,18 @@ Public Class DirectCutPageUC
m_SawTest = New SawTestUC
m_ControlsMachineButton = New ControlsMachineButtonUC
m_VacuumMachineButton = New VacuumMachineButtonUC
' Costruisco la finestra per il nuovo tipo di taglio manuale
m_SingleCutAuto = New SingleCutAuto
'Posizionemento nella griglia delle Page UserControl
m_MachineButtons.SetValue(Grid.RowProperty, 2)
m_MachineButtons.SetValue(Grid.ColumnSpanProperty, 3)
m_ManualAxesMove.SetValue(Grid.RowProperty, 1)
m_SingleCut.SetValue(Grid.RowProperty, 1)
If m_bManulaCut Then
m_SingleCutAuto.SetValue(Grid.RowProperty, 1)
Else
m_SingleCut.SetValue(Grid.RowProperty, 1)
End If
m_MultipleCut.SetValue(Grid.RowProperty, 1)
m_GridCut.SetValue(Grid.RowProperty, 1)
m_FlatteningCut.SetValue(Grid.RowProperty, 1)
@@ -89,7 +98,7 @@ Public Class DirectCutPageUC
End If
ManualBtn.Content = EgtMsg( 90201)
SingleCutBtn.Content = EgtMsg( 90202)
SingleCutBtn.Content = EgtMsg(90202)
MultipleCutBtn.Content = EgtMsg( 90203)
GridCutBtn.Content = EgtMsg( 90204)
FlatteningCutBtn.Content = EgtMsg( 90206)
@@ -104,6 +113,9 @@ Public Class DirectCutPageUC
If m_ActiveDirectCutPage = DirectCutPages.SingleCut Then
LeftButtonGrid.Children.Add(m_SingleCut)
Return
ElseIf m_ActiveDirectCutPage = DirectCutPages.SingleCutAuto Then
LeftButtonGrid.Children.Add(m_SingleCutAuto)
Return
ElseIf m_ActiveDirectCutPage = DirectCutPages.MultipleCut Then
LeftButtonGrid.Children.Add(m_MultipleCut)
Return
@@ -129,9 +141,12 @@ Public Class DirectCutPageUC
' Attivo le lavorazioni solo se esiste il grezzo
Dim bRawOk As Boolean = (GetRawHeight() > EPS_SMALL)
'' sostituisco la pagina attuale con la MIA -> abilito il bottone anche in assenza del grezzo
'SingleCutBtn.IsEnabled = True
SingleCutBtn.IsEnabled = bRawOk
If m_bManulaCut Then
' anche se non è presente un grezzo mantengo abilitato il bottone
SingleCutBtn.IsEnabled = True
Else
SingleCutBtn.IsEnabled = bRawOk
End If
MultipleCutBtn.IsEnabled = bRawOk
GridCutBtn.IsEnabled = bRawOk
FlatteningCutBtn.IsEnabled = bRawOk
@@ -174,8 +189,14 @@ Public Class DirectCutPageUC
End Sub
Private Sub SingleCutBtn_Click(sender As Object, e As RoutedEventArgs) Handles SingleCutBtn.Click
LeftButtonGrid.Children.Add(m_SingleCut)
m_ActiveDirectCutPage = DirectCutPages.SingleCut
If m_bManulaCut Then
LeftButtonGrid.Children.Add(m_SingleCutAuto)
m_ActiveDirectCutPage = DirectCutPages.SingleCutAuto
Else
LeftButtonGrid.Children.Add(m_SingleCut)
m_ActiveDirectCutPage = DirectCutPages.SingleCut
End If
End Sub
Private Sub MultipleCutBtn_Click(sender As Object, e As RoutedEventArgs) Handles MultipleCutBtn.Click
@@ -258,6 +279,8 @@ Public Class DirectCutPageUC
' Non è necessario fare alcunché
Case DirectCutPages.SingleCut
LeftButtonGrid.Children.Remove(m_SingleCut)
Case DirectCutPages.SingleCutAuto
LeftButtonGrid.Children.Remove(m_SingleCutAuto)
Case DirectCutPages.MultipleCut
LeftButtonGrid.Children.Remove(m_MultipleCut)
Case DirectCutPages.GridCut
+308 -55
View File
@@ -29,6 +29,8 @@ Public Class MachineButtonsUC
Private Const BTN_STATE_THREEAXIS As String = "ThreeAxis"
Private Const BTN_STATE_FIVEAXIS As String = "FiveAxis"
Private Const BTN_STATE_NOTHING As String = "Nothing"
Private Const BTN_STATE_DOOR_OPENED As String = "DoorOpened"
Private Const BTN_STATE_DOOR_CLOSED As String = "DoorClosed"
Public Sub New(Optional bOnlyLaser As Boolean = False)
' This call is required by the designer.
@@ -89,7 +91,7 @@ Public Class MachineButtonsUC
End If
Next
' Se non collegato a CN metto immagini fisse
' Se non collegato a CN metto immagini fisse (o nessuna immagine)
If Not m_MainWindow.m_bNCLink Then
For nIndex As Integer = 0 To m_nCount - 1
Dim sImage As String = If(String.IsNullOrEmpty(ImageArrayN(nIndex)), ImageArrayY(nIndex), ImageArrayN(nIndex))
@@ -116,43 +118,208 @@ Public Class MachineButtonsUC
Dim CurrentBtn As Primitives.ToggleButton = e.Source
' recupero l'inidce del bottone selezionato
Dim nIndex As Integer = GetToggleButtonIndex(CurrentBtn) - 1
Dim sBaseDir As String = m_MainWindow.m_CurrentMachine.sMachDir & "\DirectCmd\"
Dim sLuaFileName As String = String.Empty
' Se il bottone chiamantè quello delle porte allora devo eseguire due comandi MDI
If nIndex = Array.IndexOf(StateFlagArray, BTN_STATE_DOOR_OPENED) OrElse
nIndex = Array.IndexOf(StateFlagArray, BTN_STATE_DOOR_CLOSED) Then
Dim sTLuaFile As String = sBaseDir & CommandArrayY(nIndex)
Dim sFLuaFile As String = sBaseDir & CommandArrayN(nIndex)
ExecuteMDICommand(CurrentBtn, sTLuaFile)
ExecuteMDICommand(CurrentBtn, sFLuaFile)
CurrentBtn.IsChecked = False
Return
End If
If CurrentBtn.IsChecked() Then
EgtLuaExecFile(sBaseDir & CommandArrayY(nIndex))
'EgtLuaExecFile(sBaseDir & CommandArrayY(nIndex))
sLuaFileName = sBaseDir & CommandArrayY(nIndex)
Else
If Not (StateFlagArray(nIndex) = BTN_STATE_THREEAXIS Or
StateFlagArray(nIndex) = BTN_STATE_FIVEAXIS) Then
EgtLuaExecFile(sBaseDir & CommandArrayN(nIndex))
'EgtLuaExecFile(sBaseDir & CommandArrayN(nIndex))
sLuaFileName = sBaseDir & CommandArrayN(nIndex)
Else
Return
End If
End If
Dim dFeed As Double = 0
If Not String.IsNullOrWhiteSpace(m_DirectCutPage.m_ManualAxesMove.FeedTxBx.Text) Then
StringToLen(m_DirectCutPage.m_ManualAxesMove.FeedTxBx.Text, dFeed)
Else
EgtTdbSetCurrTool(m_MainWindow.m_CurrentProjectPageUC.ToolTxBx.Text)
EgtTdbGetCurrToolParam(MCH_TP.FEED, dFeed)
ExecuteMDICommand(CurrentBtn, sLuaFileName)
''--- NUOVA VERSIONE ---
'If String.IsNullOrWhiteSpace(sLuaFileName) Then Return
'Dim CmdString As String = String.Empty
'Dim b2Start As Boolean = False
'Dim EActive As Boolean = False
'Dim ENumber As String = String.Empty
'Dim EValue As String = String.Empty
'Dim EType As String = 0
'Dim ENumber2 As String = String.Empty
'Dim EValue2 As String = String.Empty
'Dim EType2 As String = 0
'' eseguo la lettura del file .lua associato al comando
'ExecuteDirectCmdLua(sLuaFileName, CmdString, b2Start, EActive, ENumber, EValue, EType, ENumber2, EValue2, EType2)
''--- NUOVA VERSIONE ---
''-------------- FEED -------------
'Dim dFeed As Double = 0
'' recupero il parametroo di Feed dalla pagina dei tagli diretti
'If Not String.IsNullOrWhiteSpace(m_DirectCutPage.m_ManualAxesMove.FeedTxBx.Text) Then
' StringToLen(m_DirectCutPage.m_ManualAxesMove.FeedTxBx.Text, dFeed)
'Else
' ' altrimenti setto l'utensile corrente e recupero il valore della Feed
' EgtTdbSetCurrTool(m_MainWindow.m_CurrentProjectPageUC.ToolTxBx.Text)
' EgtTdbGetCurrToolParam(MCH_TP.FEED, dFeed)
'End If
'' salvo il valore nel file lua
'EgtLuaSetGlobNumVar("CMD.F", dFeed)
''-------------- SPEED ------------
'Dim dSpeed As Double = 0
'If Not String.IsNullOrWhiteSpace(m_DirectCutPage.m_ManualAxesMove.SpeedTxBx.Text) Then
' StringToDouble(m_DirectCutPage.m_ManualAxesMove.SpeedTxBx.Text, dSpeed)
'Else
' EgtTdbSetCurrTool(m_MainWindow.m_CurrentProjectPageUC.ToolTxBx.Text)
' EgtTdbGetCurrToolParam(MCH_TP.SPEED, dSpeed)
'End If
'EgtLuaSetGlobNumVar("CMD.S", dSpeed)
''------------- AXES --------------
'Dim dL1, dL2, dL3, dR1, dR2 As Double
'm_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2)
'' salvo i valori degli assi nelle variabili del file lua
'EgtLuaSetGlobNumVar("CMD.L1", dL1)
'EgtLuaSetGlobNumVar("CMD.L2", dL2)
'EgtLuaSetGlobNumVar("CMD.L3", dL3)
'EgtLuaSetGlobNumVar("CMD.R1", dR1)
'EgtLuaSetGlobNumVar("CMD.R2", dR2)
'EgtLuaSetGlobBoolVar("CMD.INCHES", m_MainWindow.m_CNCommunication.GetMachineInInches())
'' eseguo la funzione principale del file lua chiamato (function CmdString)
'EgtLuaCallFunction("CmdString")
'' Leggo variabili
'Dim CmdString As String = String.Empty
'Dim b2Start As Boolean = False
'Dim EActive As Boolean = False
'Dim ENumber As String = String.Empty
'Dim EValue As String = String.Empty
'Dim EType As String = 0
'Dim ENumber2 As String = String.Empty
'Dim EValue2 As String = String.Empty
'Dim EType2 As String = 0
'EgtLuaGetGlobStringVar("CMD.CMDSTRING", CmdString)
'EgtLuaGetGlobBoolVar("CMD.DOUBLESTART", b2Start)
'EgtLuaGetGlobBoolVar("CMD.EACTIVE", EActive)
'EgtLuaGetGlobStringVar("CMD.ENUMBER", ENumber)
'EgtLuaGetGlobStringVar("CMD.EVALUE", EValue)
'EgtLuaGetGlobStringVar("CMD.ETYPE", EType)
'EgtOutLog("ENUMBER: " & ENumber & "EVALUE: " & EValue & "ETYPE: " & EType)
'EgtLuaGetGlobStringVar("CMD.ENUMBER2", ENumber2)
'EgtLuaGetGlobStringVar("CMD.EVALUE2", EValue2)
'EgtLuaGetGlobStringVar("CMD.ETYPE2", EType2)
'EgtOutLog("ENUMBER2: " & ENumber2 & "EVALUE2: " & EValue2 & "ETYPE2: " & EType2)
'' Reset lua
'EgtLuaResetGlobVar("CmdString")
'EgtLuaResetGlobVar("CMD")
'' Log del comando
'EgtOutLog("CmdString=" & If(Not String.IsNullOrEmpty(CmdString), CmdString, "") & " b2Start=" & b2Start.ToString())
'' comunico i dati calcolati al PLC (quidni ignoro eventuali comandi MDI), scrivo messaggio MDI
'If EActive Then
' Select Case m_MainWindow.m_CNCommunication.m_nNCType
' Case 1, 2
' If m_CN.m_NewVariable And m_MainWindow.m_CNCommunication.m_nNCType = 2 Then
' ' solo per Flexium
' m_CN.DPlcVariables_WriteVariables(ENumber, EValue)
' If Not IsNothing(ENumber2) And Not IsNothing(EValue2) Then
' m_CN.DPlcVariables_WriteVariables(ENumber2, EValue2)
' End If
' ' altrimenti scrittura delle variabili E
' Else
' m_CN.DVariables_WriteVariables2(ENumber, EValue)
' End If
' Return
' Case 3
' If m_MainWindow.m_DirectCutPageUC.m_NewMachineButtonsType Then
' ' scrivo prima variabile
' Select Case CShort(EType)
' Case 1
' m_CN.DVariables_WriteVariables3(ENumber, CShort(EType), CInt(EValue), 0, 0, "")
' EgtOutLog("ENumber= " & ENumber & "EType= " & CShort(EType) & "EValue= " & CInt(EValue))
' Case 2
' m_CN.DVariables_WriteVariables3(ENumber, CShort(EType), 0, CLng(EValue), 0, "")
' EgtOutLog("ENumber= " & ENumber & "EType= " & CShort(EType) & "EValue= " & CLng(EValue))
' Case 3
' Dim d As Double = 0
' StringToDouble(EValue, d)
' m_CN.DVariables_WriteVariables3(ENumber, CShort(EType), 0, 0, d, "")
' EgtOutLog("ENumber= " & ENumber & "EType= " & CShort(EType) & "EValue= " & d)
' Case 4
' m_CN.DVariables_WriteVariables3(ENumber, CShort(EType), 0, 0, 0, EValue)
' EgtOutLog("ENumber= " & ENumber & "EType= " & CShort(EType) & "EValue= " & EValue)
' End Select
' EgtOutLog("dopo scrittura prima variabile")
' If Not IsNothing(EType2) AndAlso CShort(EType) > 0 Then
' System.Threading.Thread.Sleep(100)
' ' scrivo seconda variabile
' Select Case CShort(EType2)
' Case 1
' m_CN.DVariables_WriteVariables3(ENumber2, CShort(EType2), CInt(EValue2), 0, 0, "")
' EgtOutLog("ENumber2= " & ENumber2 & "EType2= " & CShort(EType2) & "EValue2= " & CInt(EValue2))
' Case 2
' m_CN.DVariables_WriteVariables3(ENumber2, CShort(EType2), 0, CLng(EValue2), 0, "")
' EgtOutLog("ENumber2= " & ENumber2 & "EType2= " & CShort(EType2) & "EValue2= " & CLng(EValue2))
' Case 3
' Dim d As Double = 0
' StringToDouble(EValue2, d)
' m_CN.DVariables_WriteVariables3(ENumber2, CShort(EType2), 0, 0, d, "")
' EgtOutLog("ENumber2= " & ENumber2 & "EType2= " & CShort(EType2) & "EValue2= " & d)
' Case 4
' m_CN.DVariables_WriteVariables3(ENumber2, CShort(EType2), 0, 0, 0, EValue2)
' EgtOutLog("ENumber2= " & ENumber2 & "EType2= " & CShort(EType2) & "EValue2= " & EValue2)
' End Select
' EgtOutLog("dopo scrittura seconda variabile")
' End If
' Return
' End If
' End Select
'End If
'Dim nResult As Short
'' Imposto modalità MDI per controlli num
'Select Case m_MainWindow.m_CNCommunication.m_nNCType
' Case 1, 2
' nResult = m_CN.DGeneralFunctions_WriteCncMode(2)
' Case 3
' 'Per il siemens non devo fare nulla
'End Select
'm_CN.sz_ManualDataInput = CmdString
'm_CN.MDI_command()
'Select Case m_MainWindow.m_CNCommunication.m_nNCType
' Case 1, 2
' System.Threading.Thread.Sleep(300)
' m_CN.DGeneralFunctions_CycleStart()
' Case 3
' 'Per il siemens non devo fare nulla
'End Select
'If b2Start Then
' System.Threading.Thread.Sleep(800)
' m_CN.DGeneralFunctions_CycleStart()
'End If
'System.Threading.Thread.Sleep(300)
'nResult = m_CN.DGeneralFunctions_WriteCncMode(7) ' Modalità manuale
' se non ha stato e quindi è un bottone normale, tolgo il check
If StateFlagArray(nIndex) = BTN_STATE_NOTHING Then
CurrentBtn.IsChecked = False
End If
EgtLuaSetGlobNumVar("CMD.F", dFeed)
Dim dSpeed As Double = 0
If Not String.IsNullOrWhiteSpace(m_DirectCutPage.m_ManualAxesMove.SpeedTxBx.Text) Then
StringToDouble(m_DirectCutPage.m_ManualAxesMove.SpeedTxBx.Text, dSpeed)
Else
EgtTdbSetCurrTool(m_MainWindow.m_CurrentProjectPageUC.ToolTxBx.Text)
EgtTdbGetCurrToolParam(MCH_TP.SPEED, dSpeed)
End If
EgtLuaSetGlobNumVar("CMD.S", dSpeed)
Dim dL1, dL2, dL3, dR1, dR2 As Double
m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2)
EgtLuaSetGlobNumVar("CMD.L1", dL1)
EgtLuaSetGlobNumVar("CMD.L2", dL2)
EgtLuaSetGlobNumVar("CMD.L3", dL3)
EgtLuaSetGlobNumVar("CMD.R1", dR1)
EgtLuaSetGlobNumVar("CMD.R2", dR2)
EgtLuaSetGlobBoolVar("CMD.INCHES", m_MainWindow.m_CNCommunication.GetMachineInInches())
EgtLuaCallFunction("CmdString")
' Leggo variabili
End Sub
Friend Sub ExecuteMDICommand(CurrentBtn As Primitives.ToggleButton, sLuaFileName As String)
If String.IsNullOrWhiteSpace(sLuaFileName) Then Return
Dim CmdString As String = String.Empty
Dim b2Start As Boolean = False
Dim EActive As Boolean = False
@@ -162,31 +329,21 @@ Public Class MachineButtonsUC
Dim ENumber2 As String = String.Empty
Dim EValue2 As String = String.Empty
Dim EType2 As String = 0
EgtLuaGetGlobStringVar("CMD.CMDSTRING", CmdString)
EgtLuaGetGlobBoolVar("CMD.DOUBLESTART", b2Start)
EgtLuaGetGlobBoolVar("CMD.EACTIVE", EActive)
EgtLuaGetGlobStringVar("CMD.ENUMBER", ENumber)
EgtLuaGetGlobStringVar("CMD.EVALUE", EValue)
EgtLuaGetGlobStringVar("CMD.ETYPE", EType)
EgtOutLog("ENUMBER: " & ENumber & "EVALUE: " & EValue & "ETYPE: " & EType)
EgtLuaGetGlobStringVar("CMD.ENUMBER2", ENumber2)
EgtLuaGetGlobStringVar("CMD.EVALUE2", EValue2)
EgtLuaGetGlobStringVar("CMD.ETYPE2", EType2)
EgtOutLog("ENUMBER2: " & ENumber2 & "EVALUE2: " & EValue2 & "ETYPE2: " & EType2)
' Reset lua
EgtLuaResetGlobVar("CmdString")
EgtLuaResetGlobVar("CMD")
' Log del comando
EgtOutLog("CmdString=" & CmdString & " b2Start=" & b2Start.ToString())
' eseguo la lettura del file .lua associato al comando
ExecuteDirectCmdLua(sLuaFileName, CmdString, b2Start, EActive, ENumber, EValue, EType, ENumber2, EValue2, EType2)
' comunico i dati calcolati al PLC (quidni ignoro eventuali comandi MDI), scrivo messaggio MDI
If EActive Then
Select Case m_MainWindow.m_CNCommunication.m_nNCType
Case 1, 2
If m_CN.m_NewVariable And m_MainWindow.m_CNCommunication.m_nNCType = 2 Then
' solo per Flexium
m_CN.DVariables_WriteVariables2(ENumber, EValue)
Else
m_CN.DPlcVariables_WriteVariables(ENumber, EValue)
If Not IsNothing(ENumber2) And Not IsNothing(EValue2) Then
m_CN.DPlcVariables_WriteVariables(ENumber2, EValue2)
End If
' altrimenti scrittura delle variabili E
Else
m_CN.DVariables_WriteVariables2(ENumber, EValue)
End If
Return
Case 3
@@ -236,9 +393,10 @@ Public Class MachineButtonsUC
End If
Dim nResult As Short
' Imposto modalità MDI per controlli num
Select Case m_MainWindow.m_CNCommunication.m_nNCType
Case 1, 2
nResult = m_CN.DGeneralFunctions_WriteCncMode(2) ' Modalità MDI per controlli num
nResult = m_CN.DGeneralFunctions_WriteCncMode(2)
Case 3
'Per il siemens non devo fare nulla
End Select
@@ -253,19 +411,83 @@ Public Class MachineButtonsUC
End Select
If b2Start Then
System.Threading.Thread.Sleep(300)
System.Threading.Thread.Sleep(800)
m_CN.DGeneralFunctions_CycleStart()
End If
System.Threading.Thread.Sleep(300)
nResult = m_CN.DGeneralFunctions_WriteCncMode(7) ' Modalità manuale
' se non ha stato e quindi è un bottone normale, tolgo il check
If StateFlagArray(nIndex) = BTN_STATE_NOTHING Then
CurrentBtn.IsChecked = False
End If
End Sub
' questa è una copia della funzione presente nel codice ControlsMachineButtonUC.xaml.vb
Friend Sub ExecuteDirectCmdLua(LuaFileName As String, ByRef CmdString As String, ByRef b2Start As Boolean, ByRef EActive As Boolean, ByRef ENumber As String, ByRef EValue As String, ByRef EType As String, ByRef ENumber2 As String, ByRef EValue2 As String, ByRef EType2 As String)
'Dim sBaseDir As String = m_MainWindow.m_CurrentMachine.sMachDir & "\DirectCmd\"
If EgtLuaExecFile(LuaFileName) Then
EgtOutLog("Lua " & LuaFileName & " eseguito")
Else
EgtOutLog("Lua " & LuaFileName & " non eseguito")
End If
Dim dFeed As Double = 0
If Not String.IsNullOrWhiteSpace(m_DirectCutPage.m_ManualAxesMove.FeedTxBx.Text) Then
StringToLen(m_DirectCutPage.m_ManualAxesMove.FeedTxBx.Text, dFeed)
Else
EgtTdbSetCurrTool(m_MainWindow.m_CurrentProjectPageUC.ToolTxBx.Text)
EgtTdbGetCurrToolParam(MCH_TP.FEED, dFeed)
End If
EgtLuaSetGlobNumVar("CMD.F", dFeed)
Dim dSpeed As Double = 0
If Not String.IsNullOrWhiteSpace(m_DirectCutPage.m_ManualAxesMove.SpeedTxBx.Text) Then
StringToDouble(m_DirectCutPage.m_ManualAxesMove.SpeedTxBx.Text, dSpeed)
Else
EgtTdbSetCurrTool(m_MainWindow.m_CurrentProjectPageUC.ToolTxBx.Text)
EgtTdbGetCurrToolParam(MCH_TP.SPEED, dSpeed)
End If
EgtLuaSetGlobNumVar("CMD.S", dSpeed)
Dim dL1, dL2, dL3, dR1, dR2 As Double
m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2)
EgtLuaSetGlobNumVar("CMD.L1", dL1)
EgtLuaSetGlobNumVar("CMD.L2", dL2)
EgtLuaSetGlobNumVar("CMD.L3", dL3)
EgtLuaSetGlobNumVar("CMD.R1", dR1)
EgtLuaSetGlobNumVar("CMD.R2", dR2)
EgtLuaSetGlobBoolVar("CMD.INCHES", m_MainWindow.m_CNCommunication.GetMachineInInches())
EgtLuaCallFunction("CmdString")
' Leggo variabili
CmdString = String.Empty
EgtLuaGetGlobStringVar("CMD.CMDSTRING", CmdString)
b2Start = False
EgtLuaGetGlobBoolVar("CMD.DOUBLESTART", b2Start)
EActive = False
EgtLuaGetGlobBoolVar("CMD.EACTIVE", EActive)
ENumber = String.Empty
EgtLuaGetGlobStringVar("CMD.ENUMBER", ENumber)
EValue = String.Empty
EgtLuaGetGlobStringVar("CMD.EVALUE", EValue)
EType = String.Empty
EgtLuaGetGlobStringVar("CMD.ETYPE", EType)
EgtOutLog("ENUMBER: " & ENumber & " EVALUE: " & EValue & " ETYPE: " & EType)
ENumber2 = String.Empty
EgtLuaGetGlobStringVar("CMD.ENUMBER2", ENumber2)
EValue2 = String.Empty
EgtLuaGetGlobStringVar("CMD.EVALUE2", EValue2)
EType2 = String.Empty
EgtLuaGetGlobStringVar("CMD.ETYPE2", EType2)
EgtOutLog("ENUMBER2: " & ENumber2 & " EVALUE2: " & EValue2 & " ETYPE2: " & EType2)
' Reset lua
EgtLuaResetGlobVar("CmdString")
EgtLuaResetGlobVar("CMD")
' Log del comando
EgtOutLog("CmdString=" & If(Not String.IsNullOrEmpty(CmdString), CmdString, "") &
" b2Start=" & b2Start.ToString() &
" EActive=" & EActive.ToString &
" ENumber=" & If(Not String.IsNullOrEmpty(ENumber), ENumber, "") &
" EValue=" & If(Not String.IsNullOrEmpty(EValue), EValue, "") &
" EType=" & If(Not String.IsNullOrEmpty(EType), CInt(EType).ToString, "") &
" ENumber2=" & If(Not String.IsNullOrEmpty(ENumber2), ENumber2, "") &
" EValue2=" & If(Not String.IsNullOrEmpty(EValue2), EValue2, "") &
" EType2=" & If(Not String.IsNullOrEmpty(EType2), CInt(EType2).ToString, ""))
End Sub
Friend Sub SpindleStateChanged(SpindleState As Boolean)
Dim nIndex As Integer = Array.IndexOf(StateFlagArray, BTN_STATE_SPINDLE)
If nIndex = -1 Then Return
@@ -470,6 +692,37 @@ Public Class MachineButtonsUC
End If
End Sub
Friend Sub DoorStateChanged(DoorState As Integer)
' recupero le asscociazioni con i bottoni
Dim nIndex As Integer = Array.IndexOf(StateFlagArray, BTN_STATE_DOOR_OPENED)
If nIndex = -1 Then Return
' bottone di apertura porte
Dim DoorOpenedButton As Primitives.ToggleButton = GetToggleButton(nIndex + 1)
nIndex = Array.IndexOf(StateFlagArray, BTN_STATE_DOOR_CLOSED)
If nIndex = -1 Then Return
' bottone di chiusura porte
Dim DoorClosedButton As Primitives.ToggleButton = GetToggleButton(nIndex + 1)
' modifico il colore dei bottoni
If Not IsNothing(DoorState) Then
Select Case DoorState
Case 0
DoorClosedButton.Background = Application.Current.FindResource("OmagCut_Red")
Case 1, 2
DoorClosedButton.Background = Application.Current.FindResource("OmagCut_LightGray")
End Select
End If
If Not IsNothing(DoorState) Then
Select Case DoorState
Case 0
DoorOpenedButton.Background = Application.Current.FindResource("OmagCut_LightGray")
Case 1
DoorOpenedButton.Background = Application.Current.FindResource("OmagCut_Yellow")
Case 2
DoorOpenedButton.Background = Application.Current.FindResource("OmagCut_Green")
End Select
End If
End Sub
Private Function GetToggleButton(ByVal nIndex As Integer) As Primitives.ToggleButton
Select Case nIndex
Case 1
+1 -1
View File
@@ -69,7 +69,7 @@
<ComboBox Name="MaterailCmBx" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="4" Style="{StaticResource OmagCut_ComboBox}" Margin="6,0,6,0">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" Style="{StaticResource OmagCut_LowerCaseCharacterTextBlock}"/>
<TextBlock Text="{Binding Path=Name}" Style="{StaticResource OmagCut_LowerCaseCharacterTextBlock}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
+341 -179
View File
@@ -23,6 +23,9 @@ Public Class SingleCutAuto
Private m_RawOffsX As Double = 0
Private m_RawOffsY As Double = 0
Private m_RawKerf As Double = 0
' Lista dei materiali
Private m_MaterialsList As New List(Of MachiningMaterial)
' ---------------------------- Parametri per RAWPAR -------------------------------------
' Origine tavola e dati grezzo
@@ -42,9 +45,14 @@ Public Class SingleCutAuto
' ---------------------------- Parametri per UTENSILE -------------------------------------
Private m_ThickLama As Double
Private m_DiamLama As Double
' parametri calcolati da file DummySAW.lua
Private m_dSpeed As Double
Private m_dFeed As Double
' ---------------------------- Parametri per UTENSILE -------------------------------------
Private m_PrecSaw As String
Private m_PrecSawing As String
Private m_dPrecKerf As Double
' Parametri della lavorazione
Private m_bCutOk As Boolean = False
@@ -104,8 +112,11 @@ Public Class SingleCutAuto
End Sub
Private Sub SingleCut_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
' salvo le info della precdeente lama
' salvo il nome della lavorazione precedente in uso sulla macchina
m_PrecSaw = m_MainWindow.m_CurrentMachine.sCurrSawing
' salvo il nome della lama precedente
m_PrecSawing = m_MainWindow.m_CurrentMachine.sCurrSaw
' Attivo la pagina
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
m_bActive = True
@@ -132,11 +143,7 @@ Public Class SingleCutAuto
m_bRawOk = False
EgtOutLog("Error on TableRef1")
End If
' Dati del grezzo
If Not GetRawBox(m_ptRawMin, m_ptRawMax) Then
m_bRawOk = False
EgtOutLog("Error on RawBox")
End If
' Reset punto acquisito
m_bPointP1Ok = False
m_bPointP2Ok = False
@@ -149,30 +156,24 @@ Public Class SingleCutAuto
PointModeCmBx.SelectedIndex = PT_MODE.DRAW
SetCoordVisibility(True)
ShowCoord()
' carico la lista dei materiali lavorabili in macchina
m_MaterialsList.Clear()
For Each Material In m_MainWindow.m_CurrentMachine.Materials
m_MaterialsList.Add(New MachiningMaterial(Material.nId, Material.sName))
Next
' Carico l'elenco dei materiali presenti in macchina per l'assegnata lavorazione
MaterailCmBx.ItemsSource = m_MaterialsList
' seleziono il primo elemento della lista
If m_MaterialsList.Count > 0 Then MaterailCmBx.SelectedIndex = 0
' creazione grezzo
' creazione grezzo delle dimensioni della tavola
RawPart_Loded()
' Recupero le informazioni dell'utensile DummySaw
If EgtTdbSetCurrTool(DUMMY_SAW) Then
Dim dTemp As Double
EgtTdbGetCurrToolParam(MCH_TP.DIAM, dTemp)
DiamLamaTxBx.Text = LenToString(dTemp, 2)
EgtTdbGetCurrToolParam(MCH_TP.THICK, dTemp)
ThickLamaTxBx.Text = LenToString(dTemp, 2)
' m_MainWindow.m_CurrentMachine.sCurrSawing = DUMMY_SAW
End If
'------------------------------ PARAMETRI DI LAVORAZIONE -------------------------------------------
'' Assegno parametri di lavorazione
'DepthTxBx.Text = LenToString(m_dDepth, 1)
'LenghtTxBx.Text = LenToString(m_dLen, 1)
'OffsetTxBx.Text = LenToString(m_dOffset, 1)
'DirectionTxBx.Text = DoubleToString(m_dAngO - m_MainWindow.m_CurrentMachine.dDeltaC, 2)
'SideAngleTxBx.Text = DoubleToString(m_dAngV, 2)
'' Imposto check per considerare spessore lama
'SawThChBx.IsChecked = m_bSawTh
'------------------------------ PARAMETRI DI LAVORAZIONE -------------------------------------------
' Imposto l'utinsile DummySAW come utensile corrente
DummySAW_Loaded()
' imposto le velocitòà utensile
UpDateSpeedFeed()
' imposto di default l'affondamento lama pari allo spessore della lastra
m_dDepth = m_RawHeight
' Reset taglio e disabilito bottone esecuzione
m_bCutOk = False
@@ -185,7 +186,55 @@ Public Class SingleCutAuto
EgtDraw()
End Sub
Friend Sub RawPart_Loded()
Private Function DummySAW_Loaded() As Boolean
Dim bOk As Boolean = False
If EgtTdbSetCurrTool(DUMMY_SAW) Then
' Recupero Diametro lama
bOk = EgtTdbGetCurrToolParam(MCH_TP.TOTDIAM, m_DiamLama)
DiamLamaTxBx.Text = LenToString(m_DiamLama, 2)
' Recupero spessore lama
bOk = EgtTdbGetCurrToolParam(MCH_TP.THICK, m_ThickLama)
ThickLamaTxBx.Text = LenToString(m_ThickLama, 2)
' Assegno lama corrente
m_MainWindow.m_CurrentMachine.sCurrSaw = DUMMY_SAW
' Assegno lavorazione corrente
m_MainWindow.m_CurrentMachine.sCurrSawing = DUMMY_SAWING
' Assegno posizione di uscita
bOk =EgtTdbSetCurrToolParam(MCH_TP.EXIT_, "H1")
Else
DiamLamaTxBx.Text = "Tonto"
ThickLamaTxBx.Text = "Tonto"
' creo un utensile ausiliario
End If
Return bOk
End Function
Private Function UpDateSpeedFeed() As Boolean
Dim bOk As Boolean = True
EgtLuaCreateGlobTable("DUM")
EgtLuaSetGlobNumVar("DUM.ThRaw", m_RawHeight)
EgtLuaSetGlobNumVar("DUM.ThSaw", m_ThickLama)
EgtLuaSetGlobNumVar("DUM.DimSaw", m_DiamLama)
Dim tempMat As MachiningMaterial = DirectCast(MaterailCmBx.SelectedItem, MachiningMaterial)
EgtLuaSetGlobStringVar("DUM.Mat", tempMat.Name.Trim)
Dim nErr As Integer = 999
bOk = EgtLuaExecFile(m_MainWindow.GetCamAutoDir() & "\DummySAW.lua")
EgtLuaGetGlobNumVar("DUM.Speed", m_dSpeed)
EgtLuaGetGlobNumVar("DUM.Feed", m_dFeed)
EgtLuaResetGlobVar("DUM")
' passo i dati all'utensile
Dim bOkSet As Boolean = False
bOkSet = EgtTdbSetCurrToolParam(MCH_TP.FEED, m_dFeed)
bOkSet = bOkSet and EgtTdbSetCurrToolParam(MCH_TP.STARTFEED, m_dFeed)
bOkSet = bOkSet and EgtTdbSetCurrToolParam(MCH_TP.ENDFEED, m_dFeed)
bOkSet = bOkSet and EgtTdbSetCurrToolParam(MCH_TP.SPEED, m_dSpeed)
' salvo le informazioni dell'utensile
bOkSet = bOkSet and EgtTdbSaveCurrTool()
Return bOk
End Function
Friend Function RawPart_Loded() As Boolean
Dim bOk As Boolean = False
' Colori standard
GetPrivateProfileColor(S_RAWPART, K_RAWCOLOR, m_RawCol, m_MainWindow.GetIniFile())
GetPrivateProfileColor(S_RAWPART, K_KERFCOLOR, m_KerfCol, m_MainWindow.GetIniFile())
@@ -216,22 +265,73 @@ Public Class SingleCutAuto
m_RawHeight = If(StringToLen(ThickMatTxBx.Text, dVal), dVal, 20)
m_RawOffsX = 0
m_RawOffsY = 0
' recupero i lgrezzo corrente
' recupero il grezzo corrente
Dim nRawId As Integer = GetCurrentRaw()
If nRawId = GDB_ID.NULL And m_RawHeight > EPS_SMALL Then
m_CurrProjPage.m_nRawId = EgtAddRawPart(Point3d.ORIG(), m_RawLength + 2 * m_RawKerf, m_RawWidth + 2 * m_RawKerf, m_RawHeight, m_RawCol)
bOk = True
' se esiste e da cancellare
ElseIf m_RawHeight < EPS_SMALL Then
EgtRemoveRawPart(nRawId)
m_CurrProjPage.m_nRawId = GDB_ID.NULL
bOk = True
' Altrimenti lo modifico
Else
' salvo le informazioni del precedente grezzo
EgtGetInfo(nRawId, KEY_KERF, m_dPrecKerf)
m_CurrProjPage.m_nRawId = nRawId
EgtModifyRawPart(nRawId, Point3d.ORIG(), m_RawLength + 2 * m_RawKerf, m_RawWidth + 2 * m_RawKerf, m_RawHeight, m_RawCol)
bOk = True
End If
AdjustRawPartKerf()
AdjustRawPartPosition()
' Dati del grezzo
If Not GetRawBox(m_ptRawMin, m_ptRawMax) Then
m_bRawOk = False
EgtOutLog("Error on RawBox")
End If
' Aggiorno visualizzazione
EgtZoom(ZM.ALL)
End Sub
Return bOk
End Function
Private Function AdjustRawPartKerf() As Boolean
' Se non c'è il grezzo, esco
If m_CurrProjPage.m_nRawId = GDB_ID.NULL Then Return False
' Cancello eventuale vecchio contorno di kerf
Dim nKerfId As Integer = EgtGetFirstNameInGroup(m_CurrProjPage.m_nRawId, NAME_KERF)
EgtErase(nKerfId)
' box grezzo
Dim ptMin, ptMax As Point3d
GetRawBox(ptMin, ptMax)
ptMin.x += m_RawKerf
ptMin.y += m_RawKerf
ptMin.z = ptMax.z
ptMax.x -= m_RawKerf
ptMax.y -= m_RawKerf
' Creo il nuovo contorno del kerf
nKerfId = EgtCreateRectangle2P(m_CurrProjPage.m_nRawId, ptMin, ptMax, GDB_RT.GLOB)
EgtSetName(nKerfId, NAME_KERF)
EgtSetColor(nKerfId, m_KerfCol)
' Salvo il valore del kerf (sempre in mm)
EgtSetInfo(m_CurrProjPage.m_nRawId, KEY_KERF, m_RawKerf)
Return True
End Function
Private Function AdjustRawPartPosition() As Boolean
' Sistemo la posizione
Dim ptRef As New Point3d(m_RawOffsX - m_RawKerf, m_RawOffsY - m_RawKerf, m_MainWindow.m_CurrentMachine.dAdditionalTable)
If EgtMoveToCornerRawPart(m_CurrProjPage.m_nRawId, ptRef, MCH_CR.BL) Then
OkBtn.IsEnabled = True
m_CurrProjPage.ClearMessage()
Else
OkBtn.IsEnabled = False
m_CurrProjPage.SetErrorMessage(EgtMsg(MSG_RAWPARTPAGEUC + 47)) ' Errore nella posizione o dimensione del grezzo
End If
Return True
End Function
Friend Sub SingleCut_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
' Salvo i dati correnti
@@ -309,164 +409,200 @@ Public Class SingleCutAuto
EgtDraw()
End Sub
' selezione del tipo di acquisizione punti
Private Sub PointModeCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles PointModeCmBx.SelectionChanged
SetCoordVisibility(PointModeCmBx.SelectedIndex = PT_MODE.DRAW)
End Sub
'Private Sub Point1Btn_Click(sender As Object, e As RoutedEventArgs) Handles Point1Btn.Click
' ' Rimuovo eventuali crocette create acquisendo i punti nel disegno
' EgtEmptyGroup(m_nTempLay)
' ' Reset punto non acquisito
' m_bPointP1Ok = False
' ' Verifico configurazione tavola e grezzo
' If Not m_bRawOk Then Return
' acquisizione primo punto
Private Sub Point1Btn_Click(sender As Object, e As RoutedEventArgs) Handles Point1Btn.Click
' Rimuovo eventuali crocette create acquisendo i punti nel disegno
EgtEmptyGroup(m_nTempLay)
' Reset punto non acquisito
m_bPointP1Ok = False
' Verifico configurazione tavola e grezzo
If Not m_bRawOk Then Return
' ' Se acquisizione lama o laser
' If PointModeCmBx.SelectedIndex = PT_MODE.SAW Or PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' ' Recupero la posizione macchina
' Dim dL1, dL2, dL3, dR1, dR2 As Double
' If Not m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2) Then Return
' ' Ricavo dati lama corrente
' Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' ' Se punto da laser
' If PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' ' Imposto come testa corrente il laser (senza utensile ovviamente)
' If Not EgtSetCalcTool("", "H3", 1) Then Return
' ' Trasformo in posizione punta utensile in basso
' If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, dR1, dR2, True, m_ptTipP1) Then Return
' ' Ora imposto la lama corrente
' If Not EgtSetCalcTool(sSaw, "H1", 1) Then Return
' ' Altrimenti da lama
' Else
' ' Imposto la lama corrente
' If Not EgtSetCalcTool(sSaw, "H1", 1) Then Return
' ' Trasformo in posizione punta utensile in basso
' If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, dR1, dR2, True, m_ptTipP1) Then Return
' End If
' ' Calcolo direzione asse lama
' If Not EgtGetCalcToolDirFromAngles(dR1, dR2, m_vtToolP1) Then Return
' ' Porto il tip nell'origine tavola
' m_ptTipP1.ToLoc(New Frame3d(m_ptTabOri))
' m_bPointP1Ok = True
' ' Assegno angoli
' Dim dTLen, dTAngV, dTAngO As Double
' m_vtToolP1.ToSpherical(dTLen, dTAngV, dTAngO)
' m_dAngO = dTAngO + 90
' m_dAngV = 90 - dTAngV
' DirectionTxBx.Text = DoubleToString(m_dAngO - m_MainWindow.m_CurrentMachine.dDeltaC, 2)
' SideAngleTxBx.Text = DoubleToString(m_dAngV, 2)
' Se acquisizione lama o laser
If PointModeCmBx.SelectedIndex = PT_MODE.SAW Or PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' Recupero la posizione macchina
Dim dL1, dL2, dL3, dR1, dR2 As Double
If Not m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2) Then Return
' Ricavo dati lama corrente
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' Se punto da laser
If PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' Imposto come testa corrente il laser (senza utensile ovviamente)
If Not EgtSetCalcTool("", "H3", 1) Then Return
' Trasformo in posizione punta utensile in basso
If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, dR1, dR2, True, m_ptTipP1) Then Return
' Ora imposto la lama corrente
If Not EgtSetCalcTool(sSaw, "H1", 1) Then Return
' Altrimenti da lama
Else
' Imposto la lama corrente
If Not EgtSetCalcTool(sSaw, "H1", 1) Then Return
' Trasformo in posizione punta utensile in basso
If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, dR1, dR2, True, m_ptTipP1) Then Return
End If
' Calcolo direzione asse lama
If Not EgtGetCalcToolDirFromAngles(dR1, dR2, m_vtToolP1) Then Return
' Porto il tip nell'origine tavola
m_ptTipP1.ToLoc(New Frame3d(m_ptTabOri))
m_bPointP1Ok = True
' Assegno angoli
Dim dTLen, dTAngV, dTAngO As Double
m_vtToolP1.ToSpherical(dTLen, dTAngV, dTAngO)
m_dAngO = dTAngO + 90
m_dAngV = 90 - dTAngV
'DirectionTxBx.Text = DoubleToString(m_dAngO - m_MainWindow.m_CurrentMachine.dDeltaC, 2)
'SideAngleTxBx.Text = DoubleToString(m_dAngV, 2)
' ' Altrimenti punto da click di mouse
' Else
' ' Assegno punto selezionato nel disegno a m_ptTipP1
' m_ptTipP1 = m_ptPrev
' ' Porto il tip nell'origine tavola
' m_ptTipP1.ToLoc(New Frame3d(m_ptTabOri))
' m_bPointP1Ok = True
' ' Ricavo dati lama corrente
' Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' ' Imposto la lama corrente
' If Not EgtSetCalcTool(sSaw, "H1", 1) Then Return
' End If
' Altrimenti punto da click di mouse
Else
' Assegno punto selezionato nel disegno a m_ptTipP1
m_ptTipP1 = m_ptPrev
' Porto il tip nell'origine tavola
m_ptTipP1.ToLoc(New Frame3d(m_ptTabOri))
m_bPointP1Ok = True
' Ricavo dati lama corrente
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' Imposto la lama corrente
If Not EgtSetCalcTool(sSaw, "H1", 1) Then Return
End If
' ' Disegno il taglio
' CreateSingleCut()
' ' Disegno la macchina nella sua posizione reale
' SetMachineInCurrPos()
' m_MainWindow.m_DirectCutPageUC.m_bShowMachine = True
' EgtSetMachineLook(m_MainWindow.m_DirectCutPageUC.m_nMachLook)
' EgtDraw()
' ' Seleziono il bottone per indicare che il primo punto è stato acquisito
' Point1Btn.IsChecked = True
' ' Abilito e deseleziono secondo punto
' Point2Btn.IsEnabled = True
' Point2Btn.IsChecked = False
' ' Annullo secondo punto selezionato
' m_bPointP2Ok = False
'End Sub
' se già esiste un secondo punto allora costruisco il nuovo taglio
If m_bPointP2Ok Then
' Se il secondo punto non coincide con il primo, disegno il taglio
Dim vtDiff As Vector3d = m_ptTipP2 - m_ptTipP1
vtDiff.z = 0
Dim dLen As Double
Dim dAngVertDeg As Double
Dim dAngOrizzDeg As Double
vtDiff.ToSpherical(dLen, dAngVertDeg, dAngOrizzDeg)
If dLen > EPS_SMALL Then
m_dLen = dLen
m_dAngO = dAngOrizzDeg
'LenghtTxBx.Text = LenToString(m_dLen, 1)
'DirectionTxBx.Text = DoubleToString(m_dAngO - m_MainWindow.m_CurrentMachine.dDeltaC, 2)
CreateSingleCut()
' Disegno la macchina nella sua posizione reale
SetMachineInCurrPos()
m_MainWindow.m_DirectCutPageUC.m_bShowMachine = True
EgtSetMachineLook(m_MainWindow.m_DirectCutPageUC.m_nMachLook)
EgtDraw()
' Seleziono il bottone per indicare che il secondo punto è stato acquisito
Point2Btn.IsChecked = True
Else
Point1Btn_Click(sender, e)
' Deseleziono il bottone per indicare che il secondo punto non è stato acquisito perchè uguale al primo
Point2Btn.IsChecked = False
End If
Else
' Abilito e deseleziono secondo punto
Point2Btn.IsEnabled = True
Point2Btn.IsChecked = False
' Annullo secondo punto selezionato
m_bPointP2Ok = False
End If
'Private Sub Point2Btn_Click(sender As Object, e As RoutedEventArgs) Handles Point2Btn.Click
' ' Rimuovo eventuali crocette create acquisendo i punti nel disegno
' EgtEmptyGroup(m_nTempLay)
' ' Deseleziono il bottone (poichè si seleziona automaticamente) così nel caso ci sia un errore rimane deselezionato
' Point2Btn.IsChecked = False
' ' Reset punto non acquisito
' m_bPointP2Ok = False
' ' Verifico configurazione tavola e grezzo
' If Not m_bRawOk Then Return
' Disegno il taglio
CreateSingleCut()
' Disegno la macchina nella sua posizione reale
SetMachineInCurrPos()
m_MainWindow.m_DirectCutPageUC.m_bShowMachine = True
EgtSetMachineLook(m_MainWindow.m_DirectCutPageUC.m_nMachLook)
EgtDraw()
' Seleziono il bottone per indicare che il primo punto è stato acquisito
Point1Btn.IsChecked = True
' ' Se acquisizone lama o laser
' If PointModeCmBx.SelectedIndex = PT_MODE.SAW Or PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' ' Recupero la posizione macchina
' Dim dL1, dL2, dL3, dR1, dR2 As Double
' If Not m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2) Then Return
' ' Ricavo dati lama corrente
' Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' ' Se punto da laser
' If PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' ' Imposto come testa corrente il laser (senza utensile ovviamente)
' If Not EgtSetCalcTool("", "H3", 1) Then Return
' ' Trasformo in posizione punta utensile in basso
' If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, dR1, dR2, True, m_ptTipP2) Then Return
' ' Ora imposto la lama corrente
' If Not EgtSetCalcTool(sSaw, "H1", 1) Then Return
' ' Altrimenti da lama
' Else
' ' Imposto la lama corrente
' If Not EgtSetCalcTool(sSaw, "H1", 1) Then Return
' ' Trasformo in posizione punta utensile in basso
' If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, dR1, dR2, True, m_ptTipP2) Then Return
' End If
' ' Calcolo direzione asse lama
' If Not EgtGetCalcToolDirFromAngles(dR1, dR2, m_vtToolP2) Then Return
' ' Porto il tip nell'origine tavola
' m_ptTipP2.ToLoc(New Frame3d(m_ptTabOri))
' m_bPointP2Ok = True
' ' Assegno angoli
' Dim dTLen, dTAngV, dTAngO As Double
' m_vtToolP2.ToSpherical(dTLen, dTAngV, dTAngO)
' m_dAngV = 90 - dTAngV
' SideAngleTxBx.Text = DoubleToString(m_dAngV, 2)
'' Abilito e deseleziono secondo punto
'Point2Btn.IsEnabled = True
'Point2Btn.IsChecked = False
'' Annullo secondo punto selezionato
'm_bPointP2Ok = False
End Sub
' ' Altrimenti punto da click di mouse
' Else
' ' Assegno punto selezionato nel disegno a m_ptTipP2
' m_ptTipP2 = m_ptPrev
' ' Porto il tip nell'origine tavola
' m_ptTipP2.ToLoc(New Frame3d(m_ptTabOri))
' m_bPointP2Ok = True
' ' Ricavo dati lama corrente
' Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' ' Imposto la lama corrente
' If Not EgtSetCalcTool(sSaw, "H1", 1) Then Return
' End If
Private Sub Point2Btn_Click(sender As Object, e As RoutedEventArgs) Handles Point2Btn.Click
' Rimuovo eventuali crocette create acquisendo i punti nel disegno
EgtEmptyGroup(m_nTempLay)
' Deseleziono il bottone (poichè si seleziona automaticamente) così nel caso ci sia un errore rimane deselezionato
Point2Btn.IsChecked = False
' Reset punto non acquisito
m_bPointP2Ok = False
' ' Se il secondo punto non coincide con il primo, disegno il taglio
' Dim vtDiff As Vector3d = m_ptTipP2 - m_ptTipP1
' vtDiff.z = 0
' Dim dLen As Double
' Dim dAngVertDeg As Double
' Dim dAngOrizzDeg As Double
' vtDiff.ToSpherical(dLen, dAngVertDeg, dAngOrizzDeg)
' If dLen > EPS_SMALL Then
' m_dLen = dLen
' m_dAngO = dAngOrizzDeg
' LenghtTxBx.Text = LenToString(m_dLen, 1)
' DirectionTxBx.Text = DoubleToString(m_dAngO - m_MainWindow.m_CurrentMachine.dDeltaC, 2)
' CreateSingleCut()
' ' Disegno la macchina nella sua posizione reale
' SetMachineInCurrPos()
' m_MainWindow.m_DirectCutPageUC.m_bShowMachine = True
' EgtSetMachineLook(m_MainWindow.m_DirectCutPageUC.m_nMachLook)
' EgtDraw()
' ' Seleziono il bottone per indicare che il secondo punto è stato acquisito
' Point2Btn.IsChecked = True
' Else
' Point1Btn_Click(sender, e)
' ' Deseleziono il bottone per indicare che il secondo punto non è stato acquisito perchè uguale al primo
' Point2Btn.IsChecked = False
' End If
'End Sub
' Se acquisizone lama o laser
If PointModeCmBx.SelectedIndex = PT_MODE.SAW Or PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' Recupero la posizione macchina
Dim dL1, dL2, dL3, dR1, dR2 As Double
If Not m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2) Then Return
' Ricavo dati lama corrente
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' Se punto da laser
If PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' Imposto come testa corrente il laser (senza utensile ovviamente)
If Not EgtSetCalcTool("", "H3", 1) Then Return
' Trasformo in posizione punta utensile in basso
If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, dR1, dR2, True, m_ptTipP2) Then Return
' Ora imposto la lama corrente
If Not EgtSetCalcTool(sSaw, "H1", 1) Then Return
' Altrimenti da lama
Else
' Imposto la lama corrente
If Not EgtSetCalcTool(sSaw, "H1", 1) Then Return
' Trasformo in posizione punta utensile in basso
If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, dR1, dR2, True, m_ptTipP2) Then Return
End If
' Calcolo direzione asse lama
If Not EgtGetCalcToolDirFromAngles(dR1, dR2, m_vtToolP2) Then Return
' Porto il tip nell'origine tavola
m_ptTipP2.ToLoc(New Frame3d(m_ptTabOri))
m_bPointP2Ok = True
' Assegno angoli
Dim dTLen, dTAngV, dTAngO As Double
m_vtToolP2.ToSpherical(dTLen, dTAngV, dTAngO)
m_dAngV = 90 - dTAngV
'SideAngleTxBx.Text = DoubleToString(m_dAngV, 2)
' Altrimenti punto da click di mouse
Else
' Assegno punto selezionato nel disegno a m_ptTipP2
m_ptTipP2 = m_ptPrev
' Porto il tip nell'origine tavola
m_ptTipP2.ToLoc(New Frame3d(m_ptTabOri))
m_bPointP2Ok = True
' Ricavo dati lama corrente
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' Imposto la lama corrente
If Not EgtSetCalcTool(sSaw, "H1", 1) Then Return
End If
' Se il secondo punto non coincide con il primo, disegno il taglio
Dim vtDiff As Vector3d = m_ptTipP2 - m_ptTipP1
vtDiff.z = 0
Dim dLen As Double
Dim dAngVertDeg As Double
Dim dAngOrizzDeg As Double
vtDiff.ToSpherical(dLen, dAngVertDeg, dAngOrizzDeg)
If dLen > EPS_SMALL Then
m_dLen = dLen
m_dAngO = dAngOrizzDeg
'LenghtTxBx.Text = LenToString(m_dLen, 1)
'DirectionTxBx.Text = DoubleToString(m_dAngO - m_MainWindow.m_CurrentMachine.dDeltaC, 2)
CreateSingleCut()
' Disegno la macchina nella sua posizione reale
SetMachineInCurrPos()
m_MainWindow.m_DirectCutPageUC.m_bShowMachine = True
EgtSetMachineLook(m_MainWindow.m_DirectCutPageUC.m_nMachLook)
EgtDraw()
' Seleziono il bottone per indicare che il secondo punto è stato acquisito
Point2Btn.IsChecked = True
Else
Point1Btn_Click(sender, e)
' Deseleziono il bottone per indicare che il secondo punto non è stato acquisito perchè uguale al primo
Point2Btn.IsChecked = False
End If
End Sub
'Private Sub DepthTxBx_EgtClosed(sender As Object, e As EventArgs) Handles DepthTxBx.EgtClosed
' ' Verifico che l'affondamento impostato non sia superiore a quello massimo
@@ -557,6 +693,27 @@ Public Class SingleCutAuto
' EgtDraw()
'End Sub
' selezione del tipo di materiale
Private Sub MaterailCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles MaterailCmBx.SelectionChanged
' aggiorno i parametri di taglio
UpDateSpeedFeed()
End Sub
'Diametro lama
Private Sub DiamLamaTxBx_EgtClosed(sender As Object, e As EventArgs) Handles DiamLamaTxBx.EgtClosed
Dim Diameter As Double = 0
StringToLen(DiamLamaTxBx.Text, Diameter)
m_DiamLama = Diameter
DiamLamaTxBx.Text = LenToString(m_DiamLama, 2)
EgtTdbSetCurrToolParam(MCH_TP.DIAM, m_DiamLama)
' aggiorno i parametri di taglio
UpDateSpeedFeed()
' Disegno il taglio
CreateSingleCut()
SetMachineInCurrPos()
EgtDraw()
End Sub
'Spessore lama
Private Sub ThickLamaTxBl_EgtClosed(sender As Object, e As EventArgs) Handles ThickLamaTxBx.EgtClosed
' Recupero il valore dello spessore
@@ -565,6 +722,9 @@ Public Class SingleCutAuto
m_ThickLama = dThickness
ThickLamaTxBx.Text = LenToString(m_ThickLama, 2)
Dim Test As ToolsDbPageUC = m_MainWindow.m_MachinePageUC.m_ToolsDbPageUC
EgtTdbSetCurrToolParam(MCH_TP.THICK, m_ThickLama)
' aggiorno i parametri di taglio
UpDateSpeedFeed()
' Disegno il taglio
CreateSingleCut()
SetMachineInCurrPos()
@@ -578,6 +738,8 @@ Public Class SingleCutAuto
StringToLen(ThickMatTxBx.Text, dThickness)
m_RawHeight = dThickness
ThickMatTxBx.Text = LenToString(m_RawHeight, 2)
' aggiorno i parametri di taglio
UpDateSpeedFeed()
'aggiorno la dimesione del grezzo
RawPart_Loded()
' Disegno il taglio
@@ -721,7 +883,7 @@ Public Class SingleCutAuto
ptIns.z = dRawHeight
' Inserisco il pezzo nel grezzo
EgtAddPartToRawPart(nPartId, ptIns, m_MainWindow.m_CurrentProjectPageUC.m_nRawId)
' Inserisco la lavorazione
' Inserisco la lavorazione
m_bCutOk = AddMachinings(nPartId) AndAlso UpdateAllMachiningsToolpaths()
EgtSetCurrPhase(1)
' Eventuale eliminazione Home finale
+4 -2
View File
@@ -539,7 +539,7 @@ Public Class CNCommunication
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.BypassChanged(m_CN.bBypassState)
Else
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.SpindleStateChanged(m_CN.bSpindleState)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.CoolantStateChanged(m_CN.bCoolantState)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.CoolantStateChanged(m_CN.bCoolantState OrElse m_CN.bInternalCoolantState OrElse m_CN.bExternCoolantState)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.LaserStateChanged(m_CN.bLaserState)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.LaserTracStateChanged(m_CN.bLaserTracState)
If m_CN.Is_G24_active() Then
@@ -549,6 +549,7 @@ Public Class CNCommunication
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.ThreeAxisStateChanged(True)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.FiveAxisStateChanged(False)
End If
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.DoorStateChanged(m_CN.nDoorClosedState)
End If
End If
@@ -558,7 +559,7 @@ Public Class CNCommunication
If m_MainWindow.m_ActivePage = MainWindow.Pages.WorkInProgress Then
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.SpindleStateChanged(m_CN.bSpindleState)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.CoolantStateChanged(m_CN.bCoolantState)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.CoolantStateChanged(m_CN.bCoolantState OrElse m_CN.bInternalCoolantState OrElse m_CN.bExternCoolantState)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.LaserStateChanged(m_CN.bLaserState)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.LaserTracStateChanged(m_CN.bLaserTracState)
If m_CN.Is_G24_active() Then
@@ -568,6 +569,7 @@ Public Class CNCommunication
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.ThreeAxisStateChanged(True)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.FiveAxisStateChanged(False)
End If
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.DoorStateChanged(m_CN.nDoorClosedState)
End If
End Sub