OmagCUT :
- aggiunto controllo attrezzaggio prima di simulare e generare.
This commit is contained in:
+46
-12
@@ -22,6 +22,9 @@ Public Class AlarmsPageUC
|
||||
Private m_MillList As New ObservableCollection(Of String)
|
||||
Private m_AuxToolTypeList As New List(Of StringIdCmBx)
|
||||
|
||||
' Costante per nessun utensile definito
|
||||
Private Const NO_TOOL As String = "-----"
|
||||
|
||||
Private Sub AlarmsPage_Initialized(sender As Object, e As EventArgs)
|
||||
|
||||
'Assegno liste a combobox
|
||||
@@ -117,7 +120,7 @@ Public Class AlarmsPageUC
|
||||
If m_CurrentMachine.sCurrDrill <> String.Empty Then
|
||||
Dim sTempCurrDrill = m_CurrentMachine.sCurrDrill
|
||||
CreateToolList(MCH_TF.DRILLBIT, m_DrillList)
|
||||
m_DrillList.Add("Nessuno")
|
||||
m_DrillList.Add(NO_TOOL)
|
||||
m_CurrentMachine.sCurrDrill = sTempCurrDrill
|
||||
CurrDrillCmBx.SelectedItem = m_CurrentMachine.sCurrDrill
|
||||
AuxiliaryToolCmBx.SelectedItem = StringIdCmBx.FromIdToStringIdCmBx(1, m_AuxToolTypeList)
|
||||
@@ -128,7 +131,7 @@ Public Class AlarmsPageUC
|
||||
ElseIf m_CurrentMachine.sCurrMill <> String.Empty Then
|
||||
Dim sTempCurrMill = m_CurrentMachine.sCurrMill
|
||||
CreateToolList(MCH_TF.MILL, m_MillList)
|
||||
m_MillList.Add("Nessuno")
|
||||
m_MillList.Add(NO_TOOL)
|
||||
m_CurrentMachine.sCurrMill = sTempCurrMill
|
||||
CurrMillCmBx.SelectedItem = m_CurrentMachine.sCurrMill
|
||||
AuxiliaryToolCmBx.SelectedItem = StringIdCmBx.FromIdToStringIdCmBx(2, m_AuxToolTypeList)
|
||||
@@ -190,13 +193,13 @@ Public Class AlarmsPageUC
|
||||
Case 1
|
||||
Dim sTempCurrDrill = m_CurrentMachine.sCurrDrill
|
||||
CreateToolList(MCH_TF.DRILLBIT, m_DrillList)
|
||||
m_DrillList.Add("Nessuno")
|
||||
m_DrillList.Add(NO_TOOL)
|
||||
m_CurrentMachine.sCurrDrill = sTempCurrDrill
|
||||
CurrDrillCmBx.SelectedItem = m_CurrentMachine.sCurrDrill
|
||||
CurrDrillTxBl.SetValue(Grid.RowProperty, 4)
|
||||
CurrDrillCmBx.SetValue(Grid.RowProperty, 5)
|
||||
If m_CurrentMachine.sCurrDrill = String.Empty Then
|
||||
CurrDrillCmBx.SelectedItem = "Nessuno"
|
||||
CurrDrillCmBx.SelectedItem = NO_TOOL
|
||||
Else
|
||||
CurrDrillCmBx.SelectedItem = m_CurrentMachine.sCurrDrill
|
||||
End If
|
||||
@@ -208,11 +211,11 @@ Public Class AlarmsPageUC
|
||||
Case 2
|
||||
Dim sTempCurrMill = m_CurrentMachine.sCurrMill
|
||||
CreateToolList(MCH_TF.MILL, m_MillList)
|
||||
m_MillList.Add("Nessuno")
|
||||
m_MillList.Add(NO_TOOL)
|
||||
m_CurrentMachine.sCurrMill = sTempCurrMill
|
||||
CurrMillCmBx.SelectedItem = m_CurrentMachine.sCurrMill
|
||||
If m_CurrentMachine.sCurrMill = String.Empty Then
|
||||
CurrMillCmBx.SelectedItem = "Nessuna"
|
||||
CurrMillCmBx.SelectedItem = NO_TOOL
|
||||
Else
|
||||
CurrMillCmBx.SelectedItem = m_CurrentMachine.sCurrMill
|
||||
End If
|
||||
@@ -226,31 +229,63 @@ Public Class AlarmsPageUC
|
||||
End Sub
|
||||
|
||||
Private Sub CurrSawCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrSawCmBx.SelectionChanged
|
||||
'WritePrivateProfileString(S_MACH, K_CURRSAW, CurrSawCmBx.SelectedItem, m_MainWindow.GetIniFile())
|
||||
If IsNothing(CurrSawCmBx.SelectedItem) Then Return
|
||||
' Assegno
|
||||
m_CurrentMachine.sCurrSaw = CurrSawCmBx.SelectedItem
|
||||
|
||||
' Se nuova lama incompatibile con lavorazione di taglio corrente, resetto quest'ultima
|
||||
Dim sMchTool As String = String.Empty
|
||||
If Not EgtMdbSetCurrMachining(m_CurrentMachine.sCurrSawing) Or
|
||||
Not EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, sMchTool) Or
|
||||
String.Compare(sMchTool, m_CurrentMachine.sCurrSaw, True) <> 0 Then
|
||||
m_CurrentMachine.sCurrSawing = String.Empty
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CurrDrillCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrDrillCmBx.SelectionChanged
|
||||
If CurrDrillCmBx.SelectedItem = "Nessuno" Then
|
||||
If IsNothing(CurrDrillCmBx.SelectedItem) Then Return
|
||||
' Rimuovo foretto
|
||||
If CurrDrillCmBx.SelectedItem = NO_TOOL Then
|
||||
m_CurrentMachine.sCurrDrill = String.Empty
|
||||
m_CurrentMachine.sCurrDrilling = String.Empty
|
||||
' Assegno foretto
|
||||
Else
|
||||
m_CurrentMachine.sCurrDrill = CurrDrillCmBx.SelectedItem
|
||||
' Reset fresa e relativa lavorazione
|
||||
If m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL Then
|
||||
m_CurrentMachine.sCurrMill = String.Empty
|
||||
m_CurrentMachine.sCurrMilling = String.Empty
|
||||
End If
|
||||
' Se nuovo foretto incompatibile con foratura corrente, resetto quest'ultima
|
||||
Dim sMchTool As String = String.Empty
|
||||
If Not EgtMdbSetCurrMachining(m_CurrentMachine.sCurrDrilling) Or
|
||||
Not EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, sMchTool) Or
|
||||
String.Compare(sMchTool, m_CurrentMachine.sCurrDrill, True) <> 0 Then
|
||||
m_CurrentMachine.sCurrDrilling = String.Empty
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CurrMillCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrMillCmBx.SelectionChanged
|
||||
If CurrMillCmBx.SelectedItem = "Nessuna" Then
|
||||
If IsNothing(CurrMillCmBx.SelectedItem) Then Return
|
||||
' Rimuovo fresa
|
||||
If CurrMillCmBx.SelectedItem = NO_TOOL Then
|
||||
m_CurrentMachine.sCurrMill = String.Empty
|
||||
m_CurrentMachine.sCurrMilling = String.Empty
|
||||
' Assegno fresa
|
||||
Else
|
||||
m_CurrentMachine.sCurrMill = CurrMillCmBx.SelectedItem
|
||||
' Reset foretto e relativa lavorazione
|
||||
If m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL Then
|
||||
m_CurrentMachine.sCurrDrill = String.Empty
|
||||
m_CurrentMachine.sCurrDrilling = String.Empty
|
||||
End If
|
||||
' Se nuova fresa incompatibile con fresatura corrente, resetto quest'ultima
|
||||
Dim sMchTool As String = String.Empty
|
||||
If Not EgtMdbSetCurrMachining(m_CurrentMachine.sCurrMilling) Or
|
||||
Not EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, sMchTool) Or
|
||||
String.Compare(sMchTool, m_CurrentMachine.sCurrMill, True) <> 0 Then
|
||||
m_CurrentMachine.sCurrMilling = String.Empty
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -335,7 +370,6 @@ Public Class AlarmsPageUC
|
||||
EgtMdbSave()
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub CompleteCutsChBx_Click(sender As Object, e As RoutedEventArgs) Handles CompleteCutsChBx.Click
|
||||
Dim NestPage As NestPageUC = m_MainWindow.m_CadCutPageUC.m_NestPage
|
||||
If CompleteCutsChBx.IsChecked() Then
|
||||
|
||||
@@ -238,6 +238,12 @@ Public Class CadCutPageUC
|
||||
|
||||
Private Sub WorkBtn_Click(sender As Object, e As RoutedEventArgs) Handles WorkBtn.Click
|
||||
Dim bOk As Boolean = True
|
||||
' 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
|
||||
' Se non c'è ordine delle lavorazioni, ne faccio uno automatico
|
||||
If Not m_CurrProjPage.GetOrderMachiningFlag() Then
|
||||
bOk = SortAllMachinings()
|
||||
|
||||
+38
@@ -88,6 +88,44 @@ Public Module CamAuto
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function VerifySetup(ByRef sMissingTools As String) As Boolean
|
||||
Dim bOk As Boolean = True
|
||||
sMissingTools = String.Empty
|
||||
Dim nId As Integer = EgtGetFirstOperation()
|
||||
While nId <> GDB_ID.NULL
|
||||
If IsValidMachining(nId) Then
|
||||
Dim nType As Integer = MCH_OY.NONE
|
||||
EgtGetMachiningParam(MCH_MP.TYPE, nType)
|
||||
Dim sTool As String = String.Empty
|
||||
EgtGetMachiningParam(MCH_MP.TOOL, sTool)
|
||||
If nType = MCH_OY.SAWING Then
|
||||
If String.Compare(sTool, m_MainWindow.m_CurrentMachine.sCurrSaw) <> 0 Then
|
||||
bOk = False
|
||||
If sMissingTools.IndexOf(sTool) = -1 Then
|
||||
sMissingTools = sMissingTools & sTool & ", "
|
||||
End If
|
||||
End If
|
||||
ElseIf nType = MCH_OY.DRILLING Then
|
||||
If String.Compare(sTool, m_MainWindow.m_CurrentMachine.sCurrDrill) <> 0 Then
|
||||
bOk = False
|
||||
If sMissingTools.IndexOf(sTool) = -1 Then
|
||||
sMissingTools = sMissingTools & sTool & ", "
|
||||
End If
|
||||
End If
|
||||
ElseIf nType = MCH_OY.MILLING Then
|
||||
If String.Compare(sTool, m_MainWindow.m_CurrentMachine.sCurrMill) <> 0 Then
|
||||
bOk = False
|
||||
If sMissingTools.IndexOf(sTool) = -1 Then
|
||||
sMissingTools = sMissingTools & sTool & ", "
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
nId = EgtGetNextOperation(nId)
|
||||
End While
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Friend Function TestAllMachiningsForStrict() As Boolean
|
||||
Dim bModified As Boolean = False
|
||||
' Affondamento ridotto
|
||||
|
||||
@@ -43,6 +43,9 @@ Public Class SimulationPageUC
|
||||
Private Sub SimulationPage_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
|
||||
Dim bOk As Boolean = True
|
||||
' Verifico l'attrezzaggio degli utensili utilizzati
|
||||
Dim sMissingTools As String = String.Empty
|
||||
Dim bSetup As Boolean = VerifySetup(sMissingTools)
|
||||
' Se non c'è ordine delle lavorazioni, ne faccio uno automatico
|
||||
If Not m_CurrProjPage.GetOrderMachiningFlag() Then
|
||||
bOk = SortAllMachinings()
|
||||
@@ -58,8 +61,11 @@ Public Class SimulationPageUC
|
||||
EgtDisableModified()
|
||||
' Aggiorno le lavorazioni
|
||||
bOk = UpdateAllMachiningsToolpaths() And bOk
|
||||
' Se errore in generazione, segnalo l'errore ed esco
|
||||
If Not bOk Then
|
||||
' Se errore in setup, lo segnalo
|
||||
If Not bSetup Then
|
||||
m_CurrProjPage.SetErrorMessage(EgtMsg(90322) & " " & sMissingTools) 'Mancano gli utensili : ...
|
||||
' Se errore in generazione, segnalo l'errore
|
||||
ElseIf Not bOk Then
|
||||
m_CurrProjPage.SetErrorMessage(EgtMsg(90314)) 'Errore nella generazione del programma CN
|
||||
End If
|
||||
' Salvo il progetto con le lavorazioni
|
||||
|
||||
Reference in New Issue
Block a user