Corretta gestione rotazione pezzo nel DISP in caso che la soluzione scelta sia una prerotazione

This commit is contained in:
andrea.villa
2024-11-18 15:29:32 +01:00
parent 5aa2b5ac4d
commit 7e6d8f4172
3 changed files with 58 additions and 55 deletions
+9 -55
View File
@@ -1386,7 +1386,9 @@ function BeamExec.ProcessMachinings( PROCESSINGS, PARTS)
end
-- si calcola la combinazione di lavorazione migliore
local vProc, nInitialPosition, bSomeFeatureDown, bSomeFeatureSide = GetBestResultFromCombinationsMatrix( PROCESSINGS[nPart], PARTS[nPart])
-- salvo sul PART la posizione di partenza che è stata scelta
PARTS[nPart].nInitialPosition = nInitialPosition
-- debug
if EgtGetDebugLevel() >= 1 then
PrintFeatures( vProc, PARTS[nPart])
@@ -1422,12 +1424,8 @@ function BeamExec.ProcessMachinings( PROCESSINGS, PARTS)
-- creazione effettiva delle lavorazioni
-- se c'è almeno una lavorazione in posizionamento con trave ribaltata
if bSomeFeatureDown then
-- ribalto le travi della fase corrente
local nRId = PARTS[nPart].idRaw
while nRId do
EgtRotateRawPart( nRId, X_AX(), 180)
nRId = EgtGetNextRawPart( nRId)
end
local nRotation = EgtIf( nInitialPosition <= 2, nInitialPosition + 2, nInitialPosition + 2 - 4)
BeamLib.RotatePart( PARTS[nPart], nRotation)
EgtSetInfo( nDispId, 'ROT', -2)
bAreAllMachiningApplyOk, sErr, bSplitExecutedOnRot = MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'DOWN')
bSplitAlreadyExecuted = bSplitAlreadyExecuted or bSplitExecutedOnRot
@@ -1448,18 +1446,8 @@ function BeamExec.ProcessMachinings( PROCESSINGS, PARTS)
EgtSetInfo( nDispId, 'TYPE', 'MID')
end
end
-- vettore movimento grezzi per rotazione di 90deg
local dDeltaYZ = EgtGetRawPartBBox( PARTS[nPart].idRaw):getDimY() - EgtGetRawPartBBox( PARTS[nPart].idRaw):getDimZ()
local vtMove = Vector3d( 0, dDeltaYZ / 2 * EgtIf( BeamData.RIGHT_LOAD, -1, 1), dDeltaYZ / 2)
local bPreMove = dDeltaYZ < 0
-- ruoto le travi della fase corrente
local nRId = PARTS[nPart].idRaw
while nRId do
if bPreMove then EgtMoveRawPart( nRId, vtMove) end
EgtRotateRawPart( nRId, X_AX(), EgtIf( BeamData.RIGHT_LOAD, -90, 90))
if not bPreMove then EgtMoveRawPart( nRId, vtMove) end
nRId = EgtGetNextRawPart( nRId)
end
local nRotation = EgtIf( nInitialPosition <= 3, nInitialPosition + 1, nInitialPosition + 1 - 4)
BeamLib.RotatePart( PARTS[nPart], nRotation)
EgtSetInfo( nDispId, 'ROT', -1)
bAreAllMachiningApplyOk, sErr, bSplitExecutedOnRot = MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'SIDE')
bSplitAlreadyExecuted = bSplitAlreadyExecuted or bSplitExecutedOnRot
@@ -1479,42 +1467,8 @@ function BeamExec.ProcessMachinings( PROCESSINGS, PARTS)
end
end
-- ruoto il pezzo in caso la soluzione scelta sia con prerotazione
if nInitialPosition == 1 then
; -- il pezzo è già in posizione
elseif nInitialPosition == 2 then
local dDeltaYZ = EgtGetRawPartBBox( PARTS[nPart].idRaw):getDimY() - EgtGetRawPartBBox( PARTS[nPart].idRaw):getDimZ()
local vtMove = Vector3d( 0, dDeltaYZ / 2 * EgtIf( BeamData.RIGHT_LOAD, -1, 1), dDeltaYZ / 2)
local bPreMove = dDeltaYZ < 0
-- ruoto le travi della fase corrente
local nRId = PARTS[nPart].idRaw
while nRId do
if bPreMove then EgtMoveRawPart( nRId, vtMove) end
EgtRotateRawPart( nRId, X_AX(), EgtIf( BeamData.RIGHT_LOAD, -90, 90))
if not bPreMove then EgtMoveRawPart( nRId, vtMove) end
nRId = EgtGetNextRawPart( nRId)
end
elseif nInitialPosition == 3 then
-- ribalto le travi della fase corrente
local nRId = PARTS[nPart].idRaw
while nRId do
EgtRotateRawPart( nRId, X_AX(), 180)
nRId = EgtGetNextRawPart( nRId)
end
elseif nInitialPosition == 4 then
local dDeltaYZ = EgtGetRawPartBBox( PARTS[nPart].idRaw):getDimY() - EgtGetRawPartBBox( PARTS[nPart].idRaw):getDimZ()
local vtMove = Vector3d( 0, dDeltaYZ / 2 * EgtIf( BeamData.RIGHT_LOAD, -1, 1), dDeltaYZ / 2)
local bPreMove = dDeltaYZ < 0
-- ruoto le travi della fase corrente
local nRId = PARTS[nPart].idRaw
while nRId do
if bPreMove then EgtMoveRawPart( nRId, vtMove) end
EgtRotateRawPart( nRId, X_AX(), EgtIf( BeamData.RIGHT_LOAD, 90, -90))
if not bPreMove then EgtMoveRawPart( nRId, vtMove) end
nRId = EgtGetNextRawPart( nRId)
end
end
BeamLib.RotatePart( PARTS[nPart], nInitialPosition)
-- aggiunta lavorazioni in ultima fase
MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'STD')