Modifiche roatazione, inverti pezzi

This commit is contained in:
Emmanuele Sassi
2021-05-03 19:58:59 +02:00
parent c5308cb6f5
commit 5494838ed4
4 changed files with 53 additions and 23 deletions
@@ -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
@@ -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
@@ -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
@@ -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