diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLStructureVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLStructureVM.vb index 48f6b7da..af962d09 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLStructureVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLStructureVM.vb @@ -66,8 +66,12 @@ Public Class BTLStructureVM End Get End Property Friend Sub SetSelectionType(value As SelectionTypes) + If Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE And Map.refProjectVM.LastSelGridType = ProjectVM.GridSelTypes.MACHGROUP Then + ' resetto gruppo di lavorazione corrente + EgtResetCurrMachGroup() + End If m_PrevSelectionType = m_SelectionType - If value = m_SelectionType Then Return + If value = m_SelectionType And Map.refProjectVM.LastSelGridType = ProjectVM.GridSelTypes.PART Then Return m_SelectionType = value Select Case m_SelectionType Case SelectionTypes.SELECT_ @@ -91,7 +95,7 @@ Public Class BTLStructureVM ' mostro pezzi selezionati Map.refProjectVM.BTLStructureVM.ShowAll(False) ' se attivata opzione, li assemblo - Map.refProjectVM.BTLStructureVM.ShowBuilding(If(Map.refMainMenuVM.SelPage = Pages.VIEW, Map.refShowBeamPanelVM.ShowBuilding_IsChecked, False), False) + Map.refProjectVM.BTLStructureVM.ShowBuilding(If(Map.refMainMenuVM.SelPage = Pages.VIEW OrElse Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE, Map.refShowBeamPanelVM.ShowBuilding_IsChecked, False), False) ' nascondo barra di gestione pezzo Map.refProjectVM.NotifyPropertyChanged(NameOf(Map.refProjectVM.PartManager_Visibility)) End Select @@ -149,11 +153,15 @@ Public Class BTLStructureVM End Sub Private Sub SelBTLParts_CollectionChanged(sender As Object, e As NotifyCollectionChangedEventArgs) + If Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE And Map.refProjectVM.LastSelGridType = ProjectVM.GridSelTypes.MACHGROUP Then + ' resetto gruppo di lavorazione corrente + EgtResetCurrMachGroup() + End If If m_bOnlySelectItem Then Return Select Case e.Action Case NotifyCollectionChangedAction.Add If e.NewItems.Count > 0 AndAlso Not IsNothing(e.NewItems(0)) Then - If (Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso m_SelectionType = SelectionTypes.SELECT_) OrElse Map.refMainMenuVM.SelPage = Pages.MACHINING OrElse (Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE AndAlso m_SelectionType = SelectionTypes.SELECT_) OrElse Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE Then + If ((Map.refMainMenuVM.SelPage = Pages.VIEW OrElse Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE) AndAlso m_SelectionType = SelectionTypes.SELECT_) OrElse Map.refMainMenuVM.SelPage = Pages.MACHINING Then SelectBTLPart(e.NewItems(0)) Else ' SelectionTypes.HIGHLIGHT HighlightBTLPart(e.NewItems(0)) @@ -161,14 +169,14 @@ Public Class BTLStructureVM End If Case NotifyCollectionChangedAction.Remove If e.OldItems.Count > 0 AndAlso Not IsNothing(e.OldItems(0)) Then - If (Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso m_PrevSelectionType = SelectionTypes.SELECT_) OrElse Map.refMainMenuVM.SelPage = Pages.MACHINING Then + If ((Map.refMainMenuVM.SelPage = Pages.VIEW OrElse Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE) AndAlso m_PrevSelectionType = SelectionTypes.SELECT_) OrElse Map.refMainMenuVM.SelPage = Pages.MACHINING Then DeselectBTLPart(e.OldItems(0)) Else ' SelectionTypes.HIGHLIGHT DeHighlightBTLPart(e.OldItems(0)) End If End If Case NotifyCollectionChangedAction.Reset - If (Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso m_PrevSelectionType = SelectionTypes.SELECT_) OrElse Map.refMainMenuVM.SelPage = Pages.MACHINING Then + If ((Map.refMainMenuVM.SelPage = Pages.VIEW OrElse Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE) AndAlso m_PrevSelectionType = SelectionTypes.SELECT_) OrElse Map.refMainMenuVM.SelPage = Pages.MACHINING Then If Not IsNothing(m_SelBTLPart) Then DeselectBTLPart(m_SelBTLPart) End If @@ -185,10 +193,10 @@ Public Class BTLStructureVM End Sub Private Sub SelectBTLPart(BtlPart As BTLPartVM) - EgtBeamShowFacesName(False) - EgtBeamShowLoadingSide(False, False) m_SelBTLPart = BtlPart - If Map.refMainMenuVM.SelPage = Pages.VIEW OrElse Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE Then + If Map.refMainMenuVM.SelPage = Pages.VIEW Then + EgtBeamShowFacesName(False) + EgtBeamShowLoadingSide(False, False) Map.refProjectVM.MacroFeature_IsEnabled = True ' se modalità building, la tolgo If Map.refShowBeamPanelVM.ShowBuilding_IsChecked Then @@ -210,13 +218,15 @@ Public Class BTLStructureVM 'Map.refProjectVM.NotifyPropertyChanged(NameOf(Map.refProjectVM.PartManager_Visibility)) ' deseleziono le feature If Not IsNothing(BtlPart.SelBTLFeatureVM) Then SelBTLPart.SelBTLFeatureVM = Nothing - ' aggiorno stato selezionato tutto - Map.refShowBeamPanelVM.bShowAll = False - Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False) - EgtZoom(ZM.ALL) - ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING OrElse Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE Then - ' resetto gruppo di lavorazione corrente - EgtResetCurrMachGroup() + ' aggiorno stato selezionato tutto + Map.refShowBeamPanelVM.bShowAll = False + Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False) + EgtZoom(ZM.ALL) + ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then + ' resetto gruppo di lavorazione corrente + EgtResetCurrMachGroup() + EgtBeamShowFacesName(False) + EgtBeamShowLoadingSide(False, False) ' trovo ed evidenzio MachGroup e Duplo di questo pezzo If Not IsNothing(Map.refProjectVM.MachGroupPanelVM) Then Dim MachGroupList As New List(Of MyMachGroupVM) @@ -241,6 +251,52 @@ Public Class BTLStructureVM SceneSelPartSelection() Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False) EgtZoom(ZM.ALL) + ElseIf Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE Then + If Map.refProjectVM.LastSelGridType = ProjectVM.GridSelTypes.MACHGROUP Then + ' resetto gruppo di lavorazione corrente + EgtResetCurrMachGroup() + End If + EgtBeamShowFacesName(False) + EgtBeamShowLoadingSide(False, False) + Map.refProjectVM.MacroFeature_IsEnabled = True + ' se modalità building, la tolgo + If Map.refShowBeamPanelVM.ShowBuilding_IsChecked Then + ShowBuilding(False, False) + End If + ' seleziono pezzo nella scena + SceneSelPartSelection() + ' seleziono pezzo in Db geometrico + EgtBeamSetPart(BtlPart.nPartId) + EgtBeamShowFacesName(True) + Dim bLoadingSideShow As Boolean = (nPROJTYPE = BWType.BEAM) + Dim bLeftToRight As Boolean = Not (CurrentMachine.ViewDir = VT.ISO_NW OrElse CurrentMachine.ViewDir = VT.ISO_NE) + EgtBeamShowLoadingSide(bLoadingSideShow, bLeftToRight) + ' deseleziono le feature + If Not IsNothing(BtlPart.SelBTLFeatureVM) Then SelBTLPart.SelBTLFeatureVM = Nothing + ' aggiorno stato selezionato tutto + Map.refShowBeamPanelVM.bShowAll = False + ' trovo ed evidenzio MachGroup e Duplo di questo pezzo + If Not IsNothing(Map.refProjectVM.MachGroupPanelVM) Then + Dim MachGroupList As New List(Of MyMachGroupVM) + For Each Machgroup As MyMachGroupVM In Map.refProjectVM.MachGroupPanelVM.MachGroupVMList + Dim bFound As Boolean = False + For Each Part As PartVM In Machgroup.PartVMList + If EgtDuploGetOriginal(Part.nPartId) = BtlPart.nPartId Then + Part.SetSearchFound() + bFound = True + Else + Part.ResetSearchFound() + End If + Next + If bFound Then + Machgroup.SetSearchFound() + Else + Machgroup.ResetSearchFound() + End If + Next + End If + Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False) + EgtZoom(ZM.ALL) End If NotifyPropertyChanged(NameOf(SelBTLPart)) End Sub @@ -278,7 +334,7 @@ Public Class BTLStructureVM End While End If ' seleziono pagina BottomPanel - Map.refBottomPanelVM.SetSelPartFeatureTab(BottomPanelVM.PartFeatureTab.NULL) + If Not IsNothing(Map.refBottomPanelVM) Then Map.refBottomPanelVM.SetSelPartFeatureTab(BottomPanelVM.PartFeatureTab.NULL) EgtDraw() End Sub Private Sub DeHighlightBTLPart(BtlPart As BTLPartVM, Optional bDraw As Boolean = True) @@ -314,6 +370,10 @@ Public Class BTLStructureVM Return m_SelBTLPart End Get Set(value As BTLPartVM) + If Map.refMainMenuVM.SelPage = Pages.MACHINING Or (Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE And Map.refProjectVM.LastSelGridType = ProjectVM.GridSelTypes.MACHGROUP) Then + ' resetto gruppo di lavorazione corrente + EgtResetCurrMachGroup() + End If If Not IsNothing(m_SelBTLPart) Then ' se necessario tolgo solido dal precedentemente selezionato If Map.refShowBeamPanelVM.ShowSolid_IsChecked Then @@ -345,8 +405,6 @@ Public Class BTLStructureVM Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False) EgtZoom(ZM.ALL) ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then - ' resetto gruppo di lavorazione corrente - EgtResetCurrMachGroup() ' trovo ed evidenzio MachGroup e Duplo di questo pezzo If Not IsNothing(Map.refProjectVM.MachGroupPanelVM) Then Dim MachGroupList As New List(Of MyMachGroupVM) @@ -371,6 +429,45 @@ Public Class BTLStructureVM SceneSelPartSelection() Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False) EgtZoom(ZM.ALL) + ElseIf Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE Then + ' se modalità building, la tolgo + If Map.refShowBeamPanelVM.ShowBuilding_IsChecked Then + ShowBuilding(False, False) + End If + ' seleziono pezzo nella scena + SceneSelPartSelection() + ' seleziono pezzo in Db geometrico + EgtBeamSetPart(m_SelBTLPart.nPartId) + ' seleziono pagina BottomPanel + Map.refBottomPanelVM.SetSelPartFeatureTab(BottomPanelVM.PartFeatureTab.PART) + ' mostro barra di gestione pezzo + Map.refProjectVM.NotifyPropertyChanged(NameOf(Map.refProjectVM.PartManager_Visibility)) + ' deseleziono le feature + If Not IsNothing(m_SelBTLPart.SelBTLFeatureVM) Then SelBTLPart.SelBTLFeatureVM = Nothing + ' aggiorno stato selezionato tutto + Map.refShowBeamPanelVM.bShowAll = False + ' trovo ed evidenzio MachGroup e Duplo di questo pezzo + If Not IsNothing(Map.refProjectVM.MachGroupPanelVM) Then + Dim MachGroupList As New List(Of MyMachGroupVM) + For Each Machgroup As MyMachGroupVM In Map.refProjectVM.MachGroupPanelVM.MachGroupVMList + Dim bFound As Boolean = False + For Each Part As PartVM In Machgroup.PartVMList + If EgtDuploGetOriginal(Part.nPartId) = m_SelBTLPart.nPartId Then + Part.SetSearchFound() + bFound = True + Else + Part.ResetSearchFound() + End If + Next + If bFound Then + Machgroup.SetSearchFound() + Else + Machgroup.ResetSearchFound() + End If + Next + End If + Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False) + EgtZoom(ZM.ALL) End If End If NotifyPropertyChanged(NameOf(SelBTLPart)) @@ -1336,7 +1433,7 @@ Public Class BTLStructureVM End Property Public Sub DeletePart() - If Map.refMainMenuVM.SelPage = Pages.VIEW Then Map.refLeftPanelVM.RemovePartCmd() + If Map.refMainMenuVM.SelPage = Pages.VIEW OrElse Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE Then Map.refLeftPanelVM.RemovePartCmd() End Sub #End Region ' DeletePart diff --git a/EgtBEAMWALL.ViewerOptimizer/ItemParamList/BTLPartListV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/ItemParamList/BTLPartListV.xaml.vb index 9e6a9191..db68854f 100644 --- a/EgtBEAMWALL.ViewerOptimizer/ItemParamList/BTLPartListV.xaml.vb +++ b/EgtBEAMWALL.ViewerOptimizer/ItemParamList/BTLPartListV.xaml.vb @@ -85,6 +85,8 @@ Public Class BTLPartListV ' m_MainWindowVM.SetMouseButton("Highlight") 'End If End If + ' imposto tipo di grid selezionata + If Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE Then Map.refProjectVM.SetLastSelGridType(ProjectVM.GridSelTypes.MACHGROUP) End Sub Public Shared Function FindVisualParent(Of T As DependencyObject)(ByVal child As DependencyObject) As T diff --git a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb index e934198f..04151e11 100644 --- a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb @@ -22,12 +22,12 @@ Public Class LeftPanelVM Public ReadOnly Property ViewPage_Visibility As Visibility Get - Return If(Map.refMainMenuVM.SelPage = Pages.VIEW OrElse Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE, Visibility.Visible, Visibility.Collapsed) + Return If(Map.refMainMenuVM.SelPage = Pages.VIEW, Visibility.Visible, Visibility.Collapsed) End Get End Property Public ReadOnly Property MachiningPage_Visibility As Visibility Get - Return If(Map.refMainMenuVM.SelPage = Pages.MACHINING OrElse Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE, Visibility.Visible, Visibility.Collapsed) + Return If(Map.refMainMenuVM.SelPage = Pages.MACHINING, Visibility.Visible, Visibility.Collapsed) End Get End Property diff --git a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/OnlyProdLeftPanelV.xaml b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/OnlyProdLeftPanelV.xaml index e256301b..4d4c074c 100644 --- a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/OnlyProdLeftPanelV.xaml +++ b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/OnlyProdLeftPanelV.xaml @@ -82,70 +82,60 @@