OmagCUT :
- aggiunta gestione lavorazione di lucidatura.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Module CamPolishing
|
||||
|
||||
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
|
||||
|
||||
Friend Function AddPolishings( sKitName As String, nContourId As Integer) As Boolean
|
||||
EgtLuaCreateGlobTable( "POLI")
|
||||
Dim nErr As Integer = 999
|
||||
Dim bOk As Boolean = EgtLuaExecFile( m_MainWindow.GetCamAutoDir() & "\Polishing.lua")
|
||||
bOk = bOk AndAlso EgtLuaGetGlobIntVar( "POLI.ERR", nErr) AndAlso nErr = 0
|
||||
EgtLuaSetGlobStringVar( "POLI.KITNAME", sKitName)
|
||||
EgtLuaSetGlobIntVar( "POLI.CNTID", nContourId)
|
||||
bOk = bOk AndAlso EgtLuaCallFunction( "POLI.Add")
|
||||
EgtLuaGetGlobIntVar( "POLI.ERR", nErr)
|
||||
EgtLuaResetGlobVar( "POLI")
|
||||
If nErr <> 0 Then
|
||||
bOk = False
|
||||
EgtOutLog("Error in Polishing.Add : " & nErr.ToString())
|
||||
End If
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Friend Function RemovePolishings() As Boolean
|
||||
EgtLuaCreateGlobTable( "POLI")
|
||||
Dim nErr As Integer = 999
|
||||
Dim bOk As Boolean = EgtLuaExecFile( m_MainWindow.GetCamAutoDir() & "\Polishing.lua")
|
||||
bOk = bOk AndAlso EgtLuaGetGlobIntVar( "POLI.ERR", nErr) AndAlso nErr = 0
|
||||
bOk = bOk AndAlso EgtLuaCallFunction( "POLI.Remove")
|
||||
EgtLuaGetGlobIntVar( "POLI.ERR", nErr)
|
||||
EgtLuaResetGlobVar( "POLI")
|
||||
If nErr <> 0 Then
|
||||
bOk = False
|
||||
EgtOutLog("Error in Polishing.Remove : " & nErr.ToString())
|
||||
End If
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
End Module
|
||||
@@ -17,7 +17,7 @@ Public Class Polishing
|
||||
Private m_ptRawMin As Point3d
|
||||
Private m_ptRawMax As Point3d
|
||||
' Parametri della lavorazione
|
||||
Private m_bCutOk As Boolean = False
|
||||
Private m_bPoliOk As Boolean = False
|
||||
' Lista dei kit di lucidatura disponibili
|
||||
Private m_KitList As New ObservableCollection(Of String)
|
||||
|
||||
@@ -56,9 +56,11 @@ Public Class Polishing
|
||||
PolishingCmBx.SelectedItem = sLastPolishing
|
||||
If PolishingCmBx.SelectedIndex < 0 Then PolishingCmBx.SelectedIndex = 0
|
||||
End If
|
||||
' Reset taglio e disabilito bottone esecuzione
|
||||
m_bCutOk = False
|
||||
UpdateSimulOkBtn()
|
||||
' Se non c'è kit selezionato, disabilito simulazione ed esecuzione
|
||||
If PolishingCmBx.SelectedIndex < 0 Then
|
||||
m_bPoliOk = False
|
||||
UpdateSimulOkBtn()
|
||||
End If
|
||||
' Aggiorno visualizzazione
|
||||
EgtDraw()
|
||||
End Sub
|
||||
@@ -68,8 +70,8 @@ Public Class Polishing
|
||||
If Not m_bSimul Then
|
||||
' Dichiaro sottopagina da non riattivare
|
||||
m_MainWindow.m_DirectCutPageUC.m_ActiveDirectCutPage = DirectCutPageUC.DirectCutPages.DirectCut
|
||||
' Rimuovo eventuale pezzo per taglio diretto
|
||||
EraseDirectCutPart()
|
||||
' Cancello eventuali lucidature
|
||||
RemovePolishings()
|
||||
' Riattivo eventuali lavorazioni presenti
|
||||
ActivateAllMachinings()
|
||||
' Abilito registrazione progetto modificato
|
||||
@@ -103,7 +105,7 @@ Public Class Polishing
|
||||
End Function
|
||||
|
||||
Private Sub UpdateSimulOkBtn()
|
||||
If m_bCutOk Then
|
||||
If m_bPoliOk Then
|
||||
SimulBtn.IsEnabled = True
|
||||
SimulBtn.Foreground = Brushes.Black
|
||||
OkBtn.IsEnabled = True
|
||||
@@ -122,13 +124,15 @@ Public Class Polishing
|
||||
Dim sKitName As String = m_KitList( nIndex)
|
||||
WritePrivateProfileString( S_DIRECTCUTS, K_DC_POLISH_NAME, sKitName, m_MainWindow.GetIniFile())
|
||||
' Calcolo la lucidatura
|
||||
|
||||
CreatePolishing( sKitName)
|
||||
' Aggiornamenti interfaccia utente e grafica
|
||||
UpdateSimulOkBtn()
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub SimulBtn_Click(sender As Object, e As RoutedEventArgs) Handles SimulBtn.Click
|
||||
' Verifico ci sia un taglio valido
|
||||
If Not m_bCutOk Then Return
|
||||
' Verifico ci sia una lucidatura valida
|
||||
If Not m_bPoliOk Then Return
|
||||
' Salvo il progetto con le lavorazioni
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
Dim sMchPath As String = m_MainWindow.GetTempDir() & "\" & "DirectProj.nge"
|
||||
@@ -147,8 +151,8 @@ Public Class Polishing
|
||||
#If TRIAL Then
|
||||
m_CurrProjPage.SetWarningMessage("Trial Version")
|
||||
#Else
|
||||
' Verifico ci sia un taglio valido
|
||||
If Not m_bCutOk Then Return
|
||||
' Verifico ci sia una lucidatura valida
|
||||
If Not m_bPoliOk Then Return
|
||||
' Salvo il progetto con le lavorazioni
|
||||
Dim sMchPath As String = m_MainWindow.GetTempDir() & "\" & "DirectProj.nge"
|
||||
m_MainWindow.m_CurrentProjectPageUC.SaveFile(sMchPath, False)
|
||||
@@ -175,34 +179,21 @@ Public Class Polishing
|
||||
m_MainWindow.m_DirectCutPageUC.LeftButtonGrid.Children.Remove(Me)
|
||||
End Sub
|
||||
|
||||
Private Function CreateFinishing() As Boolean
|
||||
Private Function CreatePolishing( sKitName As String) As Boolean
|
||||
' Verifico sia definita la lucidatura
|
||||
|
||||
If String.IsNullOrWhiteSpace( sKitName) Then
|
||||
m_bPoliOk = False
|
||||
Return False
|
||||
End If
|
||||
' Disattivo eventuali lavorazioni presenti
|
||||
DeactivateAllMachinings()
|
||||
' Creo nuovo pezzo per la lavorazione
|
||||
Dim nPartId = EgtCreateGroup(GDB_ID.ROOT)
|
||||
EgtSetName(nPartId, NAME_DIRECTCUT)
|
||||
Dim nLayerId = EgtCreateGroup(nPartId)
|
||||
EgtSetName(nLayerId, NAME_OUTLOOP)
|
||||
' Cancello eventuali precedenti lucidature
|
||||
RemovePolishings()
|
||||
' Creo la lavorazione
|
||||
|
||||
' Calcolo punto di inserimento nel grezzo
|
||||
'Dim ptMin, ptMax As Point3d
|
||||
'EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, ptMin, ptMax)
|
||||
'Dim ptIns As Point3d = ptMin + (m_ptTabOri - m_ptRawMin)
|
||||
'ptIns.z = dRawHeight
|
||||
' Inserisco il pezzo nel grezzo
|
||||
'EgtAddPartToRawPart(nPartId, ptIns, m_MainWindow.m_CurrentProjectPageUC.m_nRawId)
|
||||
' Inserisco la lavorazione
|
||||
'm_bCutOk = AddMachinings(nPartId) AndAlso UpdateAllMachiningsToolpaths()
|
||||
'EgtSetCurrPhase(1)
|
||||
' Eventuale eliminazione Home finale
|
||||
If Not m_MainWindow.m_CurrentMachine.bDirectCutsFinalHome Then
|
||||
RemoveFinalHome()
|
||||
End If
|
||||
UpdateSimulOkBtn()
|
||||
Return m_bCutOk
|
||||
Dim nKerfId As Integer = EgtGetFirstNameInGroup( m_CurrProjPage.m_nRawId, NAME_KERF)
|
||||
m_bPoliOk = AddPolishings( sKitName, nKerfId)
|
||||
EgtSetCurrPhase( 1)
|
||||
Return m_bPoliOk
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -166,6 +166,7 @@
|
||||
<Compile Include="AboutBox\AboutBoxWD.xaml.vb">
|
||||
<DependentUpon>AboutBoxWD.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CAM\CamPolishing.vb" />
|
||||
<Compile Include="DirectCuts\Polishing.xaml.vb">
|
||||
<DependentUpon>Polishing.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@@ -323,9 +323,10 @@ Public Class WorkInProgressPageUC
|
||||
Else
|
||||
EgtOutLog("Problems with Licence")
|
||||
' Box di avviso licenza con problemi : "Programma senza licenza. \n Caricala e riavvia il programma." "Errore"
|
||||
Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 5) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 6)
|
||||
Dim sKeyInfo As String = "" : EgtGetKeyInfo( sKeyInfo)
|
||||
Dim sText As String = sKeyInfo & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 5) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 6)
|
||||
Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1)
|
||||
MissingKeyWnd = New EgtMsgBox(m_MainWindow, EgtMsg(MSG_MISSINGKEYWD + 1), EgtMsg(MSG_MISSINGKEYWD + 5) & " " & EgtMsg(MSG_MISSINGKEYWD + 6), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.NULL)
|
||||
MissingKeyWnd = New EgtMsgBox(m_MainWindow, sTitle, sText, EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.NULL, 0, 2)
|
||||
If MissingKeyWnd.DialogResult = True Then
|
||||
' Apro dialogo per richiesta file licenza
|
||||
Dim LicDlg As New Microsoft.Win32.OpenFileDialog() With {
|
||||
|
||||
Reference in New Issue
Block a user