diff --git a/EgtBEAMWALL.Core/OpenProjectFileDialog/OpenProjectFileDialogVM.vb b/EgtBEAMWALL.Core/OpenProjectFileDialog/OpenProjectFileDialogVM.vb index dd51dc74..0079a173 100644 --- a/EgtBEAMWALL.Core/OpenProjectFileDialog/OpenProjectFileDialogVM.vb +++ b/EgtBEAMWALL.Core/OpenProjectFileDialog/OpenProjectFileDialogVM.vb @@ -280,9 +280,11 @@ Public MustInherit Class OpenProjectFileDialogVM If IsNothing(SelProject) Then Return False Dim AllFilesInDir As IEnumerable(Of String) = Nothing If m_ProjectType = Core.ConstBeam.ProjectType.PROJ Then + If String.IsNullOrWhiteSpace(SelProject.sProjDirPath) OrElse Not File.Exists(SelProject.sProjDirPath) Then Return False ' verifico se esiste ProdId AllFilesInDir = IO.Directory.EnumerateFiles(SelProject.sProjDirPath) ElseIf m_ProjectType = Core.ConstBeam.ProjectType.PROD Then + If String.IsNullOrWhiteSpace(SelProject.sProdDirPath) OrElse Not File.Exists(SelProject.sProdDirPath) Then Return False AllFilesInDir = IO.Directory.EnumerateFiles(SelProject.sProdDirPath) Else Return False diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLStructureVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLStructureVM.vb index 217f0f4d..72532d8f 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLStructureVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLStructureVM.vb @@ -60,8 +60,6 @@ Public Class BTLStructureVM Else ' mostro in parte bassa dati BTL Map.refBottomPanelVM.SetSelPartFeatureTab(BottomPanelVM.PartFeatureTab.STRUCTURE_) - ' disabilito bottone per solido - Map.refShowBeamPanelVM.SetShowSolid_IsEnabled(False) ' mostro pezzi selezionati Map.refProjectVM.BTLStructureVM.ShowAll(False, True) Core.ViewPanelVM.BWSetView(VT.ISO_SW, False) @@ -259,6 +257,15 @@ Public Class BTLStructureVM End If End Set End Property + Friend Sub SetSelSection(value As SectionXMaterial) + If Not IsNothing(value) Then + m_SelSection = value + m_BTLPartVMList_View.Refresh() + m_GroupList_View.Refresh() + m_SubGroupList_View.Refresh() + End If + NotifyPropertyChanged(NameOf(SelSection)) + End Sub Private m_SearchText As String = "" Public Property SearchText As String @@ -782,7 +789,6 @@ Public Class BTLStructureVM If Not IsNothing(SelBTLPart) Then ' se pezzo solido, lo riporto normale If Map.refShowBeamPanelVM.ShowSolid_IsChecked Then - ShowSolid(False) Map.refShowBeamPanelVM.SetShowSolid(False) End If ' tolgo pezzo selezionato diff --git a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb index f4024b29..59be0adf 100644 --- a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb @@ -927,9 +927,18 @@ Public Class LeftPanelVM ''' Public Sub BackRotation() If IsNothing(Map.refProjManagerVM.CurrProj) OrElse IsNothing(Map.refProjectVM.BTLStructureVM) Then Return + ' salvo sezione impostata + Dim CurrSection As SectionXMaterial = Map.refProjectVM.BTLStructureVM.SelSection + ' ruoto i pezzi selezionati For Each Part In Map.refProjectVM.BTLStructureVM.SelBTLPartList Part.BackRotation() Next + ' se progetto travi e sezione precedente diversa da vuota (tutti i pezzi) + If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM AndAlso CurrSection <> SectionXMaterial.Empty Then + ' se esiste, imposto sezione inversa + Dim InverseSection As SectionXMaterial = Map.refProjectVM.BTLStructureVM.SectionList.FirstOrDefault(Function(x) x.dH = CurrSection.dW AndAlso x.dW = CurrSection.dH AndAlso x.sMaterial(0) = CurrSection.sMaterial(0)) + If Not IsNothing(InverseSection) Then Map.refProjectVM.BTLStructureVM.SetSelSection(InverseSection) + End If End Sub #End Region ' BackRotation @@ -953,9 +962,18 @@ Public Class LeftPanelVM ''' Public Sub ForwardRotation() If IsNothing(Map.refProjManagerVM.CurrProj) OrElse IsNothing(Map.refProjectVM.BTLStructureVM) Then Return + ' salvo sezione impostata + Dim CurrSection As SectionXMaterial = Map.refProjectVM.BTLStructureVM.SelSection + ' ruoto i pezzi selezionati For Each Part In Map.refProjectVM.BTLStructureVM.SelBTLPartList Part.ForwardRotation() Next + ' se progetto travi e sezione precedente diversa da vuota (tutti i pezzi) + If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM AndAlso CurrSection <> SectionXMaterial.Empty Then + ' se esiste, imposto sezione inversa + Dim InverseSection As SectionXMaterial = Map.refProjectVM.BTLStructureVM.SectionList.FirstOrDefault(Function(x) x.dH = CurrSection.dW AndAlso x.dW = CurrSection.dH AndAlso x.sMaterial(0) = CurrSection.sMaterial(0)) + If Not IsNothing(InverseSection) Then Map.refProjectVM.BTLStructureVM.SetSelSection(InverseSection) + End If End Sub #End Region ' ForwardRotation diff --git a/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogVM.vb b/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogVM.vb index 8d45d0c8..96a59177 100644 --- a/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogVM.vb @@ -23,21 +23,45 @@ Public Class OpenProjectFileDialogVM Dim DbProjectList As New List(Of ProjFileM) DbProjectList = DbControllers.m_ProjController.GetLastDesc(5000) For Each Project In DbProjectList - m_ProjectList.Add(New ProjFileVM(Project)) + ' recupero path per verificare esista + If IsNothing(Project.nProjId) OrElse Project.nProjId = 0 Then Continue For + Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProjsDir & "\" & Project.nProjId.ToString("0000") & "\" & Project.nProjId.ToString("0000") & ".nge" + If File.Exists(sPath) Then + m_ProjectList.Add(New ProjFileVM(Project)) + Else + DbControllers.m_ProjController.DeleteProj(Project.nProjId) + EgtOutLog("Found project on Db without the folder and erased it! Proj number " & Project.nProjId.ToString("0000")) + End If Next ElseIf ProjectType = ProjectType.PROD Then Dim DbProjectList As New List(Of ProdFileM) DbProjectList = DbControllers.m_ProdController.GetLastDesc(5000) If GoToProd Then For Each Project In DbProjectList + ' recupero path per verificare esista + If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For + Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge" If Project.sMachine = Map.refProjManagerVM.CurrProj.sMachine AndAlso Project.nType = Map.refProjManagerVM.CurrProj.nType Then - m_ProjectList.Add(New ProdFileVM(Project)) + If File.Exists(sPath) Then + m_ProjectList.Add(New ProdFileVM(Project)) + Else + DbControllers.m_ProdController.DeleteProd(Project.nProdId) + EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000")) + End If End If Next Else For Each Project In DbProjectList - m_ProjectList.Add(New ProdFileVM(Project)) + ' recupero path per verificare esista + If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For + Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge" + If File.Exists(sPath) Then + m_ProjectList.Add(New ProdFileVM(Project)) + Else + DbControllers.m_ProdController.DeleteProd(Project.nProdId) + EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000")) + End If Next End If End If diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb index ae7fa0e5..0ed81c60 100644 --- a/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb @@ -1187,7 +1187,6 @@ Public Class ProjManagerVM AsseBaseId = EgtGetNextName(AsseBaseId, ASSEBASE) End While - ' EgtSaveFile("C:\Temp\ProvaUpdateProj.nge", NGE.CMPTEXT) ' calcolo BBox globale del progetto corrente Dim b3Parts As New BBox3d Dim nProjPartId As Integer = EgtGetFirstPart() @@ -1268,6 +1267,11 @@ Public Class ProjManagerVM ' aggiungo pezzo alla lista Map.refProjectVM.BTLStructureVM.BTLStructureM.AddBTLPart(NewPart) Dim AddedBTLPart As BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList.FirstOrDefault(Function(x) x.BTLPartM Is NewPart) + ' se progetto pareti e vista ruotata + If nType = BWType.WALL AndAlso (CurrentMachine.ViewDir = VT.ISO_NW OrElse CurrentMachine.ViewDir = VT.ISO_NE) Then + ' ruoto le pareti di 180 per raddrizzarle rispetto alla vista + AddedBTLPart.Rotation(True, Map.refProjectVM.BTLStructureVM.nPROJTYPE, 180, False) + End If ' verifico se aggiungere sezione alla lista If Not Map.refProjectVM.BTLStructureVM.SectionList.Contains(AddedBTLPart.Section) Then Map.refProjectVM.BTLStructureVM.SectionList.Add(AddedBTLPart.Section)