Merge branch 'Features/Semplificazione_selezione_lavorazioni' into Features/Alzatine_e_Frontalini

This commit is contained in:
NicolaP
2021-07-19 12:40:04 +02:00
11 changed files with 76 additions and 146 deletions
+19
View File
@@ -699,6 +699,25 @@ Friend Module CamAuto
Return True
End Function
Friend Function IsExitPreCut(nOperId As Integer) As Boolean
' Deve essere una lavorazione
If Not EgtSetCurrMachining(nOperId) Then Return False
' Verifico presenza Info di PreCut
Return EgtExistsInfo(nOperId, INFO_MCH_EPC)
End Function
Friend Function RemoveAllExitPreCuts() As Boolean
Dim nOperId As Integer = EgtGetFirstOperation()
While nOperId <> GDB_ID.NULL
Dim nNextOperId As Integer = EgtGetNextOperation( nOperId)
If EgtGetType( nOperId) <> MCH_OY.DISP AndAlso EgtExistsInfo(nOperId, INFO_MCH_EPC) Then
EgtRemoveOperation( nOperId)
End If
nOperId = nNextOperId
End While
Return True
End Function
Private Function SetLuaStandardCamParams(Optional bDripOk As Boolean = True) As Boolean
Dim sSawMch As String = m_MainWindow.m_CurrentMachine.sCurrSawing
Dim sMillMch As String = m_MainWindow.m_CurrentMachine.sCurrMilling
+2
View File
@@ -73,6 +73,8 @@ Public Class SplitPageUC
' Deseleziono pezzi
EgtDeselectAll()
EgtZoom(ZM.ALL)
' Elimino eventuali pretagli su uscite
RemoveAllExitPreCuts()
' Se non sono in sola visualizzazione, faccio ordine automatico delle lavorazioni
If Not m_bShow Then
If m_MainWindow.m_CurrentMachine.WaterJettingActive Then ResetAllMachinings()
+2
View File
@@ -244,6 +244,8 @@ Module ConstGen
Public Const INFO_MCH_USER_SAL As String = "Usal"
' Info allungamento finale lavorazione imposto dall'utente
Public Const INFO_MCH_USER_EAL As String = "Ueal"
' Info lavorazione di tipo pretaglio sull'uscita
Public Const INFO_MCH_EPC As String = "EPC"
' Nome contorno taglio
Public Const NAME_PV_CUT As String = "CUT"
' Nome contorno pre-taglio
+1
View File
@@ -45,6 +45,7 @@ Module ConstIni
Public Const K_VIRTUALKEYBOARD As String = "VirtualKeyboard"
Public Const K_THEME As String = "Theme"
Public Const K_MANUAL_CUT As String = "ManualCut"
Public Const K_TEST As String = "Test"
Public Const S_LANGUAGES As String = "Languages"
Public Const K_LANGUAGE As String = "Language"
+5 -5
View File
@@ -89,7 +89,7 @@ Public Class DirectCutPageUC
m_ControlsMachineButton.SetValue(Grid.RowProperty, 1)
m_VacuumMachineButton.SetValue(Grid.RowProperty, 1)
Dim bCollpsedNewBottonsConsole As Boolean = False
Dim bCollapsedNewBottonsConsole As Boolean = False
m_NewMachineButtonsType = m_ControlsMachineButton.GetPrivateProfileMachineButtons(S_CONTROLMACHBUTTONS, "Button1", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, m_MainWindow.GetMachIniFile())
If Not m_NewMachineButtonsType Then
'Assegno MachineButtons alla pagina
@@ -97,7 +97,7 @@ Public Class DirectCutPageUC
ControlsMachineBtn.Visibility = Windows.Visibility.Collapsed
VacuumMachineBtn.Visibility = Windows.Visibility.Collapsed
' per le configurazioni diverse dalla Digitale5
bCollpsedNewBottonsConsole = True
bCollapsedNewBottonsConsole = True
End If
If GetPrivateProfileInt(S_NUMERICALCONTROL, K_TYPE, 0, m_MainWindow.GetMachIniFile()) = 0 Then
@@ -115,7 +115,7 @@ Public Class DirectCutPageUC
SawTestBtn.Content = EgtMsg(90207)
' nuovi bottoni 20/05/2021
If GetPrivateProfileInt(S_NCDATA, K_NEWCONSOLE, 0, m_MainWindow.GetMachIniFile()) = 1 And Not bCollpsedNewBottonsConsole Then
If GetPrivateProfileInt(S_NCDATA, K_NEWCONSOLE, 0, m_MainWindow.GetMachIniFile()) = 1 And Not bCollapsedNewBottonsConsole Then
XYBtn.Content = "X - Y"
ZBtn.Content = "Z"
BCBtn.Content = "B - C"
@@ -128,7 +128,7 @@ Public Class DirectCutPageUC
End Sub
Private Sub DirectCutPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
'------ NUOVI BOTTONI ----------
'------ INIZIO NUOVI BOTTONI ----------
' Lettura configurazione bottoni (per impostare l'uso del Joystick) da Ini di macchina
m_ButtonJogList.Clear()
Dim m_nCount As Integer = 1
@@ -164,8 +164,8 @@ Public Class DirectCutPageUC
End If
End While
' lo stato di questi comandi vieni carico dalla lettura del PLC (refresh)
'----------- FINE NUOVI BOTTONI------------
'-----------NUOVI BOTTONI------------
' Se rientro da simulazione
If m_ActiveDirectCutPage = DirectCutPages.SingleCut Then
LeftButtonGrid.Children.Add(m_SingleCut)
+7 -2
View File
@@ -296,8 +296,13 @@ Public Class AlarmsPageUC
EgtMdbSetGeneralParam(MCH_GP.EXTSAWARCMINRAD, dVal)
ExtArcMinRadTxBx.Text = LenToString(dVal, 2)
' Leggo se PreCutExit attivo (per taglio ceramico)
PreCutExitChBx.IsChecked =
(GetPrivateProfileInt(S_MACH_NEST, K_MACH_PRECUTEXIT, 0, m_MainWindow.GetMachIniFile()) <> 0)
Dim nPreCutExit As Integer = GetPrivateProfileInt(S_MACH_NEST, K_MACH_PRECUTEXIT, -1, m_MainWindow.GetMachIniFile())
If nPreCutExit = -1 Then
PreCutExitTxBl.Visibility = Visibility.Hidden
PreCutExitChBx.Visibility = Visibility.Hidden
Else
PreCutExitChBx.IsChecked = ( nPreCutExit <> 0)
End If
' Leggo angolo di fianco massimo arco interno
dVal = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_INTARCMAXSIDEANG, 45, m_MainWindow.GetMachIniFile())
EgtMdbSetGeneralParam(MCH_GP.INTSAWARCMAXSIDEANG, dVal)
+4 -3
View File
@@ -323,8 +323,8 @@ Class MainWindow
' Verifico abilitazione nesting automatico
m_bAutoNest = Not String.IsNullOrWhiteSpace(sNestKey)
' Recupero opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2305, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2305, 1, m_nKeyOptions)
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2307, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2307, 1, m_nKeyOptions)
' Verifico abilitazione prodotto
Dim bProd As Boolean = GetKeyOption(KEY_OPT.CUT_BASE)
' Inizializzazione generale di EgtInterface
@@ -433,7 +433,8 @@ Class MainWindow
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 Then
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
Else
m_CadCutPageUC.m_ProjectMgr.TestBtn.Visibility = Visibility.Visible
+2 -2
View File
@@ -62,5 +62,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.3.6.3")>
<Assembly: AssemblyFileVersion("2.3.6.3")>
<Assembly: AssemblyVersion("2.3.7.1")>
<Assembly: AssemblyFileVersion("2.3.7.1")>
+1 -1
View File
@@ -30,7 +30,7 @@
</Grid>
<!-- Definizione della Grid laterale -->
<Grid Grid.RowSpan="3">
<Grid Grid.RowSpan="3">
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="7*"/>
+27 -6
View File
@@ -280,6 +280,15 @@ Public Class CurrentProjectPageUC
'End If
End Sub
' questo metodo è direttamente richiamato in caso di selezione della regione sinistra della pagina
Private Sub ChooseMachining() Handles CurrProjGrid.MouseDown
' Apro pagina di selezione della lavorazione prima di chiudere il grezzo
Dim m_ChooseMachiningPage = New ChooseMachining(m_MainWindow)
If m_ChooseMachiningPage.DialogResult Then
End If
End Sub
Private Sub OnMyMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles CurrentProjectScene.OnMouseDownScene
If m_bSelectCurv Then
RaiseEvent OnMouseDownSceneSelCurv(sender, e)
@@ -423,16 +432,28 @@ Public Class CurrentProjectPageUC
EgtErase(EgtGetFirstNameInGroup(nFixtId, MACH_ADD_TABLE))
' Altezza eventuale tavola aggiuntiva
Dim dAddTable As Double = m_MainWindow.m_CurrentMachine.dAdditionalTable
' Se non esiste sovratavola, esco subito
' Se non richiesta sovratavola, non c'è altro da fare ed esco
If dAddTable < 10 * EPS_SMALL Then Return True
' Recupero box tavola
Dim ptMin, ptMax As Point3d
EgtGetTableArea(1, ptMin, ptMax)
' Aggiungo sovratavola nel gruppo dei bloccaggi
ptMax.z -= DELTAZ_ADDTAB
ptMin.z = ptMax.z
ptMax.z += dAddTable
Dim nAddTabId As Integer = EgtCreateSurfTmBBox(nFixtId, ptMin, ptMax, GDB_RT.GLOB)
' Nuova geometria
Dim nAddTabId As Integer = GDB_ID.NULL
' Se esiste geometria di riferimento
Dim nRefAddTabId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( EgtGetTableId( MAIN_TAB), "SOLID"), MACH_ADD_TABLE)
If nRefAddTabId <> GDB_ID.NULL Then
nAddTabId = EgtCopyGlob( nRefAddTabId, nFixtId)
EgtSetStatus( nAddTabId, GDB_ST.ON_)
EgtScale( nAddTabId, new Frame3d( ptMin), 1, 1, dAddTable / 10)
' altrimenti la creo
Else
' Aggiungo sovratavola nel gruppo dei bloccaggi
ptMax.z -= DELTAZ_ADDTAB
ptMin.z = ptMax.z
ptMax.z += dAddTable
nAddTabId = EgtCreateSurfTmBBox(nFixtId, ptMin, ptMax, GDB_RT.GLOB)
End If
' Sistemazioni finali
If nAddTabId = GDB_ID.NULL Then Return False
EgtSetName(nAddTabId, MACH_ADD_TABLE)
EgtSetColor(nAddTabId, New Color3d(150, 75, 0, 100), True)
+6 -127
View File
@@ -297,6 +297,7 @@ Public Class ProjectMgrUC
ptMid.x = (ptEnd.x + ptStart.x) / 2
ptMid.y = (ptEnd.y + ptStart.y) / 2
ptMid.z = (ptEnd.z + ptStart.z) / 2 + dDiam / 2
ptMid -= vtDirT * dThick
'--------------------------- Imposto la posizione della macchina ----------------------------
@@ -310,14 +311,15 @@ Public Class ProjectMgrUC
Dim nStat As Integer
Dim dC1, dB1, dC2, dB2 As Double
EgtGetCalcAngles(vtDirT, Vector3d.Z_AX(), nStat, dC1, dB1, dC2, dB2)
' 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
Dim dX, dY, dZ As Double
EgtGetCalcPositions(ptMid, dC1, dB1, nStat, dX, dY, dZ)
' verifica assi lineari
EgtVerifyOutstroke(dX, dY, dZ, dC1, dB1, nStat)
If nStat <> 0 Then
vtDirT.Rotate(Vector3d.Z_AX, 180)
vtDirT = - vtDirT
ptMid -= vtDirT * dThick
EgtGetCalcAngles(vtDirT, Vector3d.Z_AX(), nStat, dC1, dB1, dC2, dB2)
' calcolo la posizione degli assi lineari X, Y, Z ( correggere il punto ptMid.z sommando il raggio utensile)
EgtGetCalcPositions(ptMid, dC1, dB1, nStat, dX, dY, dZ)
@@ -617,13 +619,6 @@ Public Class ProjectMgrUC
' ------------------------------------------------ GENERA COMANDI CNC MOVIMENTO ------------------------------------------------
Private Sub ExecuteCommandCNC(ptMid As Point3d, dAngC As Double, dAngB As Double)
'If m_CurrNcComm.m_nNCType = 3 AndAlso m_CurrNcComm.m_CN.m_IsSiemensOne Then
' SiemensMoveAxis(ptMid, dAngC, dAngB)
' Return
'End If
Dim nTemp As Integer = 0
Dim dTemp As Double = 0
Dim CmdString As String = String.Empty
If Not EgtLuaExecFile(m_MainWindow.m_CurrentMachine.sMachDir() & "\DirectCmd\TestWork.lua") Then
Return
@@ -657,26 +652,8 @@ Public Class ProjectMgrUC
'----------- ASSEGNO POSIZIONE DI ARRIVO MACCHINA -----------
' Assegno valore ad ogni asse da muovere (in zero macchina)
Dim dAxVal As Double = ptMid.x
Dim bThickSaw As Boolean = True
If bThickSaw Then
If dAxVal > 0 Then
dAxVal += dThick
ElseIf dAxVal < 0 Then
dAxVal -= dThick
End If
End If
EgtLuaSetGlobNumVar("CMD.X_AXISMOVE", dAxVal)
dAxVal = ptMid.y
If bThickSaw Then
If dAxVal > 0 Then
dAxVal += dThick
ElseIf dAxVal < 0 Then
dAxVal -= dThick
End If
End If
EgtLuaSetGlobNumVar("CMD.Y_AXISMOVE", dAxVal)
dAxVal = ptMid.z
EgtLuaSetGlobNumVar("CMD.X_AXISMOVE", ptMid.x)
EgtLuaSetGlobNumVar("CMD.Y_AXISMOVE", ptMid.y)
EgtLuaSetGlobNumVar("CMD.Z_AXISMOVE", ptMid.z)
' imposto gli angoli
EgtLuaSetGlobNumVar("CMD.C_ANGMOVE", dAngC)
@@ -692,15 +669,6 @@ Public Class ProjectMgrUC
' Log del comando
EgtOutLog("CmdString=" & CmdString)
'' Eseguo in MDI
'm_CurrNcComm.m_CN.DGeneralFunctions_WriteCncMode(2) ' Modalità MDI
'System.Threading.Thread.Sleep(150)
'm_CurrNcComm.m_CN.sz_ManualDataInput = CmdString
'm_CurrNcComm.m_CN.MDI_command()
'System.Threading.Thread.Sleep(150)
'm_CurrNcComm.m_CN.DGeneralFunctions_CycleStart()
'm_CurrNcComm.m_CN.DGeneralFunctions_WriteCncMode(7) ' Modalità manuale
' Reset lua
EgtLuaResetGlobVar("CMD")
' Modifico stringa per inserire i newline ( in questo caso non c'è bisogno perchè tutto sulla stessa linea)
@@ -728,95 +696,6 @@ Public Class ProjectMgrUC
End Sub
Private Sub SiemensMoveAxis(ptMid As Point3d, dAngC As Double, dAngB As Double)
Dim nTemp As Integer = 0
Dim dTemp As Double = 0
Dim CmdString As String = String.Empty
EgtLuaExecFile(m_MainWindow.m_CurrentMachine.sMachDir() & "\DirectCmd\TestWork.lua")
'----------- DATI MOVIMENTO -----------
' imposto avanzamneto in rapido (non deve essere impostata feed e speed)
EgtLuaSetGlobBoolVar("CMD.G0", True)
'' fermo la rotazione dell'utensile (per sicure
'EgtLuaSetGlobNumVar("CMD.F", 30000)
'EgtLuaSetGlobNumVar("CMD.S", 0)
'----------- POSIZINE MACCHINA -----------
' Leggo gli assi rispetto allo 0 macchina
m_CurrNcComm.m_CN.set_OP_OM(0)
System.Threading.Thread.Sleep(50)
Dim dL1o, dL2o, dL3o As Double
m_CurrNcComm.GetLinearAxesPositions(dL1o, dL2o, dL3o)
Dim dR1, dR2 As Double
m_CurrNcComm.GetRotaryAxesPositions(dR1, dR2)
EgtLuaSetGlobNumVar("CMD.L1o", dL1o)
EgtLuaSetGlobNumVar("CMD.L2o", dL2o)
EgtLuaSetGlobNumVar("CMD.L3o", dL3o)
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)
'----------- ASSEGNO POSIZIONE DI ARRIVO MACCHINA -----------
' Assegno valore ad ogni asse da muovere (in zero macchina)
Dim dAxVal As Double = ptMid.x
Dim bThickSaw As Boolean = True
If bThickSaw Then
If dAxVal > 0 Then
dAxVal += dThick
ElseIf dAxVal < 0 Then
dAxVal -= dThick
End If
End If
EgtLuaSetGlobNumVar("CMD.X_AXISMOVE", dAxVal)
dAxVal = ptMid.y
If bThickSaw Then
If dAxVal > 0 Then
dAxVal += dThick
ElseIf dAxVal < 0 Then
dAxVal -= dThick
End If
End If
EgtLuaSetGlobNumVar("CMD.Y_AXISMOVE", dAxVal)
dAxVal = ptMid.z
EgtLuaSetGlobNumVar("CMD.Z_AXISMOVE", ptMid.z)
EgtLuaSetGlobNumVar("CMD.C_ANGMOVE", dAngC)
EgtLuaSetGlobNumVar("CMD.B_ANGMOVE", dAngB)
' Calcolo stringa di comando risultante
EgtLuaCallFunction("CmdString")
EgtLuaGetGlobStringVar("CMD.CMDSTRING", CmdString)
' Reset lua
EgtLuaResetGlobVar("CmdString")
EgtLuaResetGlobVar("CMD")
' Log del comando
EgtOutLog("CmdString=" & CmdString)
' Creo file
Dim sFilePath As String = m_MainWindow.GetCncDir() & "\MANAXMOV.MPF"
Try
File.WriteAllLines(sFilePath, New List(Of String)({CmdString, "M30"}), Text.Encoding.UTF8)
Catch ex As Exception
EgtOutLog("Eccezione creazione programma: " & ex.Message)
End Try
' Download programma (eventuali errori sono segnalati dalla funzione)
If m_CurrNcComm.m_CN.Download_NC_prog(sFilePath, "MANAXMOV") = 0 Then
EgtOutLog("Programma caricato")
System.Threading.Thread.Sleep(150)
Dim sActivateManAxMov As String = "/plc/OmagCUT_DB.CTRL.Start_Asup"
' Attivo variabile per esecuzione comando manuale
m_CurrNcComm.m_CN.DVariables_WriteVariables3(sActivateManAxMov, 1, 1, 0, 0, "")
End If
End Sub
' ------------------------------------------------ GENERA COMANDI CNC MOVIMENTO ------------------------------------------------
Private Sub TestBtn_Click(sender As Object, e As RoutedEventArgs) Handles TestBtn.Click