diff --git a/EgtBEAMWALL.Core/BTL Model/BTLStructureM.vb b/EgtBEAMWALL.Core/BTL Model/BTLStructureM.vb index 4ff27ef5..8e5a2992 100644 --- a/EgtBEAMWALL.Core/BTL Model/BTLStructureM.vb +++ b/EgtBEAMWALL.Core/BTL Model/BTLStructureM.vb @@ -67,13 +67,13 @@ Public Class BTLStructureM End Set End Property - Public m_sPROJTYPE As String - Public Property sPROJTYPE As String + Public m_nPROJTYPE As Integer + Public Property nPROJTYPE As Integer Get - Return m_sPROJTYPE + Return m_nPROJTYPE End Get - Set(value As String) - m_sPROJTYPE = value + Set(value As Integer) + m_nPROJTYPE = value End Set End Property @@ -391,7 +391,7 @@ Public Class BTLStructureM EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJNAME, NewBTLStructure.m_sPROJNAME) EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJPART, NewBTLStructure.m_sPROJPART) EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJGUID, NewBTLStructure.m_sPROJGUID) - EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJTYPE, NewBTLStructure.m_sPROJTYPE) + EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJTYPE, NewBTLStructure.m_nPROJTYPE) EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_LISTNAME, NewBTLStructure.m_sLISTNAME) EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_CUSTOMER, NewBTLStructure.m_sCUSTOMER) EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_ARCHITECT, NewBTLStructure.m_sARCHITECT) diff --git a/EgtBEAMWALL.Core/MachGroup Model/BeamMachGroupM.vb b/EgtBEAMWALL.Core/MachGroup Model/BeamMachGroupM.vb index df0c95d6..2b6298f8 100644 --- a/EgtBEAMWALL.Core/MachGroup Model/BeamMachGroupM.vb +++ b/EgtBEAMWALL.Core/MachGroup Model/BeamMachGroupM.vb @@ -127,6 +127,7 @@ Public Class BeamMachGroupM EgtGetInfo(Id, MGR_RPT_BARLEN, dL) EgtGetInfo(Id, MGR_RPT_BARHEIGHT, dH) EgtGetInfo(Id, MGR_RPT_BARWIDTH, dW) + EgtGetInfo(Id, MGR_RPT_MATERIAL, sMATERIAL) End Sub End Class diff --git a/EgtBEAMWALL.Core/MachGroup Model/MyMachGroupM.vb b/EgtBEAMWALL.Core/MachGroup Model/MyMachGroupM.vb index ae61cbec..545d54fb 100644 --- a/EgtBEAMWALL.Core/MachGroup Model/MyMachGroupM.vb +++ b/EgtBEAMWALL.Core/MachGroup Model/MyMachGroupM.vb @@ -275,6 +275,8 @@ Public MustInherit Class MyMachGroupM End Function Public Shared Sub ReadMachGroupData(NewMachgroup As MyMachGroupM) + ' leggo materiale + EgtGetInfo(NewMachgroup.Id, MGR_RPT_MATERIAL, NewMachgroup.sMATERIAL) ' leggo calc error Dim nErr As Integer = 0 Dim nRot As Integer = 0 diff --git a/EgtBEAMWALL.Core/MachGroup Model/MyMachGroupPanelM.vb b/EgtBEAMWALL.Core/MachGroup Model/MyMachGroupPanelM.vb index 0b547838..5ed4b2cc 100644 --- a/EgtBEAMWALL.Core/MachGroup Model/MyMachGroupPanelM.vb +++ b/EgtBEAMWALL.Core/MachGroup Model/MyMachGroupPanelM.vb @@ -145,7 +145,8 @@ Public Class MyMachGroupPanelM End Function Public Function NewMachGroupID() As Integer - If Not IsNothing(MachGroupMList) AndAlso MachGroupMList.Count > 0 Then Return MachGroupMList.Max(Function(x) x.Name) + 1 + Dim nTemp As Integer = 0 + If Not IsNothing(MachGroupMList) AndAlso MachGroupMList.Count > 0 Then Return MachGroupMList.Select(Of Integer)(Function(x) If(Integer.TryParse(x.Name, nTemp), nTemp, 0)).Max() + 1 Return 1 End Function diff --git a/EgtBEAMWALL.Core/SectionXMaterial.vb b/EgtBEAMWALL.Core/SectionXMaterial.vb index e3006a95..bde8275c 100644 --- a/EgtBEAMWALL.Core/SectionXMaterial.vb +++ b/EgtBEAMWALL.Core/SectionXMaterial.vb @@ -77,16 +77,22 @@ Public Class SectionXMaterial End Property Shared Operator =(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean - Return (S1.m_dH = S2.m_dH AndAlso S1.m_dW = S2.m_dW AndAlso S1.m_dL = S2.m_dL AndAlso S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x))) + Return (S1.m_dH < S2.m_dH + EPS_SMALL * 100 AndAlso S1.m_dH > S2.m_dH - EPS_SMALL * 100 AndAlso + S1.m_dW < S2.m_dW + EPS_SMALL * 100 AndAlso S1.m_dW > S2.m_dW - EPS_SMALL * 100 AndAlso + S1.m_dL < S2.m_dL + EPS_SMALL * 100 AndAlso S1.m_dL > S2.m_dL - EPS_SMALL * 100 AndAlso + S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x))) End Operator Shared Operator <>(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean - Return (S1.m_dH <> S2.m_dH OrElse S1.m_dW <> S2.m_dW OrElse S1.m_dL <> S2.m_dL) OrElse Not S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x)) + Return S1.m_dH > S2.m_dH + EPS_SMALL * 100 OrElse S1.m_dH < S2.m_dH - EPS_SMALL * 100 OrElse + S1.m_dW > S2.m_dW + EPS_SMALL * 100 OrElse S1.m_dW < S2.m_dW - EPS_SMALL * 100 OrElse + S1.m_dL > S2.m_dL + EPS_SMALL * 100 OrElse S1.m_dL < S2.m_dL - EPS_SMALL * 100 OrElse + Not S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x)) End Operator Public Overrides Function Equals(ByVal obj As Object) As Boolean If TypeOf obj Is SectionXMaterial Then - Return (m_dH = obj.dH AndAlso m_dW = obj.dW AndAlso m_dL = obj.dL AndAlso m_Material.Any(Function(x) DirectCast(obj.sMaterial, List(Of String)).Any(Function(y) y = x))) + Return Me = DirectCast(obj, SectionXMaterial) '(m_dH = obj.dH AndAlso m_dW = obj.dW AndAlso m_dL = obj.dL AndAlso m_Material.Any(Function(x) DirectCast(obj.sMaterial, List(Of String)).Any(Function(y) y = x))) End If Return False End Function diff --git a/EgtBEAMWALL.Core/WallMachGroupM.vb b/EgtBEAMWALL.Core/WallMachGroupM.vb index 208f6dff..a05f3512 100644 --- a/EgtBEAMWALL.Core/WallMachGroupM.vb +++ b/EgtBEAMWALL.Core/WallMachGroupM.vb @@ -97,6 +97,7 @@ Public Class WallMachGroupM EgtGetInfo(Id, MGR_RPT_PANELLEN, dL) EgtGetInfo(Id, MGR_RPT_PANELWIDTH, dW) EgtGetInfo(Id, MGR_RPT_PANELHEIGHT, dH) + EgtGetInfo(Id, MGR_RPT_MATERIAL, sMATERIAL) End Sub End Class diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLPartVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLPartVM.vb index 9968b864..49762cb9 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLPartVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLPartVM.vb @@ -62,8 +62,8 @@ Public Class BTLPartVM Dim nDuploCount As Integer = 0 If EgtDuploCount(m_BTLPartM.nPartId, nDuploCount) AndAlso nDuploCount > 0 Then ' se modalità travi e trave - If CurrentMachine.nType = MachineType.BEAM OrElse - CurrentMachine.nType = MachineType.WALL Then + If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM OrElse + Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then If dBtlW <> m_BTLPartM.dBtlW OrElse dBtlH <> m_BTLPartM.dBtlH OrElse dBtlL <> m_BTLPartM.dBtlL Then ' avviso che tutti i pezzi verranno tolti dai grezzi e chiedo di confermare If MessageBox.Show(String.Format(EgtMsg(61851), nDuploCount), EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then @@ -1584,8 +1584,8 @@ Public Class BTLPartVM Dim nDuploCount As Integer = 0 If EgtDuploCount(m_BTLPartM.nPartId, nDuploCount) AndAlso nDuploCount > 0 Then ' se modalità travi e trave - If CurrentMachine.nType = MachineType.BEAM OrElse - CurrentMachine.nType = MachineType.WALL Then + If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM OrElse + Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then ' avviso che tutti i pezzi verranno tolti dai grezzi e chiedo di confermare If MessageBox.Show(String.Format(EgtMsg(61851), nDuploCount), EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then MyMachGroupPanelM.DuploSetToDelete(m_BTLPartM.nPartId) @@ -1767,7 +1767,7 @@ Public Class BTLPartVM Public Sub Invert() ' eseguo inversione - m_BTLPartM.Inversion(CurrentMachine.nType) + m_BTLPartM.Inversion(Map.refProjectVM.BTLStructureVM.nPROJTYPE) ' setto part e tutte le feature da ricalcolare ResetCalcTotalPart() EgtDraw() @@ -1788,7 +1788,7 @@ Public Class BTLPartVM End Property Public Sub BackRotation() - Rotation(False, CurrentMachine.nType) + Rotation(False, Map.refProjectVM.BTLStructureVM.nPROJTYPE) End Sub #End Region ' BackRotation @@ -1805,7 +1805,7 @@ Public Class BTLPartVM End Property Public Sub ForwardRotation() - Rotation(True, CurrentMachine.nType) + Rotation(True, Map.refProjectVM.BTLStructureVM.nPROJTYPE) End Sub #End Region ' ForwardRotation diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLStructureVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLStructureVM.vb index 23802717..abecd5cb 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLStructureVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLStructureVM.vb @@ -68,7 +68,7 @@ Public Class BTLStructureVM Map.refShowBeamPanelVM.bShowAll = False ' aggiorno vista Dim view As VT = VT.ISO_SW - If CurrentMachine.nType = Core.ConstBeam.MachineType.WALL Then view = VT.TOP + If Map.refProjectVM.BTLStructureVM.nPROJTYPE = Core.ConstBeam.MachineType.WALL Then view = VT.TOP EgtSetView(view, False) EgtZoom(ZM.ALL) ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then @@ -76,11 +76,9 @@ Public Class BTLStructureVM EgtResetCurrMachGroup() ' seleziono pezzo nella scena SceneSelPartSelection() - ' resetto selezione machgroup - Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup = Nothing ' aggiorno vista Dim view As VT = VT.ISO_SW - If CurrentMachine.nType = Core.ConstBeam.MachineType.WALL Then view = VT.TOP + If Map.refProjectVM.BTLStructureVM.nPROJTYPE = Core.ConstBeam.MachineType.WALL Then view = VT.TOP EgtSetView(view, False) EgtZoom(ZM.ALL) End If @@ -226,15 +224,15 @@ Public Class BTLStructureVM End Set End Property - Public Property sPROJTYPE As String + Public Property nPROJTYPE As BWType Get - Return m_BTLStructureM.m_sPROJTYPE + Return m_BTLStructureM.m_nPROJTYPE End Get - Set(value As String) + Set(value As BWType) If EgtSetInfo(m_BTLStructureM.nBTLInfoId, BTL_GEN_PROJTYPE, value) Then - m_BTLStructureM.m_sPROJTYPE = value + m_BTLStructureM.m_nPROJTYPE = value Else - NotifyPropertyChanged("sPROJTYPE") + NotifyPropertyChanged(NameOf(nPROJTYPE)) End If End Set End Property @@ -836,7 +834,7 @@ Public Class BTLStructureVM Friend Sub UpdateSection(NewPartSection As SectionXMaterial, OldPartSection As SectionXMaterial) If IsNothing(BTLPartVMList) Then Return - If CurrentMachine.nType = MachineType.BEAM Then + If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then ' verifico se era unico con vecchia sezione If Not m_BTLPartVMList.Any(Function(x) x.Section = OldPartSection) Then ' nel caso seleziono filtro generico @@ -849,7 +847,7 @@ Public Class BTLStructureVM If Not m_SectionList.Any(Function(x) x = NewPartSection) Then m_SectionList.Add(NewPartSection) End If - ElseIf CurrentMachine.nType = MachineType.WALL Then + ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then ' se ruoto o inverto parete, la sezione non cambia End If End Sub diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListV.xaml.vb index fcb57d59..6cb15ba4 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListV.xaml.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListV.xaml.vb @@ -1,4 +1,5 @@ -Imports EgtBEAMWALL.Core +Imports EgtUILib +Imports EgtBEAMWALL.Core Public Class PartInRawPartListV @@ -6,8 +7,15 @@ Public Class PartInRawPartListV If TypeOf sender Is DataGridRow Then Dim Row As DataGridRow = DirectCast(sender, DataGridRow) If Not IsNothing(Row) AndAlso Row.IsSelected Then - Dim MyMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup - MyMachGroup.SelPart = MyMachGroup.SelPart + If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then + Dim BeamMachGroup As BeamMachGroupVM = Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup + If EgtGetCurrMachGroup() = GDB_ID.NULL Then Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup = BeamMachGroup + BeamMachGroup.SelPart = BeamMachGroup.SelPart + ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then + Dim WallMachGroup As WallMachGroupVM = Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup + If EgtGetCurrMachGroup() = GDB_ID.NULL Then Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup = WallMachGroup + WallMachGroup.SelPart = WallMachGroup.SelPart + End If End If End If End Sub diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListV.xaml b/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListV.xaml index d1b0663c..0c1d0bf8 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListV.xaml +++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListV.xaml @@ -140,6 +140,11 @@ + + + diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListV.xaml.vb index 372afa72..3d854ee9 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListV.xaml.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListV.xaml.vb @@ -1,3 +1,12 @@ Public Class RawPartListV + Private Sub RawPartList_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs) + If TypeOf sender Is DataGridRow Then + Dim Row As DataGridRow = DirectCast(sender, DataGridRow) + If Not IsNothing(Row) AndAlso Row.IsSelected Then + Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup = Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup + End If + End If + End Sub + End Class diff --git a/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/InstrumentPanelV.xaml b/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/InstrumentPanelV.xaml index 6f7f68e3..98269b01 100644 --- a/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/InstrumentPanelV.xaml +++ b/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/InstrumentPanelV.xaml @@ -26,7 +26,8 @@ ToolTip="{Binding ChangeParam_ToolTip}" Style="{StaticResource ToolBar_Button}" Command="{Binding ChangeParameter_Command}" - Visibility="{Binding ChangeParam_Visibility}"> + Visibility="{Binding ChangeParam_Visibility}" + IsEnabled="{Binding InstrumentPanel_IsEnabled}"> @@ -36,7 +37,7 @@ ToolTip="{Binding Verify_ToolTip}" Style="{StaticResource ToolBar_Button}" Command="{Binding Verify_Command}" - IsEnabled="{Binding Verify_IsEnabled}"> + IsEnabled="{Binding InstrumentPanel_IsEnabled}"> diff --git a/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/MyInstrumentPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/MyInstrumentPanelVM.vb index 8d8b90d5..cf5e7a0c 100644 --- a/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/MyInstrumentPanelVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/MyInstrumentPanelVM.vb @@ -13,6 +13,16 @@ Public Class MyInstrumentPanelVM End Get End Property + Private m_InstrumentPanel_IsEnabled As Boolean = True + Public Property InstrumentPanel_IsEnabled As Boolean + Get + Return m_InstrumentPanel_IsEnabled + End Get + Set(value As Boolean) + m_InstrumentPanel_IsEnabled = value + End Set + End Property + Dim m_PrevBottomPanelPage As BottomPanelVM.PartFeatureTab = BottomPanelVM.PartFeatureTab.STRUCTURE_ Private m_Statistics_IsChecked As Boolean = False Public Property Statistics_IsChecked As Boolean @@ -109,6 +119,11 @@ Public Class MyInstrumentPanelVM End If End Sub + Friend Sub SetInstrumentPanelIsEnabled(bIsEnabled As Boolean) + m_InstrumentPanel_IsEnabled = bIsEnabled + NotifyPropertyChanged(NameOf(InstrumentPanel_IsEnabled)) + End Sub + #End Region ' METHODS #Region "COMMANDS" @@ -155,6 +170,8 @@ Public Class MyInstrumentPanelVM ''' Execute the Open. This method is invoked by the OpenCommand. ''' Friend Sub ChangeParameter() + If (Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso (IsNothing(Map.refProjManagerVM.CurrProj) OrElse IsNothing(Map.refProjectVM.BTLStructureVM)) OrElse + (Map.refMainMenuVM.SelPage = Pages.MACHINING AndAlso (IsNothing(Map.refProdManagerVM.CurrProd) OrElse IsNothing(Map.refProjectVM.MachGroupPanelVM)))) Then Return Dim ChangeParameterWndVM As New ChangeParameterWndVM Dim ChangeParameterWnd As New ChangeParameterWndV(Application.Current.MainWindow, ChangeParameterWndVM) If ChangeParameterWnd.ShowDialog() Then @@ -242,11 +259,13 @@ Public Class MyInstrumentPanelVM ''' Execute the Open. This method is invoked by the OpenCommand. ''' Friend Sub Verify() + If (Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso (IsNothing(Map.refProjManagerVM.CurrProj) OrElse IsNothing(Map.refProjectVM.BTLStructureVM)) OrElse + (Map.refMainMenuVM.SelPage = Pages.MACHINING AndAlso (IsNothing(Map.refProdManagerVM.CurrProd) OrElse IsNothing(Map.refProjectVM.MachGroupPanelVM)))) Then Return Dim Calc As New CalcIntegration Dim BarList() As CalcIntegration.Bar If Map.refMainMenuVM.SelPage = Pages.VIEW Then If ((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift) Then - Dim TempBarList As New List(of CalcIntegration.Bar) + Dim TempBarList As New List(Of CalcIntegration.Bar) For PartIndex = 0 To Map.refProjectVM.BTLStructureVM.BTLPartVMList.Count - 1 Dim CurrPart As BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList(PartIndex) If Not CurrPart.bDO Then Continue For @@ -283,6 +302,9 @@ Public Class MyInstrumentPanelVM Else Return End If + ' disabilito interfaccia + Map.refProjectVM.ManageIsEnabled(False) + ' lancio calcolo Calc.Run(BarList, Map.refProjManagerVM.CurrProj.sProjDirPath, AddressOf ManageCalc) ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then @@ -315,7 +337,7 @@ Public Class MyInstrumentPanelVM Bar.nCmdType = CalcIntegration.CmdType.GENERATE Case Else Dim sMachGroupFilePath As String = Map.refProdManagerVM.CurrProd.sProdDirPath & "\" & SelMachGroup.Name.ToString() & ".ori.bwe" - If File.Exists( sMachGroupFilePath) Then File.Delete( sMachGroupFilePath) + If File.Exists(sMachGroupFilePath) Then File.Delete(sMachGroupFilePath) Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN End Select TempBarList(0) = Bar @@ -323,6 +345,9 @@ Public Class MyInstrumentPanelVM Else Return End If + ' disabilito interfaccia + Map.refProjectVM.ManageIsEnabled(False) + ' lancio calcolo Calc.Run(BarList, Map.refProdManagerVM.CurrProd.sProdDirPath, AddressOf ManageCalc) End If End Sub @@ -384,6 +409,9 @@ Public Class MyInstrumentPanelVM Else Return End If + ' disabilito interfaccia + Map.refProjectVM.ManageIsEnabled(False) + ' lancio simulazione Calc.Run(BarList, Map.refProjManagerVM.CurrProj.sProjDirPath, AddressOf ManageCalc) ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then If Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then @@ -402,6 +430,9 @@ Public Class MyInstrumentPanelVM Else Return End If + ' disabilito interfaccia + Map.refProjectVM.ManageIsEnabled(False) + ' lancio simulazione Calc.Run(BarList, Map.refProdManagerVM.CurrProd.sProdDirPath, AddressOf ManageCalc) End If End Sub diff --git a/EgtBEAMWALL.ViewerOptimizer/Integration/CalcIntegration.vb b/EgtBEAMWALL.ViewerOptimizer/Integration/CalcIntegration.vb index 870f01f4..c49a9168 100644 --- a/EgtBEAMWALL.ViewerOptimizer/Integration/CalcIntegration.vb +++ b/EgtBEAMWALL.ViewerOptimizer/Integration/CalcIntegration.vb @@ -61,7 +61,14 @@ Public Class CalcIntegration End If Next - callback(0.1, "", bCancel) + Dim bIsSimulation As Boolean = False + ' se sono in simulazione + If vBar.Count > 0 AndAlso vBar(0).nCmdType = CmdType.SIMULATE Then + bIsSimulation = True + callback(0, "Simulation opened", bCancel) + Else + callback(0.1, "", bCancel) + End If Dim ExePath As String = String.Empty GetMainPrivateProfileString(S_BEAM, K_CALCPATH, "", ExePath) @@ -106,7 +113,7 @@ Public Class CalcIntegration vProc(j).Proc = New Process() vProc(j).Proc.StartInfo.FileName = ExePath vProc(j).Proc.StartInfo.Arguments = """" & vBar(nCurrBar).sBarPath & """ " & - """" & CurrentMachine.nType & """ " & + """" & Map.refProjectVM.BTLStructureVM.nPROJTYPE & """ " & """" & CurrentMachine.sMachineName & """ " & vBar(nCurrBar).nCmdType vProc(j).Proc.StartInfo.UseShellExecute = False @@ -156,27 +163,37 @@ Public Class CalcIntegration End If If bDone Then - ' Dialog con Progress Bar - nDoneBar += 1 - dProgress = 1 / numBars * nDoneBar - Dim sProg As String = (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture) - callback(dProgress, " Progress: " & sProg & "% Count: " & nDoneBar & " / " & numBars, bCancel) - + ' se non sono in simulazione + If bIsSimulation Then + callback(0, "Simulation closing", bCancel) + Else + ' Dialog con Progress Bar + nDoneBar += 1 + dProgress = 1 / numBars * nDoneBar + Dim sProg As String = (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture) + callback(dProgress, " Progress: " & sProg & "% Count: " & nDoneBar & " / " & numBars, bCancel) + End If If bCancel Then ' fine callback(1, "", bCancel) + ' riabilito interfaccia + Map.refProjectVM.ManageIsEnabled(True) Map.refMyStatusBarVM.ResetStopProgress() Return End If nPgsCurrBar = 0 nPgsClock = 0 Else - If nPgsClock >= 100 AndAlso nPgsCurrBar < 149 Then - nPgsCurrBar += 1 - dProgress = 1 / numBars * nDoneBar + 1 / numBars / 150 * nPgsCurrBar - Dim sProg As String = (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture) - callback(dProgress, " Progress: " & sProg & "% Count: " & nDoneBar & " / " & numBars, bCancel) - nPgsClock = 0 + ' se non sono in simulazione + If Not bIsSimulation Then + ' aggiorno conteggio + If nPgsClock >= 100 AndAlso nPgsCurrBar < 149 Then + nPgsCurrBar += 1 + dProgress = 1 / numBars * nDoneBar + 1 / numBars / 150 * nPgsCurrBar + Dim sProg As String = (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture) + callback(dProgress, " Progress: " & sProg & "% Count: " & nDoneBar & " / " & numBars, bCancel) + nPgsClock = 0 + End If End If End If nPgsClock += 1 @@ -200,8 +217,14 @@ Public Class CalcIntegration Thread.Sleep(300) - ' fine - callback(1, "Done", bCancel) + ' se sono in simulazione + If bIsSimulation Then + callback(1, "Simulation closed", bCancel) + Else + callback(1, "Done", bCancel) + End If + ' riabilito interfaccia + Map.refProjectVM.ManageIsEnabled(True) Map.refMyStatusBarVM.ResetStopProgress() End Sub diff --git a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelV.xaml b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelV.xaml index aab4e24e..b745dab5 100644 --- a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelV.xaml +++ b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelV.xaml @@ -51,26 +51,31 @@ Command="{Binding NewRawPart_Command}" Visibility="{Binding MachiningPage_Visibility}" ToolTip="{Binding NewRawPart_ToopTip}" + IsEnabled="{Binding LeftPanel_IsEnabled}" Style="{StaticResource LeftPanel_SmallButton}"/> diff --git a/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb index e4cf4f17..537790b5 100644 --- a/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb @@ -6,6 +6,8 @@ Imports EgtWPFLib5 Public Class OptimizePanelVM Inherits VMBase +#Region "FIELDS & PROPERTIES" + Friend Enum PartType As Integer MATERIAL = 0 ALL = 1 @@ -52,16 +54,13 @@ Public Class OptimizePanelVM End Set End Property + Private m_OptimizePanel_IsEnabled As Boolean = True + Public ReadOnly Property OptimizePanel_IsEnabled As Boolean + Get + Return m_OptimizePanel_IsEnabled + End Get + End Property - ' Definizione comandi - Private m_cmdOptimize As ICommand - Private m_cmdWarehouse As ICommand - - Sub New() - m_SelPartType = PartTypeList(0) - m_SelOriginType = OriginTypeList(0) - NotifyPropertyChanged(NameOf(SelPartType)) - End Sub #Region "Messages" @@ -79,6 +78,33 @@ Public Class OptimizePanelVM #End Region ' Messages + ' Definizione comandi + Private m_cmdOptimize As ICommand + Private m_cmdWarehouse As ICommand + +#End Region ' FIELDS & PROPERTIES + +#Region "CONSTRUCTOR" + + Sub New() + ' aggiungo riferimento a Map + Map.SetRefOptimizePanelVM(Me) + m_SelPartType = PartTypeList(0) + m_SelOriginType = OriginTypeList(0) + NotifyPropertyChanged(NameOf(SelPartType)) + End Sub + +#End Region ' CONSTRUCTOR + +#Region "METHODS" + + Friend Sub SetOptimizePanelIsEnabled(bIsEnabled As Boolean) + m_OptimizePanel_IsEnabled = bIsEnabled + NotifyPropertyChanged(NameOf(OptimizePanel_IsEnabled)) + End Sub + +#End Region ' METHODS + #Region "COMMANDS" #Region "Optimize" @@ -105,6 +131,8 @@ Public Class OptimizePanelVM Dim dSectionTime As Double = GetMainPrivateProfileDouble(S_NEST, K_SECTIONTIME, 1) Dim dPartTime As Double = GetMainPrivateProfileDouble(S_NEST, K_PARTTIME, 1) Dim SectionList As New List(Of SParam) + ' disabilito interfaccia + Map.refProjectVM.ManageIsEnabled(False) ' se ho selezionato nest per materiale e c'è una sezione selezionata diversa da sezione nulla If m_SelPartType.Id = PartType.MATERIAL AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM.SelSection) AndAlso Map.refProjectVM.BTLStructureVM.SelSection.dH <> -1 Then SectionList.Add(New SParam(Map.refProjectVM.BTLStructureVM.SelSection, 0, 0)) @@ -126,7 +154,7 @@ Public Class OptimizePanelVM Case WarehouseType.BASIC Dim nQuantity As Integer = 0 sWarehouseIniPath = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_BASIC_INI_FILE_NAME - If CurrentMachine.nType = MachineType.BEAM Then + If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then ' leggo lunghezza barra Dim nCurrentL As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_BEAM, WRH_CURRENT & WRH_L, 1, sWarehouseIniPath) dRawL = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_BEAM, WRH_L & nCurrentL, 0, sWarehouseIniPath) @@ -139,13 +167,17 @@ Public Class OptimizePanelVM Section.dL = dRawL Section.nQuantity = nQuantity Next - ElseIf CurrentMachine.nType = MachineType.WALL Then + ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then Dim nCurrentS As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_WALL, WRH_CURRENT & WRH_S, nCurrentS, sWarehouseIniPath) Dim sPanelDim As String = "" Dim sPanelDims() As String EgtUILib.GenInterface.GetPrivateProfileString(WRH_WALL, WRH_S & nCurrentS, "", sPanelDim, sWarehouseIniPath) If Not String.IsNullOrWhiteSpace(sPanelDim) Then sPanelDims = sPanelDim.Split(","c) - If Not sPanelDims.Count = 2 OrElse Not StringToDouble(sPanelDims(0), dRawL) OrElse Not StringToDouble(sPanelDims(1), dRawW) Then Return + If Not sPanelDims.Count = 2 OrElse Not StringToDouble(sPanelDims(0), dRawL) OrElse Not StringToDouble(sPanelDims(1), dRawW) Then + ' riabilito interfaccia + Map.refProjectVM.ManageIsEnabled(True) + Return + End If ' leggo start offset, offset e quantity dOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_OFFSET, 0, sWarehouseIniPath) dKerf = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_KERF, 0, sWarehouseIniPath) @@ -162,7 +194,7 @@ Public Class OptimizePanelVM Dim nIndex As Integer = 1 sWarehouseIniPath = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME ' aggiungo le sezioni con diverse lunghezze in base al warehouse - If CurrentMachine.nType = MachineType.BEAM Then + If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then ' leggo start offset ed offset dStartOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_STARTOFFSET, 0, sWarehouseIniPath) dOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_OFFSET, 0, sWarehouseIniPath) @@ -177,13 +209,17 @@ Public Class OptimizePanelVM Next nIndex += 1 End While - ElseIf CurrentMachine.nType = MachineType.WALL Then + ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then Dim nCurrentS As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_WALL, WRH_CURRENT & WRH_S, nCurrentS, sWarehouseIniPath) Dim sPanelDim As String = "" Dim sPanelDims() As String EgtUILib.GenInterface.GetPrivateProfileString(WRH_WALL, WRH_S & nCurrentS, "", sPanelDim, sWarehouseIniPath) If Not String.IsNullOrWhiteSpace(sPanelDim) Then sPanelDims = sPanelDim.Split(","c) - If Not sPanelDims.Count = 2 OrElse Not StringToDouble(sPanelDims(0), dRawL) OrElse Not StringToDouble(sPanelDims(1), dRawW) Then Return + If Not sPanelDims.Count = 2 OrElse Not StringToDouble(sPanelDims(0), dRawL) OrElse Not StringToDouble(sPanelDims(1), dRawW) Then + ' riabilito interfaccia + Map.refProjectVM.ManageIsEnabled(True) + Return + End If dOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_OFFSET, 0, sWarehouseIniPath) dKerf = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_KERF, 0, sWarehouseIniPath) ' leggo lunghezza barra e quantity @@ -217,6 +253,8 @@ Public Class OptimizePanelVM Map.refMyStatusBarVM.EndLoading("Nesting completed") ' seleziono ultimo gruppo Map.refProjectVM.MachGroupPanelVM.SelLastMachGroup() + ' riabilito interfaccia + Map.refProjectVM.ManageIsEnabled(True) End Sub #End Region ' Optimize diff --git a/EgtBEAMWALL.ViewerOptimizer/PartManager/PartManagerV.xaml b/EgtBEAMWALL.ViewerOptimizer/PartManager/PartManagerV.xaml index 71f37edd..b875633f 100644 --- a/EgtBEAMWALL.ViewerOptimizer/PartManager/PartManagerV.xaml +++ b/EgtBEAMWALL.ViewerOptimizer/PartManager/PartManagerV.xaml @@ -2,58 +2,77 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5" + xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer" Orientation="Horizontal" - Height="28"> + Height="28" + IsEnabled="{Binding PartManager_IsEnabled}"> - - - + - + - +