- Aggiunto offset tavola per permettere rotazioni

- Cambio nome da RotatePart a RotateRawPart perchè in effetti viene ruotato il grezzo e non il pezzo
This commit is contained in:
andrea.villa
2025-05-16 16:18:45 +02:00
parent 8a127f39ee
commit dd7c98229c
3 changed files with 29 additions and 21 deletions
+18 -14
View File
@@ -1122,13 +1122,13 @@ local function CalculateMachinings( vProc, Part, nInitialRotation)
if Proc.nFlg ~= 0 then
-- si sistemano i pezzi per le rotazioni
if Proc.bDown and nCurrRotation ~= n180Rotation then
BeamLib.RotatePart( Part, n180Rotation - nCurrRotation)
BeamLib.RotateRawPart( Part, n180Rotation - nCurrRotation)
nCurrRotation = n180Rotation
elseif Proc.bSide and nCurrRotation ~= n90Rotation then
BeamLib.RotatePart( Part, n90Rotation - nCurrRotation)
BeamLib.RotateRawPart( Part, n90Rotation - nCurrRotation)
nCurrRotation = n90Rotation
elseif nCurrRotation ~= n0Rotation and not( Proc.bSide) and not( Proc.bDown) then
BeamLib.RotatePart( Part, n0Rotation - nCurrRotation)
BeamLib.RotateRawPart( Part, n0Rotation - nCurrRotation)
nCurrRotation = n0Rotation
end
-- aggiorno info pezzo
@@ -1156,7 +1156,7 @@ local function CalculateMachinings( vProc, Part, nInitialRotation)
-- ripristino pezzo in posizione originale
if nCurrRotation ~= 1 then
BeamLib.RotatePart( Part, 1 - nCurrRotation)
BeamLib.RotateRawPart( Part, 1 - nCurrRotation)
-- aggiorno info pezzo
Part.b3Raw = EgtGetRawPartBBox( Part.idRaw)
Part.b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( Part.id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
@@ -1184,6 +1184,10 @@ function BeamExec.GetProcessings( PARTS)
-- if EgtGetDebugLevel() >= 3 then
-- EgtStartCounter()
-- end
-- si aprono i limiti tavola per permettere rotazioni di pezzi più larghi della tavola
EgtSetTableAreaOffset( 2000, 2000, 2000, 2000)
for nPart = 1, #PARTS do
if not PARTS[nPart].id and PARTS[nPart].b3Raw:getDimX() < BeamData.dMinRaw then break end
local vProcRot = {}
@@ -1202,7 +1206,7 @@ function BeamExec.GetProcessings( PARTS)
table.insert( vProcRot, {})
end
-- rotazione pezzo di 90° per volta
BeamLib.RotatePart( PARTS[nPart], 1)
BeamLib.RotateRawPart( PARTS[nPart], 1)
-- aggiorno info pezzo
PARTS[nPart].b3Raw = EgtGetRawPartBBox( PARTS[nPart].idRaw)
PARTS[nPart].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[nPart].id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
@@ -1504,11 +1508,11 @@ function BeamExec.ProcessMachinings( PARTS)
end
-- si sposta il pezzo nella posizione originale, di quando è stata fatta la collect. In questo modo tutti i dati calcolati nella collect restano validi.
-- Altrimenti bisognava ricalcolare tutto, aumentando tempo di calcolo.
local b3RawOffsetPosX = PARTS[nPart].b3Raw:getMin()[1] - EgtGetRawPartBBox( PARTS[nPart].idRaw):getMin()[1]
local vtRawOffsetPos = PARTS[nPart].b3Raw:getMin() - EgtGetRawPartBBox( PARTS[nPart].idRaw):getMin()
local nRawId = PARTS[nPart].idRaw
while nRawId and abs( b3RawOffsetPosX) > 0 do
while nRawId and abs( vtRawOffsetPos:len()) > 0 do
EgtKeepRawPart( nRawId)
EgtMoveRawPart( nRawId, Vector3d( b3RawOffsetPosX, 0, 0))
EgtMoveRawPart( nRawId, vtRawOffsetPos)
nRawId = EgtGetNextRawPart( nRawId)
end
@@ -1519,7 +1523,7 @@ function BeamExec.ProcessMachinings( PARTS)
-- tra le calcolate, sceglie la migliore
PROCESSINGS[nPart].Rotation[dRotIndex] = GetBestStrategy( PROCESSINGS[nPart].Rotation[dRotIndex])
-- rotazione pezzo di 90° per volta
BeamLib.RotatePart( PARTS[nPart], 1)
BeamLib.RotateRawPart( PARTS[nPart], 1)
-- aggiorno info pezzo
PARTS[nPart].b3Raw = EgtGetRawPartBBox( PARTS[nPart].idRaw)
PARTS[nPart].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[nPart].id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
@@ -1625,9 +1629,9 @@ function BeamExec.ProcessMachinings( PARTS)
-- finiti i calcoli di applicazione delle lavorazioni, si riporta il pezzo nello zero della fase
nRawId = PARTS[nPart].idRaw
while nRawId and abs( b3RawOffsetPosX) > 0 do
while nRawId and abs( vtRawOffsetPos:len()) > 0 do
EgtKeepRawPart( nRawId)
EgtMoveRawPart( nRawId, Vector3d( -b3RawOffsetPosX, 0, 0))
EgtMoveRawPart( nRawId, -vtRawOffsetPos)
nRawId = EgtGetNextRawPart( nRawId)
end
@@ -1647,7 +1651,7 @@ function BeamExec.ProcessMachinings( PARTS)
-- se c'è almeno una lavorazione in posizionamento con trave ribaltata
if MatrixResult.bSomeFeatureDown then
local nRotation = EgtIf( nInitialPosition + 2 > 4, nInitialPosition + 2 - 4, nInitialPosition + 2)
BeamLib.RotatePart( PARTS[nPart], nRotation - nCurrPosition)
BeamLib.RotateRawPart( PARTS[nPart], nRotation - nCurrPosition)
nCurrPosition = nRotation
EgtSetInfo( nDispId, 'ROT', -2)
bAreAllMachiningApplyOk, sErr, bSplitExecutedOnRot = MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'DOWN')
@@ -1670,7 +1674,7 @@ function BeamExec.ProcessMachinings( PARTS)
end
end
local nRotation = EgtIf( nInitialPosition + 1 > 4, nInitialPosition + 1 - 4, nInitialPosition + 1)
BeamLib.RotatePart( PARTS[nPart], nRotation - nCurrPosition)
BeamLib.RotateRawPart( PARTS[nPart], nRotation - nCurrPosition)
nCurrPosition = nRotation
EgtSetInfo( nDispId, 'ROT', -1)
bAreAllMachiningApplyOk, sErr, bSplitExecutedOnRot = MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'SIDE')
@@ -1691,7 +1695,7 @@ function BeamExec.ProcessMachinings( PARTS)
end
end
BeamLib.RotatePart( PARTS[nPart], nInitialPosition - 1)
BeamLib.RotateRawPart( PARTS[nPart], nInitialPosition - 1)
-- aggiunta lavorazioni in ultima fase
MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'STD')