diff --git a/EgtStoneLib/EstCalc.vb b/EgtStoneLib/EstCalc.vb index 4018ecf..8d20b1a 100644 --- a/EgtStoneLib/EstCalc.vb +++ b/EgtStoneLib/EstCalc.vb @@ -1,7 +1,6 @@ - - -Imports System.Globalization +Imports System.Globalization Imports EgtUILib +Imports EgtWPFLib5 Module EstCalc @@ -159,6 +158,26 @@ Module EstCalc Return True End Function + Public Function SetWashingFlag(bWash As Boolean) As Boolean + Dim nMGrpId As Integer = EgtGetCurrMachGroup() + Return EgtSetInfo(nMGrpId, INFO_WASHING, bWash) + End Function + + Public Function GetWashingFlag() As Boolean + Dim nMGrpId As Integer = EgtGetCurrMachGroup() + Dim nFlag As Integer = 1 + EgtGetInfo(nMGrpId, INFO_WASHING, nFlag) + Return (nFlag <> 0) + End Function + + Public Function UpdateWashingFlag() As Boolean + Dim bCurrWash As Boolean = + (GetMainPrivateProfileInt(S_MACH_NEST, K_MACH_WASHING, 1) <> 0) + Dim bProjWash As Boolean = GetWashingFlag() + If bCurrWash <> bProjWash Then Return SetWashingFlag(bCurrWash) + Return True + End Function + '-------------------------------------------------------------------------------------------------- Public Function PartIsFree(nId As Integer) As Boolean ' Deve essere un pezzo diff --git a/MachGroupPanel/MachGroupPanelVM.vb b/MachGroupPanel/MachGroupPanelVM.vb index abc0042..4d4adee 100644 --- a/MachGroupPanel/MachGroupPanelVM.vb +++ b/MachGroupPanel/MachGroupPanelVM.vb @@ -41,6 +41,19 @@ Public Class MachGroupPanelVM Return True End Function + Public Overrides Function OnPreRemoveCurrMachGroup() As Boolean + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + ' Seleziono tutti i pezzi in tavola + Dim nPartId As Integer = EgtGetFirstGroupInGroup(GetRawId()) + While nPartId <> GDB_ID.NULL + Dim nNextPartId As Integer = EgtGetNextGroup(nPartId) + StoreOnePart(nPartId) + nPartId = nNextPartId + End While + + Return True + End Function + #End Region ' METHODS End Class \ No newline at end of file diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index a28f9d9..e8288b8 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -69,5 +69,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/OptionPanel/NestingTab/NestingTabVM.vb b/OptionPanel/NestingTab/NestingTabVM.vb index 587bbad..16c26e6 100644 --- a/OptionPanel/NestingTab/NestingTabVM.vb +++ b/OptionPanel/NestingTab/NestingTabVM.vb @@ -171,7 +171,7 @@ Public Class NestingTabVM ' Garantisco visibilità pezzi parcheggiati ShowParkedParts() ' Garantisco visibilità eventuale contorno da foto - ' m_CurrProjPage.ShowContour(True) + EstPhoto.ShowContour(True) EgtZoom(ZM.ALL) Return True End Function @@ -668,7 +668,9 @@ Public Class NestingTabVM ' Seleziono tutti i pezzi in parcheggio Dim nPartId As Integer = EgtGetFirstPart() While nPartId <> GDB_ID.NULL - EgtSetStatus(nPartId, GDB_ST.SEL) + If PartIsFree(nPartId) Then + EgtSetStatus(nPartId, GDB_ST.SEL) + End If nPartId = EgtGetNextPart(nPartId) End While End If diff --git a/OptionPanel/SimulTab/SimulTabVM.vb b/OptionPanel/SimulTab/SimulTabVM.vb index d6eff3c..61d243c 100644 --- a/OptionPanel/SimulTab/SimulTabVM.vb +++ b/OptionPanel/SimulTab/SimulTabVM.vb @@ -209,13 +209,55 @@ Public Class SimulTabVM End Sub Friend Sub InitSimulation() + Dim bOk As Boolean = True + ' Verifico l'attrezzaggio degli utensili utilizzati + Dim sMissingTools As String = String.Empty + Dim bSetup As Boolean = CamAuto.VerifySetup(sMissingTools) + ' Costringo ad aggiornare UI + UpdateUI() + ' Aggiorno flag per lavaggio + EstCalc.UpdateWashingFlag() + ' Se non c'è ordine delle lavorazioni, ne faccio uno automatico + If Not EstCalc.GetOrderMachiningFlag() Then + bOk = SortAllMachinings() + If bOk Then + EstCalc.SetOrderMachiningFlag() + End If + Dim bModif As Boolean = TestAllMachiningsForStrict() + If bModif Then + ' Ridotte alcune lavorazioni per evitare interferenze + OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(90321), 3, StatusBarVM.MSG_TYPE.WARNING) + End If + End If + ' Costringo ad aggiornare UI + UpdateUI() + ' Disabilito impostazione modificato + EgtDisableModified() + ' Aggiorno le lavorazioni + bOk = UpdateAllMachiningsToolpaths() And bOk + ' Se errore in setup, lo segnalo + If Not bSetup Then + ' Mancano gli utensili : ... + OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(90322) & " " & sMissingTools, StatusBarVM.MSG_TYPE.ERROR_) + ' Se errore in generazione, segnalo l'errore + ElseIf Not bOk Then + ' Errore nella generazione del programma CN + OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(90314), StatusBarVM.MSG_TYPE.ERROR_) + End If + ' Nascondo eventuali pezzi in parcheggio + HideParkedParts() + ' Nascondo eventuale contorno da foto + EstPhoto.ShowContour(False) + ' Imposto prima fase + EgtSetCurrPhase(1) + ShowAllCurrPhaseMachinings() ' Costringo ad aggiornare UI UpdateUI() 'Cambio la vista della scena EgtSetView(VT.ISO_SE, False) m_nMachLook = MCH_LOOK.ALL EgtSetMachineLook(m_nMachLook) - 'EgtZoom(ZM.ALL) + EgtZoom(ZM.ALL) ' Imposto stato corrente SimulationStatus = SIM_ST.ST_STOP m_bShowPlay = True @@ -224,6 +266,8 @@ Public Class SimulTabVM SliderValue = SliderVal ' Porto la testa in home EgtSimStart() + EgtSimHome() + LoadCurrTools() ShowCncData() End Sub @@ -236,8 +280,6 @@ Public Class SimulTabVM WriteMainPrivateProfileString(S_SIMUL, K_SLIDERVAL, sVal) ' Torno alla prima fase EgtSetCurrPhase(1, True) - ' Ripristino visibilità standard - 'EgtSetMachineLook(MCH_LOOK.TAB) End Sub Private Sub ExecSim() @@ -373,14 +415,40 @@ Public Class SimulTabVM End If End Sub + Private Function LoadCurrTools() As Boolean + ' Se macchina con cambio utensile non devo fare alcunché + If CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGER Then + Return True + End If + ' Imposto la lama corrente + Dim sSaw As String = CurrentMachine.sCurrSaw + If Not EgtLoadTool("H1", 1, sSaw) Then + Return False + End If + ' Imposto eventuale secondo utensile montato + If CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL Then + Dim sTool As String = CurrentMachine.sCurrDrill + If String.IsNullOrEmpty(sTool) Then sTool = CurrentMachine.sCurrMill + If Not String.IsNullOrEmpty(sTool) AndAlso Not EgtLoadTool("H1", 2, sTool) Then + Return False + End If + End If + Return True + End Function + Friend Sub ExitSimulation() OmagOFFICEMap.refStatusBarVM.ClearOutputMessage() ' Mi assicuro di terminare la simulazione ResetSimulation() - ' Cambio la vista della scena - EgtSetView(VT.TOP) + ' Ripristino visibilità standard m_nMachLook = MCH_LOOK.TAB EgtSetMachineLook(m_nMachLook) + ' Nascondo tutte le lavorazioni + CamAuto.HideAllMachinings() + ' Abilito impostazione modificato + EgtEnableModified() + ' Cambio la vista della scena + EgtSetView(VT.TOP, False) EgtZoom(ZM.ALL) End Sub