-aggiunto rotazion per travi
This commit is contained in:
@@ -767,7 +767,38 @@ Public Class BTLPartManagerVM
|
||||
End While
|
||||
Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt"
|
||||
If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
|
||||
Return False
|
||||
EgtOutLog("Fallito inserimento grezzo nella barra in AddPartToBeam")
|
||||
|
||||
' elimino duplo
|
||||
For Each nDuploId In nPartDuploIdList
|
||||
EgtErase(nDuploId)
|
||||
EgtRemoveRawPart(nDuploId)
|
||||
Next
|
||||
|
||||
' rimuovo info duplo e aggiorno info grezzo
|
||||
nPartIndex = 0
|
||||
For nIndex = 0 To BeamMachGroup.PartVMList.Count - 1
|
||||
If nPartIndex < nPartDuploIdList.Count() AndAlso BeamMachGroup.PartVMList(nIndex).dL > PartsToAdd(0).dL Then
|
||||
EgtRemoveInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + 1)
|
||||
nPartIndex += 1
|
||||
ElseIf nPartIndex < nPartDuploIdList.Count() AndAlso BeamMachGroup.PartVMList(nIndex).dL < PartsToAdd(0).dL Then
|
||||
EgtRemoveInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + 1)
|
||||
nPartIndex += 1
|
||||
End If
|
||||
EgtRemoveInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + nPartIndex + 1)
|
||||
EgtSetInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + 1, BeamMachGroup.PartVMList(nIndex).nPartId & "," & DoubleToString(BeamMachGroup.PartVMList(nIndex).dPOSX, 3))
|
||||
Next
|
||||
|
||||
' elimino vecchio grezzo ed eseguo script creazione nuovo
|
||||
nRawId = EgtGetFirstRawPart()
|
||||
While nRawId <> GDB_ID.NULL
|
||||
EgtRemoveRawPart(nRawId)
|
||||
nRawId = EgtGetFirstRawPart()
|
||||
End While
|
||||
|
||||
If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
|
||||
EgtOutLog("Fallita esecuzione ExecBeam. ERRORE")
|
||||
End If
|
||||
End If
|
||||
For nDuploIndex = 0 To PartsToAdd.Count - 1
|
||||
EgtSetInfo(nPartDuploIdList(nDuploIndex), MGR_PRT_ROT, PartsToAdd(nDuploIndex).nROTATED)
|
||||
@@ -776,7 +807,11 @@ Public Class BTLPartManagerVM
|
||||
' aggiorno lista pezzi
|
||||
BeamMachGroup.MyMachGroupM.RefreshPartList()
|
||||
' seleziono pezzo aggiunto
|
||||
If BeamMachGroup.PartVMList.Count > nInsertIndex Then BeamMachGroup.SelPart = BeamMachGroup.PartVMList(nInsertIndex)
|
||||
If BeamMachGroup.PartVMList.Count > nInsertIndex Then
|
||||
BeamMachGroup.SelPart = BeamMachGroup.PartVMList(nInsertIndex)
|
||||
Else
|
||||
BeamMachGroup.SelPart = BeamMachGroup.PartVMList(nInsertIndex - 1)
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
|
||||
@@ -201,19 +201,47 @@ Public Class PartVM
|
||||
' recupero box del layer box
|
||||
Dim b3Box As New BBox3d
|
||||
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
|
||||
If EgtRotate(nPartId, b3Box.Center, Vector3d.X_AX, 180, GDB_RT.GLOB) Then
|
||||
Dim vtAxes As Vector3d
|
||||
' se travi ruoto attorno all'asse Z
|
||||
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
|
||||
vtAxes = Vector3d.Z_AX
|
||||
' se pareti ruoto attorno all'asse X
|
||||
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
|
||||
vtAxes = Vector3d.X_AX
|
||||
End If
|
||||
If EgtRotate(nPartId, b3Box.Center, vtAxes, 180, GDB_RT.GLOB) Then
|
||||
m_PartM.nFLIP = If(value, 180, 0)
|
||||
EgtSetInfo(nPartId, MGR_PRT_FLIP, If(value, 180, 0))
|
||||
Else
|
||||
NotifyPropertyChanged(NameOf(bFLIP))
|
||||
End If
|
||||
' recupero box del pezzo
|
||||
Dim b3Part As New BBox3d
|
||||
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, b3Part)
|
||||
' calcolo distanza tra i box
|
||||
Dim vtDeltaBox As Vector3d = b3Box.Min - b3Part.Min
|
||||
' reinserisco il pezzo nel grezzo
|
||||
EgtAddPartToRawPart(nPartId, New Point3d(dTempPosX - vtDeltaBox.x, dTempPosY - vtDeltaBox.y, 0), ParentMachGroupVM.MyMachGroupM.nRawPartId)
|
||||
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
|
||||
' recupero box del pezzo
|
||||
Dim b3Part As New BBox3d
|
||||
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, b3Part)
|
||||
' calcolo distanza tra i box
|
||||
Dim vtDeltaBox As Vector3d = b3Box.Min - b3Part.Min
|
||||
' reinserisco il pezzo nel grezzo
|
||||
EgtAddPartToRawPart(nPartId, New Point3d(dTempPosX - vtDeltaBox.x, dTempPosY - vtDeltaBox.y, 0), ParentMachGroupVM.MyMachGroupM.nRawPartId)
|
||||
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
|
||||
' elimino vecchio grezzo ed eseguo script creazione nuovo
|
||||
DeleteOldRaw()
|
||||
Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt"
|
||||
If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
|
||||
EgtOutLog("Fallita creazione barra nell'ExecBeam in bFlip")
|
||||
' elimino vecchio grezzo ed eseguo script creazione nuovo
|
||||
DeleteOldRaw()
|
||||
If EgtRotate(nPartId, b3Box.Center, vtAxes, 180, GDB_RT.GLOB) Then
|
||||
m_PartM.nFLIP = 180
|
||||
EgtSetInfo(nPartId, MGR_PRT_FLIP, 180)
|
||||
Else
|
||||
NotifyPropertyChanged(NameOf(m_PartM.nFLIP))
|
||||
End If
|
||||
If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
|
||||
EgtOutLog("Fallita esecuzione ExecBeam. ERRORE")
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
' lo riseleziono
|
||||
EgtSelectObj(nPartId)
|
||||
' resetto validazione del pezzo
|
||||
@@ -293,66 +321,140 @@ Public Class PartVM
|
||||
End Sub
|
||||
|
||||
Private Sub Rotate(IsPositive As Boolean)
|
||||
' salvo posizione
|
||||
Dim dTempPosX As Double = m_PartM.dPOSX
|
||||
Dim dTempPosY As Double = m_PartM.dPOSY
|
||||
' tolgo il pezzo dal grezzo
|
||||
EgtRemovePartFromRawPart(nPartId)
|
||||
' recupero layer del box
|
||||
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
|
||||
' recupero box del layer box
|
||||
Dim b3Box As New BBox3d
|
||||
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
|
||||
' se invertito lo reinverto
|
||||
Dim bFliped As Boolean = bFLIP
|
||||
If bFliped Then EgtRotate(nPartId, b3Box.Center, Vector3d.X_AX, 180, GDB_RT.GLOB)
|
||||
Dim dAng As Double = If(IsPositive, 90, -90)
|
||||
' eseguo rotazione
|
||||
Dim bOk As Boolean = EgtRotate(nPartId, b3Box.Center, -Vector3d.Z_AX, dAng, GDB_RT.GLOB)
|
||||
If bOk Then
|
||||
Dim TempRot = m_PartM.dROT
|
||||
TempRot += dAng
|
||||
If TempRot >= 360 Then
|
||||
TempRot -= 360
|
||||
ElseIf TempRot < 0 Then
|
||||
TempRot += 360
|
||||
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
|
||||
' elimino vecchio grezzo ed eseguo script creazione nuovo
|
||||
DeleteOldRaw()
|
||||
' recupero layer del box
|
||||
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
|
||||
' recupero box del layer box
|
||||
Dim b3Box As New BBox3d
|
||||
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
|
||||
' se invertito lo reinverto
|
||||
If bFLIP Then EgtRotate(nPartId, b3Box.Center, Vector3d.Z_AX, 180, GDB_RT.GLOB)
|
||||
' eseguo rotazione attorno asse X
|
||||
Dim dRot As Integer = 0
|
||||
If dW <> dH Then
|
||||
dRot = If(IsPositive, 180, -180)
|
||||
ElseIf dW = dH Then
|
||||
dRot = If(IsPositive, 90, -90)
|
||||
End If
|
||||
m_PartM.dROT = TempRot
|
||||
EgtSetInfo(nPartId, MGR_PRT_ROT, m_PartM.dROT)
|
||||
End If
|
||||
' ripristino eventuale inversione
|
||||
If bFliped Then EgtRotate(nPartId, b3Box.Center, Vector3d.X_AX, 180, GDB_RT.GLOB)
|
||||
' recupero box del pezzo
|
||||
Dim b3Part As New BBox3d
|
||||
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, b3Part)
|
||||
'aggiorno box del box con rotazione
|
||||
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
|
||||
' calcolo distanza tra i box
|
||||
Dim vtDeltaBox As Vector3d = b3Box.Min - b3Part.Min ' Vector3d.NULL
|
||||
' calcolo posizione rispetto al riferimento
|
||||
Select Case Map.refProjectVM.BTLStructureVM.nPROJTYPE
|
||||
Case BWType.WALL
|
||||
' se parete, valuto angolo di posizionamento
|
||||
Select Case CurrentMachine.NestingCorner
|
||||
Case MCH_CR.TL
|
||||
'vtDeltaBox = New Vector3d(b3Box.Min.x - b3Part.Min.x, b3Box.Max.y - b3Part.Max.y, 0)
|
||||
dTempPosY = dTempPosY - dW + dL
|
||||
Case MCH_CR.BL
|
||||
Dim bOk As Boolean = EgtRotate(nPartId, b3Box.Center, Vector3d.X_AX, dRot, GDB_RT.GLOB)
|
||||
If bOk Then
|
||||
Dim TempRot = m_PartM.dROT
|
||||
TempRot += dRot
|
||||
If TempRot >= 360 Then
|
||||
TempRot -= 360
|
||||
ElseIf TempRot < 0 Then
|
||||
TempRot += 360
|
||||
End If
|
||||
m_PartM.dROT = TempRot
|
||||
EgtSetInfo(nPartId, MGR_PRT_ROT, m_PartM.dROT)
|
||||
End If
|
||||
' ripristino eventuale inversione
|
||||
If bFLIP Then EgtRotate(nPartId, b3Box.Center, Vector3d.Z_AX, 180, GDB_RT.GLOB)
|
||||
Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt"
|
||||
If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
|
||||
EgtOutLog("Fallita creazione barra nell'ExecBeam in Rotate")
|
||||
' elimino vecchio grezzo ed eseguo script creazione nuovo
|
||||
DeleteOldRaw()
|
||||
' annullo Flip
|
||||
If bFLIP Then EgtRotate(nPartId, b3Box.Center, Vector3d.Z_AX, 180, GDB_RT.GLOB)
|
||||
' ripristino rotazione
|
||||
Dim dRotation As Integer = 0
|
||||
If dW <> dH Then
|
||||
dRotation = m_PartM.dROT + dRot
|
||||
m_PartM.dROT = dRotation
|
||||
If dRotation >= 360 Then
|
||||
dRotation = dRot
|
||||
m_PartM.dROT = 0
|
||||
End If
|
||||
ElseIf dW = dH Then
|
||||
dRotation = m_PartM.dROT - dRot
|
||||
If dRotation = 0 Then
|
||||
dRotation = 3 * dRot
|
||||
m_PartM.dROT = 0
|
||||
ElseIf dRotation = 90 Then
|
||||
dRotation += 2 * dRot
|
||||
m_PartM.dROT = 90
|
||||
ElseIf dRotation = 180 Then
|
||||
dRotation += dRot
|
||||
m_PartM.dROT = 180
|
||||
ElseIf dRotation < 0 Then
|
||||
dRotation += 4 * dRot
|
||||
m_PartM.dROT = 270
|
||||
End If
|
||||
End If
|
||||
EgtRotate(nPartId, b3Box.Center, Vector3d.X_AX, dRotation, GDB_RT.GLOB)
|
||||
' salvo informazione
|
||||
EgtSetInfo(nPartId, MGR_PRT_ROT, m_PartM.dROT)
|
||||
' annullo Flip
|
||||
If bFLIP Then EgtRotate(nPartId, b3Box.Center, Vector3d.Z_AX, 180, GDB_RT.GLOB)
|
||||
If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
|
||||
EgtOutLog("Fallita esecuzione ExecBeam. ERRORE")
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(m_PartM.dROT))
|
||||
End If
|
||||
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
|
||||
' salvo posizione
|
||||
Dim dTempPosX As Double = m_PartM.dPOSX
|
||||
Dim dTempPosY As Double = m_PartM.dPOSY
|
||||
' tolgo il pezzo dal grezzo
|
||||
EgtRemovePartFromRawPart(nPartId)
|
||||
' recupero layer del box
|
||||
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
|
||||
' recupero box del layer box
|
||||
Dim b3Box As New BBox3d
|
||||
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
|
||||
' se invertito lo reinverto
|
||||
If bFLIP Then EgtRotate(nPartId, b3Box.Center, Vector3d.X_AX, 180, GDB_RT.GLOB)
|
||||
Dim dAng As Double = If(IsPositive, 90, -90)
|
||||
' eseguo rotazione
|
||||
Dim bOk As Boolean = EgtRotate(nPartId, b3Box.Center, -Vector3d.Z_AX, dAng, GDB_RT.GLOB)
|
||||
If bOk Then
|
||||
Dim TempRot = m_PartM.dROT
|
||||
TempRot += dAng
|
||||
If TempRot >= 360 Then
|
||||
TempRot -= 360
|
||||
ElseIf TempRot < 0 Then
|
||||
TempRot += 360
|
||||
End If
|
||||
m_PartM.dROT = TempRot
|
||||
EgtSetInfo(nPartId, MGR_PRT_ROT, m_PartM.dROT)
|
||||
End If
|
||||
' ripristino eventuale inversione
|
||||
If bFLIP Then EgtRotate(nPartId, b3Box.Center, Vector3d.X_AX, 180, GDB_RT.GLOB)
|
||||
' recupero box del pezzo
|
||||
Dim b3Part As New BBox3d
|
||||
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, b3Part)
|
||||
'aggiorno box del box con rotazione
|
||||
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
|
||||
' calcolo distanza tra i box
|
||||
Dim vtDeltaBox As Vector3d = b3Box.Min - b3Part.Min ' Vector3d.NULL
|
||||
' calcolo posizione rispetto al riferimento
|
||||
Select Case Map.refProjectVM.BTLStructureVM.nPROJTYPE
|
||||
Case BWType.WALL
|
||||
' se parete, valuto angolo di posizionamento
|
||||
Select Case CurrentMachine.NestingCorner
|
||||
Case MCH_CR.TL
|
||||
'vtDeltaBox = New Vector3d(b3Box.Min.x - b3Part.Min.x, b3Box.Max.y - b3Part.Max.y, 0)
|
||||
dTempPosY = dTempPosY - dW + dL
|
||||
Case MCH_CR.BL
|
||||
'vtDeltaBox = b3Box.Min - b3Part.Min
|
||||
' non cambio posizioni
|
||||
Case MCH_CR.TR
|
||||
'vtDeltaBox = b3Box.Max - b3Part.Max
|
||||
dTempPosX = dTempPosX - dL + dW
|
||||
dTempPosY = dTempPosY - dW + dL
|
||||
Case MCH_CR.BR
|
||||
'vtDeltaBox = New Vector3d(b3Box.Max.x - b3Part.Max.x, b3Box.Min.y - b3Part.Min.y, 0)
|
||||
dTempPosX = dTempPosX - dL + dW
|
||||
End Select
|
||||
Case Else
|
||||
' non cambio nulla
|
||||
End Select
|
||||
' reinserisco il pezzo nel grezzo
|
||||
EgtAddPartToRawPart(nPartId, New Point3d(dTempPosX - vtDeltaBox.x, dTempPosY - vtDeltaBox.y, 0), ParentMachGroupVM.MyMachGroupM.nRawPartId)
|
||||
Case MCH_CR.TR
|
||||
'vtDeltaBox = b3Box.Max - b3Part.Max
|
||||
dTempPosX = dTempPosX - dL + dW
|
||||
dTempPosY = dTempPosY - dW + dL
|
||||
Case MCH_CR.BR
|
||||
'vtDeltaBox = New Vector3d(b3Box.Max.x - b3Part.Max.x, b3Box.Min.y - b3Part.Min.y, 0)
|
||||
dTempPosX = dTempPosX - dL + dW
|
||||
End Select
|
||||
Case Else
|
||||
' non cambio nulla
|
||||
End Select
|
||||
' reinserisco il pezzo nel grezzo
|
||||
EgtAddPartToRawPart(nPartId, New Point3d(dTempPosX - vtDeltaBox.x, dTempPosY - vtDeltaBox.y, 0), ParentMachGroupVM.MyMachGroupM.nRawPartId)
|
||||
End If
|
||||
' lo riseleziono
|
||||
EgtSelectObj(nPartId)
|
||||
' resetto validazione del pezzo
|
||||
@@ -360,6 +462,14 @@ Public Class PartVM
|
||||
NotifyPropertyChanged(NameOf(sROT))
|
||||
End Sub
|
||||
|
||||
Private Sub DeleteOldRaw()
|
||||
Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
While nRawId <> GDB_ID.NULL
|
||||
EgtRemoveRawPart(nRawId)
|
||||
nRawId = EgtGetFirstRawPart()
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Friend Sub SelectBTLPart()
|
||||
' eseguo la selezione nella lista pezzi
|
||||
Dim nBTLPartId As Integer = MyMachGroupPanelM.DuploGetOriginal(nPartId)
|
||||
|
||||
Reference in New Issue
Block a user