Generazione file CadCut dalla pagina della simulazione
This commit is contained in:
@@ -46,6 +46,10 @@ Module ConstIni
|
||||
Public Const K_THEME As String = "Theme"
|
||||
Public Const K_MANUAL_CUT As String = "ManualCut"
|
||||
Public Const K_TEST As String = "Test"
|
||||
Public Const K_SMARTMACHININGPAGE As String = "SmartMachiningPage"
|
||||
Public Const K_STARTPROGRAM As String = "StartProgram"
|
||||
Public Const K_GENERATECN As String = "GenerateCN"
|
||||
|
||||
|
||||
Public Const S_LANGUAGES As String = "Languages"
|
||||
Public Const K_LANGUAGE As String = "Language"
|
||||
|
||||
@@ -470,20 +470,15 @@ Public Class ProjectMgrUC
|
||||
' se abilitato e non è restart, lancio eventuale lua post-trasmissione
|
||||
If m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.SIMPLESTATISTICS) And nPhaseRestart = 0 Then
|
||||
m_MainWindow.ExecSentProgScript(False)
|
||||
''-------------------Avvio il Ciclo-Start-------------------------
|
||||
'Dim MyCicloStartWD As New CicloStartWD(m_MainWindow)
|
||||
'MyCicloStartWD.ShowDialog()
|
||||
''-------------------Avvio il Ciclo-Start-------------------------
|
||||
End If
|
||||
End If
|
||||
|
||||
'-------------------Avvio il Ciclo-Start-------------------------
|
||||
If GetPrivateProfileInt(S_GENERAL, "StartProgram", 0, m_MainWindow.GetIniFile()) <> 0 Then
|
||||
'------------------- INIZIO Avvio il Ciclo-Start-------------------------
|
||||
If GetPrivateProfileInt(S_GENERAL, K_STARTPROGRAM, 0, m_MainWindow.GetIniFile()) <> 0 Then
|
||||
Dim MyCicloStartWD As New CicloStartWD(m_MainWindow)
|
||||
MyCicloStartWD.ShowDialog()
|
||||
End If
|
||||
|
||||
'-------------------Avvio il Ciclo-Start-------------------------
|
||||
'------------------- FINE Avvio il Ciclo-Start-------------------------
|
||||
|
||||
' Altrimenti linea di produzione
|
||||
Else
|
||||
|
||||
@@ -142,7 +142,7 @@ Public Class RawPartPageUC
|
||||
GetPrivateProfileInt(S_RAWPART, K_SLABID, 0, m_MainWindow.GetIniFile()) <> 0)
|
||||
SlabIdBtn.Visibility = If(m_bSlabId, Windows.Visibility.Visible, Windows.Visibility.Collapsed)
|
||||
|
||||
m_SmartMachiningPage = GetPrivateProfileInt(S_GENERAL, "SmartMachiningPage", 0, m_MainWindow.GetIniFile()) <> 0
|
||||
m_SmartMachiningPage = GetPrivateProfileInt(S_GENERAL, K_SMARTMACHININGPAGE, 0, m_MainWindow.GetIniFile()) <> 0
|
||||
|
||||
' Imposto i messaggi letti dal file dei messaggi
|
||||
OutlineBtn.Content = EgtMsg(MSG_RAWPARTPAGEUC + 33) 'Rectangle - Rettangolo
|
||||
|
||||
@@ -240,6 +240,9 @@
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Name="GenerateCN_Btn" Grid.Column="1" Style="{DynamicResource OmagCut_GradientBlueIconButton}" Click="GenerateXPIUC_Click">
|
||||
<Image Source="{DynamicResource FrameMachiningImg}" Style="{StaticResource OmagCut_ButtonIcon}" />
|
||||
</Button>
|
||||
<Button Grid.Column="2" Style="{DynamicResource OmagCut_GradientBlueIconButton}" Click="ExitBtnUC_Click">
|
||||
<Image Source="{DynamicResource VImg}" Style="{StaticResource OmagCut_ButtonIcon}" />
|
||||
</Button>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib
|
||||
|
||||
Public Class SimulationPageUC
|
||||
' Riferimenti a pagine
|
||||
@@ -76,6 +77,12 @@ Public Class SimulationPageUC
|
||||
End If
|
||||
' Pulsante Play
|
||||
PlayPauseImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("/Resources/Play.png", UriKind.Relative))
|
||||
' abilito la visualizzazione del pulsante per la sola generazione del codice CN
|
||||
If GetPrivateProfileInt(S_GENERAL, K_GENERATECN, 0, m_MainWindow.GetIniFile()) <> 0 Then
|
||||
GenerateCN_Btn.Visibility = Visibility.Visible
|
||||
Else
|
||||
GenerateCN_Btn.Visibility = Visibility.Hidden
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub SimulationPage_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
@@ -559,6 +566,111 @@ Public Class SimulationPageUC
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub GenerateXPIUC_Click(sender As Object, e As RoutedEventArgs)
|
||||
Dim bOk As Boolean = True
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
' Elimino eventuale attrezzaggio da OmagOFFICE
|
||||
EgtEraseCurrSetup()
|
||||
' Verifico l'attrezzaggio degli utensili utilizzati
|
||||
Dim sMissingTools As String = String.Empty
|
||||
If Not VerifySetup(sMissingTools) Then
|
||||
m_CurrProjPage.SetErrorMessage(EgtMsg(90322) & " " & sMissingTools) 'Mancano gli utensili : ...
|
||||
Return
|
||||
End If
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
' Aggiorno flag per lavaggio
|
||||
m_CurrProjPage.UpdateWashingFlag()
|
||||
' Aggiorno flag per tastatura per tagli con angolo di fianco
|
||||
m_CurrProjPage.UpdateSideAngCutProbeFlag()
|
||||
' Se pezzi piani e non c'è ordine delle lavorazioni, ricalcolo tutto e ne faccio uno automatico
|
||||
Dim nPrjType As Integer = m_CurrProjPage.GetCurrentProjectType()
|
||||
Dim bDirectCut As Boolean = (GetDirectCutPart() <> GDB_ID.NULL)
|
||||
If nPrjType = CurrentProjectPageUC.PRJ_TYPE.FLATS And
|
||||
Not bDirectCut And
|
||||
Not m_CurrProjPage.GetOrderMachiningFlag() Then
|
||||
ResetAllMachinings()
|
||||
bOk = SortAllMachinings()
|
||||
If bOk Then
|
||||
m_CurrProjPage.SetOrderMachiningFlag()
|
||||
Dim bModif As Boolean = TestAllMachiningsForStrict()
|
||||
If bModif Then
|
||||
m_CurrProjPage.SetWarningMessage(EgtMsg(90321)) 'Ridotte alcune lavorazioni per evitare interferenze
|
||||
Else
|
||||
m_CurrProjPage.SetInfoMessage(EgtMsg(90399)) 'Aggiornate tutte le lavorazioni
|
||||
End If
|
||||
EgtDraw()
|
||||
End If
|
||||
End If
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
' Disabilito impostazione modificato
|
||||
EgtDisableModified()
|
||||
' Aggiorno le lavorazioni
|
||||
bOk = UpdateAllMachiningsToolpaths() And bOk
|
||||
' Aggiorno posizionamento ventose sui pezzi per eventuali tagli da sotto con lama
|
||||
bOk = UpdateVacuumsForDrip() And bOk
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
' Inserisco indice di progetto
|
||||
m_CurrProjPage.SetProjectIndexFlag()
|
||||
' Inserisco il materiale
|
||||
m_CurrProjPage.SetProjectMaterial()
|
||||
' Salvo il progetto con le lavorazioni
|
||||
Dim sMchPath As String = m_MainWindow.GetTempDir() & "\MachProj.nge"
|
||||
m_CurrProjPage.SaveFile(sMchPath)
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
' Se modalità Ufficio, copio il progetto ed esco
|
||||
If m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.OFFICE_TYPE) Then
|
||||
' Ripristino come fase corrente quella iniziale
|
||||
EgtSetCurrPhase(1)
|
||||
' Chiedo il nome del file esportato
|
||||
Dim MySaveNameWD As New SaveNameWD(m_MainWindow, SaveNameWD.SAVE_TYPE.PRJ_COPY)
|
||||
MySaveNameWD.ShowDialog()
|
||||
Return
|
||||
End If
|
||||
' Se presente ripartenza, ne chiedo conferma
|
||||
Dim nPhaseRestart As Integer = m_CurrProjPage.GetProjectNcRestart()
|
||||
If nPhaseRestart <> 0 Then
|
||||
' Confermi ripartenza dalla fase NNN ?
|
||||
Dim AskNcRestart As New EgtMsgBox(m_MainWindow, "", String.Format(EgtMsg(90326), nPhaseRestart),
|
||||
EgtMsgBox.Buttons.YES_NO_CANCEL, EgtMsgBox.Icons.NULL, 2)
|
||||
Select Case AskNcRestart.m_nPressedBtn
|
||||
Case 1 ' YES
|
||||
Case 2 ' NO
|
||||
EgtEnableModified()
|
||||
m_CurrProjPage.ResetProjectNcRestart()
|
||||
nPhaseRestart = 0
|
||||
EgtDisableModified()
|
||||
Case Else ' CANCEL
|
||||
Return
|
||||
End Select
|
||||
End If
|
||||
' Se abilitate, eseguo le stime
|
||||
If GetPrivateProfileInt(S_MACH_ESTIMATIONS, K_ENABLEEST, 0, m_MainWindow.GetMachIniFile()) <> 0 Then
|
||||
EgtEstimate(m_MainWindow.GetTempDir() & "\MachProj.html", "OmagCut ver." & m_MainWindow.GetVersion())
|
||||
End If
|
||||
' Genero file CNC (lancio anche se errore in precedenza) -> recupero la tavola corrente! CamAuto.GetCurrentTable()
|
||||
Dim nIndexTab As Integer = CamAuto.GetCurrentTable()
|
||||
Dim sIndexTab As String = String.Empty
|
||||
If nIndexTab > 0 Then
|
||||
sIndexTab = nIndexTab.ToString
|
||||
End If
|
||||
Dim sFileName As String = "CadCut" & sIndexTab
|
||||
Dim sCncPath As String = m_MainWindow.GetCncDir() & "\" & sFileName & m_MainWindow.m_CurrentMachine.sIsoFileExt
|
||||
bOk = EgtGenerate(sCncPath, "OmagCut ver." & m_MainWindow.GetVersion()) And bOk
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
' Ripristino come fase corrente quella iniziale
|
||||
EgtSetCurrPhase(1)
|
||||
If bOk Then
|
||||
m_CurrProjPage.SetInfoMessage("Genarato file " & sFileName & m_MainWindow.m_CurrentMachine.sIsoFileExt)
|
||||
Else
|
||||
m_CurrProjPage.SetErrorMessage(EgtMsg(90314)) 'Errore nella generazione del programma CN
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function ProcessEvents(nProg As Integer, nPause As Integer) As Integer
|
||||
' Visualizzo assi
|
||||
ShowCncData()
|
||||
|
||||
Reference in New Issue
Block a user