From 5494838ed4c6f01d4f1dd158dd67cfd90ed68984 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Mon, 3 May 2021 19:58:59 +0200 Subject: [PATCH] Modifiche roatazione, inverti pezzi --- .../BTLParam/BTLParamVM.vb | 22 +++++--- .../BTLParam/BTLPartVM.vb | 50 +++++++++++++------ .../LeftPanel/LeftPanelVM.vb | 2 + .../Utility/LuaExec.vb | 2 +- 4 files changed, 53 insertions(+), 23 deletions(-) diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLParamVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLParamVM.vb index a448e362..34a89ea3 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLParamVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLParamVM.vb @@ -96,14 +96,14 @@ Public Class BTLParamVM Case Else ' per string non faccio nulla End Select - ' verifico che sia compreso tra minimo e massimo - If dNewValue < m_BTLParamM.dMin OrElse dNewValue > m_BTLParamM.dMax Then - MessageBox.Show("Valore non compreso tra minimo e massimo", "Error") - NotifyPropertyChanged("sValue") - Return - End If Select Case m_BTLParamM.nType Case BTLParamType.DOUBLE_, BTLParamType.LENGTH + ' verifico che sia compreso tra minimo e massimo + If dNewValue < m_BTLParamM.dMin OrElse dNewValue > m_BTLParamM.dMax Then + MessageBox.Show("Valore non compreso tra minimo e massimo", "Error") + NotifyPropertyChanged("sValue") + Return + End If UpdateParamValue(dNewValue, "") Case Else UpdateParamValue(0, value) @@ -183,6 +183,8 @@ Public Class BTLParamVM Friend Sub UpdateParamValue(dNewValue As Double, sNewValue As String, Optional bDraw As Boolean = True) ' se P If m_BTLParamM.bIsP Then + ' annullo eventuali rotazioni ed inversione + ResetRotInv() ' aggiorno la feature con nuovo valore Dim vPar() As Double = Nothing Dim sPar As String = String.Empty @@ -208,6 +210,8 @@ Public Class BTLParamVM Else NotifyPropertyChanged("sValue") End If + ' ripristino eventuali rotazioni ed inversione + If bDraw Then EgtDraw() Else ' se Q @@ -220,6 +224,12 @@ Public Class BTLParamVM End If End Sub + Private Sub ResetRotInv() + If m_BTLFeatureM.ParentPart.nINVERTED Then + + End If + End Sub + End Class 'Friend Class BTLParamDouble diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLPartVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLPartVM.vb index 3c8e5302..0db5d413 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLPartVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLPartVM.vb @@ -985,7 +985,8 @@ Public Class BTLPartVM End Get Set(value As String) Dim nTempADDED As Integer - If Integer.TryParse(value, nTempADDED) AndAlso nTempADDED > 0 AndAlso EgtSetInfo(m_BTLPartM.nPartId, BTL_PRT_ADDED, value) Then + ' verificare che non venga inserito unn numero minore di quelli gia' in prod!!!!! e dare messagio!!! + If Integer.TryParse(value, nTempADDED) AndAlso nTempADDED > 0 AndAlso nTempADDED >= nINPROD AndAlso EgtSetInfo(m_BTLPartM.nPartId, BTL_PRT_ADDED, value) Then m_BTLPartM.nADDED = nTempADDED End If NotifyPropertyChanged(NameOf(sADDED)) @@ -1432,6 +1433,13 @@ Public Class BTLPartVM ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then vtAxes = Vector3d.Z_AX End If + ' se invertito + Dim bInverted As Boolean = sINVERTED + If bInverted Then + ' annullo inversione + Inversion(b3Solid) + End If + 'eseguo rotazione If EgtRotate(nPartId, b3Solid.Center, vtAxes, dRot, GDB_RT.GLOB) Then Select Case m_BTLPartM.nROTATED Case 0 @@ -1451,10 +1459,33 @@ Public Class BTLPartVM ' aggiorno sezioni Map.refProjectVM.BTLStructureVM.UpdateSection(Section, OldSection) End If + ' se era invertito + If bInverted Then + ' ripristino inversione + Inversion(b3Solid) + End If EgtDraw() NotifyPropertyChanged(NameOf(sROTATED)) End Sub + Private Sub Inversion(b3Solid As BBox3d) + Dim vtAxes As Vector3d + ' se travi ruoto attorno all'asse Z + If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then + vtAxes = Vector3d.Z_AX + ' se pareti ruoto attorno all'asse X + ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then + vtAxes = Vector3d.X_AX + End If + ' eseguo rotazione di 180 gradi + If EgtRotate(nPartId, b3Solid.Center, vtAxes, 180, GDB_RT.GLOB) Then + m_BTLPartM.nINVERTED = If(m_BTLPartM.nINVERTED = 0, 180, 0) + EgtSetInfo(nPartId, BTL_PRT_INVERTED, m_BTLPartM.nINVERTED) + ' imposto modificato per copie + EgtDuploSetModified(nPartId) + End If + End Sub + Private Sub SwapDimForRotation() If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then ' scambio W ed H @@ -1587,21 +1618,8 @@ Public Class BTLPartVM Map.refMyStatusBarVM.SetOutputMessage("ERROR: Box non definito per la trave " & sNAM, 5, MSG_TYPE.ERROR_) Return End If - Dim vtAxes As Vector3d - ' se travi ruoto attorno all'asse Z - If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then - vtAxes = Vector3d.Z_AX - ' se pareti ruoto attorno all'asse X - ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then - vtAxes = Vector3d.X_AX - End If - ' eseguo rotazione di 180 gradi - If EgtRotate(nPartId, b3Solid.Center, vtAxes, 180, GDB_RT.GLOB) Then - m_BTLPartM.nINVERTED = If(m_BTLPartM.nINVERTED = 0, 180, 0) - EgtSetInfo(nPartId, BTL_PRT_INVERTED, m_BTLPartM.nINVERTED) - ' imposto modificato per copie - EgtDuploSetModified(nPartId) - End If + ' eseguo inversione + Inversion(b3Solid) EgtDraw() NotifyPropertyChanged(NameOf(sINVERTED)) End Sub diff --git a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb index c1e414f3..aca8fc99 100644 --- a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb @@ -177,6 +177,8 @@ Public Class LeftPanelVM Dim SelMachGroup As MachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup If IsNothing(SelMachGroup) Then Return Dim nCurrMachGroup As Integer = SelMachGroup.Id + ' verifico se sono gia' stati messi tutti i pezzi richiesti + If Not VerifyPartCount(SelPart) Then Return If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then Dim BeamMachGroup As BeamMachGroupVM = DirectCast(SelMachGroup, BeamMachGroupVM) ' verifico sezione diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/LuaExec.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/LuaExec.vb index 3a8d4959..8f0b2f65 100644 --- a/EgtBEAMWALL.ViewerOptimizer/Utility/LuaExec.vb +++ b/EgtBEAMWALL.ViewerOptimizer/Utility/LuaExec.vb @@ -98,7 +98,7 @@ Module LuaExec EgtLuaSetGlobNumVar("NEST.KERF", dKerf) EgtLuaCreateGlobTable("PART") For PartIndex = 0 To PartList.Count - 1 - EgtLuaSetGlobIntVar("PART." & PartList(PartIndex).nPartId.ToString(), PartList(PartIndex).nCNT) + EgtLuaSetGlobIntVar("PART." & PartList(PartIndex).nPartId.ToString(), PartList(PartIndex).nCNT - PartList(PartIndex).nINPROD) Next ' Eseguo lo script Dim bOk As Boolean = False