- 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:
+18
-14
@@ -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')
|
||||
|
||||
+8
-4
@@ -106,6 +106,8 @@ end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.AddPhaseWithRawParts( nRawId, OriXR, PosXR, dDeltaSucc)
|
||||
EgtAddPhase()
|
||||
-- si aprono i limiti tavola per permettere rotazioni di pezzi più larghi della tavola
|
||||
EgtSetTableAreaOffset( 2000, 2000, 2000, 2000)
|
||||
local dRawMove = 0
|
||||
while nRawId do
|
||||
EgtKeepRawPart( nRawId)
|
||||
@@ -182,8 +184,8 @@ function BeamLib.ConvertToClosedCurve( Proc, AuxId)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
--- funzione che ruota il pezzo, da lanciare per creare la disposizione corretta
|
||||
function BeamLib.RotatePart( Part, nNumberOfRotations)
|
||||
--- funzione che ruota il grezzo
|
||||
function BeamLib.RotateRawPart( Part, nNumberOfRotations)
|
||||
-- sistemo numero rotazioni in caso sia negativa
|
||||
if nNumberOfRotations < 0 then
|
||||
nNumberOfRotations = nNumberOfRotations + 4
|
||||
@@ -200,7 +202,8 @@ function BeamLib.RotatePart( Part, nNumberOfRotations)
|
||||
local nRId = Part.idRaw
|
||||
while nRId do
|
||||
if bPreMove then EgtMoveRawPart( nRId, vtMove) end
|
||||
EgtRotateRawPart( nRId, X_AX(), EgtIf( BeamData.RIGHT_LOAD, -90, 90))
|
||||
local bIsRotationOK = EgtRotateRawPart( nRId, X_AX(), EgtIf( BeamData.RIGHT_LOAD, -90, 90))
|
||||
if not bIsRotationOK then error( 'UNEXPECTED ERROR: rotation of the raw not executed') end
|
||||
if not bPreMove then EgtMoveRawPart( nRId, vtMove) end
|
||||
nRId = EgtGetNextRawPart( nRId)
|
||||
end
|
||||
@@ -221,7 +224,8 @@ function BeamLib.RotatePart( Part, nNumberOfRotations)
|
||||
local nRId = Part.idRaw
|
||||
while nRId do
|
||||
if bPreMove then EgtMoveRawPart( nRId, vtMove) end
|
||||
EgtRotateRawPart( nRId, X_AX(), EgtIf( BeamData.RIGHT_LOAD, 90, -90))
|
||||
local bIsRotationOK = EgtRotateRawPart( nRId, X_AX(), EgtIf( BeamData.RIGHT_LOAD, 90, -90))
|
||||
if not bIsRotationOK then error( 'UNEXPECTED ERROR: rotation of the raw not executed') end
|
||||
if not bPreMove then EgtMoveRawPart( nRId, vtMove) end
|
||||
nRId = EgtGetNextRawPart( nRId)
|
||||
end
|
||||
|
||||
@@ -894,15 +894,15 @@ function MachiningLib.AddOperations( vProc, Part, sRotation)
|
||||
local nDispId = EgtGetPhaseDisposition( nPhase)
|
||||
|
||||
if sRotation == 'DOWN' then
|
||||
BeamLib.RotatePart( Part, Part.nInitialPosition - 3)
|
||||
BeamLib.RotateRawPart( Part, Part.nInitialPosition - 3)
|
||||
EgtSetInfo( nDispId, 'ROT', -2)
|
||||
EgtSetInfo( nDispId, 'TYPE', 'MID2')
|
||||
elseif sRotation == 'SIDE' then
|
||||
BeamLib.RotatePart( Part, Part.nInitialPosition - 2)
|
||||
BeamLib.RotateRawPart( Part, Part.nInitialPosition - 2)
|
||||
EgtSetInfo( nDispId, 'ROT', -1)
|
||||
EgtSetInfo( nDispId, 'TYPE', 'MID2')
|
||||
else
|
||||
BeamLib.RotatePart( Part, Part.nInitialPosition - 1)
|
||||
BeamLib.RotateRawPart( Part, Part.nInitialPosition - 1)
|
||||
EgtSetInfo( nDispId, 'TYPE', 'END')
|
||||
end
|
||||
EgtSetInfo( nDispId, 'ORD', MACHININGS[i].Proc.nIndexPartInParts)
|
||||
|
||||
Reference in New Issue
Block a user