Compare commits

...

4 Commits

Author SHA1 Message Date
Demetrio Cassarino ecaedb0ed2 controllo errore script aggiunta pezzo 2024-01-24 10:31:25 +01:00
Demetrio Cassarino 9a0f478529 -aggiunto controllo quando execbeam fallisce 2024-01-18 17:52:24 +01:00
Demetrio Cassarino 70761248ff aggiunto a travi, rotazione e inversione 2024-01-17 09:17:16 +01:00
Demetrio Cassarino ef59f66c67 -correzione dulo ghost
-correzione deleteduplo
2023-12-21 08:48:39 +01:00
7 changed files with 237 additions and 73 deletions
+2
View File
@@ -144,6 +144,8 @@
Public Const BTL_PRT_INVERTED As String = "INVERTED"
Public Const BTL_PRT_MATERIAL As String = "MATERIAL"
Public Const BTL_PRT_VOLUME As String = "VOLUME"
Public Const BTL_PRT_ROT As String = "ROT"
Public Const BTL_PRT_FLIP As String = "FLIP"
' parametri pezzo
Public Const BTL_PRT_SINGLEMEMBERNUM = "SINGLEMEMBERNUMBER"
Public Const BTL_PRT_ASSEMBLYNUM = "ASSEMBLYNUMBER"
+2
View File
@@ -482,6 +482,8 @@ Public Class PartM
EgtGetInfo(nPartId, BTL_PRT_GROUP, NewPartM.m_sGROUP)
EgtGetInfo(nPartId, BTL_PRT_STOREY, NewPartM.m_sSTOREY)
EgtGetInfo(nPartId, BTL_PRT_MATERIAL, NewPartM.m_sMATERIAL)
EgtGetInfo(nPartId, BTL_PRT_ROT, NewPartM.m_dROT)
EgtGetInfo(nPartId, BTL_PRT_FLIP, NewPartM.m_nFLIP)
Dim nTemp As Integer = 0
If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
nTemp = 0
@@ -93,10 +93,14 @@ Public Class BTLPartVM
Dim LSTValues() As String = sSwapItem.Split(","c)
If Not IsNothing(LSTValues(LSTValues.Count - 1)) AndAlso Integer.TryParse(LSTValues(LSTValues.Count - 1), nSwapItem) AndAlso nSwapItem > 0 Then
Dim nMachgroupId As Integer = EgtGetParent(EgtGetParent(EgtGetParent(nSwapItem)))
Dim MachGroupModel = DbControllers.m_MachGroupController.FindByMachGroupId(Map.refProjManagerVM.CurrProj.nProdId, nMachgroupId)
If MachGroupModel.State > ItemState.ND Then
bDuploInProduction = True
Exit For
If nMachgroupId = GDB_ID.NULL Then
EgtOutLog("Trovato Duplo Ghost")
Else
Dim MachGroupModel = DbControllers.m_MachGroupController.FindByMachGroupId(Map.refProjManagerVM.CurrProj.nProdId, nMachgroupId)
If MachGroupModel.State > ItemState.ND Then
bDuploInProduction = True
Exit For
End If
End If
End If
Next
@@ -398,7 +398,8 @@ Public Class BTLStructureVM
End If
End If
SelBTLParts.AddToList(SelBTLPart)
If Not IsNothing(SelBTLPart) Then SelBTLParts.AddToList(SelBTLPart)
If bByOptim Then
m_bOnlySelectItem = False
End If
@@ -794,6 +794,12 @@ Public Class LeftPanelVM
EgtSetMode(nDuploId, GDB_MD.STD)
nPartDuploIdList.Add(nDuploId)
Next
'' salvo lista info
Dim saveInfoBeamList As MyMachGroupVM = BeamMachGroup
'Dim saveInfoBeamList As New List(Of PartVM)
'For Each info As PartVM In BeamMachGroup.PartVMList
' saveInfoBeamList.Add(info)
'Next
' calcolo posizione nuovo pezzo per rispettare ordine lunghezze
Dim nInsertIndex As Integer
' scrivo dati di tutti i pezzi
@@ -852,7 +858,38 @@ Public Class LeftPanelVM
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)
@@ -861,7 +898,11 @@ Public Class LeftPanelVM
' 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
@@ -172,13 +172,17 @@ Public Class MyMachGroupPanelVM
' elimino pezzo copia
EgtRemovePartFromRawPart(nDuploId)
EgtErase(nDuploId)
'' recupero gruppo di lavorazione e trave dell'interfaccia
' recupero gruppo di lavorazione e trave dell'interfaccia
Dim BeamMachGroup As MyMachGroupVM = MachGroupVMList.FirstOrDefault(Function(x) x.Id = nMachGroupId)
If Not IsNothing(BeamMachGroup) Then
Dim Beam As PartVM = BeamMachGroup.PartVMList.FirstOrDefault(Function(x) x.nPartId = nDuploId)
EgtSetCurrMachGroup(BeamMachGroup.Id)
Beam.DeletePart()
End If
' reset necessario per poter ottenere nMachGroupId corretto
EgtResetCurrMachGroup()
' aggiorno dati utilizzo barra
BeamMachGroup.UpdateUsage()
Next
' aggiorno quantita' in prod
Dim BTLPart As BTLPartVM = CALCPanelVM.GetBTLPartVMFromBTLPartId(nPartId)
@@ -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
@@ -289,66 +317,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
@@ -356,6 +458,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)