Merge branch 'develop' into STR0004_Splitting

This commit is contained in:
luca.mazzoleni
2024-11-18 17:32:26 +01:00
3 changed files with 64 additions and 61 deletions
+15 -61
View File
@@ -259,19 +259,19 @@ local function IsCombinationAvailable( sCombination, nUnloadPos, bSquareSection)
end
-- ADVANCED : come BASIC ma ammesse anche le prerotazioni (posizione di scarico può essere diversa da posizione iniziale)
elseif BEAM.Rotation.bAdvanced then
local Rotation90 = EgtIf( nUnloadPos + 1 > 4, nUnloadPos + 1 - 4, nUnloadPos + 1)
local Rotation180 = EgtIf( nUnloadPos + 2 > 4, nUnloadPos + 2 - 4, nUnloadPos + 2)
local ExtraRotation = EgtIf( nUnloadPos + 3 > 4, nUnloadPos + 3 - 4, nUnloadPos + 3)
local nRotation90 = EgtIf( nUnloadPos + 1 > 4, nUnloadPos + 1 - 4, nUnloadPos + 1)
local nRotation180 = EgtIf( nUnloadPos + 2 > 4, nUnloadPos + 2 - 4, nUnloadPos + 2)
local nExtraRotation = EgtIf( nUnloadPos + 3 > 4, nUnloadPos + 3 - 4, nUnloadPos + 3)
if not bSquareSection and ( nUnloadPos == 2 or nUnloadPos == 4) then
return false
else
if string.sub( sCombination, nUnloadPos, nUnloadPos) ~= '1' or string.sub( sCombination, ExtraRotation, ExtraRotation) == '1' then
if string.sub( sCombination, nUnloadPos, nUnloadPos) ~= '1' or string.sub( sCombination, nExtraRotation, nExtraRotation) == '1' then
return false
else
if not BeamData.ROT90 and string.sub( sCombination, Rotation90, Rotation90) == '1' then
if not BeamData.ROT90 and string.sub( sCombination, nRotation90, nRotation90) == '1' then
return false
elseif not BeamData.ROT180 and string.sub( sCombination, Rotation180, Rotation180) == '1' then
elseif not BeamData.ROT180 and string.sub( sCombination, nRotation180, nRotation180) == '1' then
return false
else
return true
@@ -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 > 4, nInitialPosition + 2 - 4, nInitialPosition + 2)
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 + 1 > 4, nInitialPosition + 1 - 4, nInitialPosition + 1)
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')
+43
View File
@@ -104,6 +104,49 @@ function BeamLib.AddPhaseWithRawParts( nRawId, OriXR, PosXR, dDeltaSucc)
end
end
-------------------------------------------------------------------------------------------------------------
--- funzione che ruota il pezzo, da lanciare per creare la disposizione corretta
function BeamLib.RotatePart( Part, nPosition)
-- primo posizionamento
if nPosition == 1 then
; -- il pezzo è già in posizione
-- rotazione 90°
elseif nPosition == 2 then
local dDeltaYZ = EgtGetRawPartBBox( Part.idRaw):getDimY() - EgtGetRawPartBBox( Part.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 = Part.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
-- rotazione 180°
elseif nPosition == 3 then
-- ribalto le travi della fase corrente
local nRId = Part.idRaw
while nRId do
EgtRotateRawPart( nRId, X_AX(), 180)
nRId = EgtGetNextRawPart( nRId)
end
-- rotazione 270°
elseif nPosition == 4 then
local dDeltaYZ = EgtGetRawPartBBox( Part.idRaw):getDimY() - EgtGetRawPartBBox( Part.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 = Part.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
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.CreateOrEmptyAddGroup( PartId)
-- recupero i dati del gruppo aggiuntivo
+6
View File
@@ -546,12 +546,18 @@ function MachiningLib.AddOperations( vProc, Part, sRotation)
local nDispId = EgtGetPhaseDisposition( nPhase)
if sRotation == 'DOWN' then
local nRotation = EgtIf( Part.nInitialPosition + 2 > 4, Part.nInitialPosition + 2 - 4, Part.nInitialPosition + 2)
BeamLib.RotatePart( Part, nRotation)
EgtSetInfo( nDispId, 'ROT', -2)
EgtSetInfo( nDispId, 'TYPE', 'MID2')
elseif sRotation == 'SIDE' then
local nRotation = EgtIf( Part.nInitialPosition + 1 > 4, Part.nInitialPosition + 1 - 4, Part.nInitialPosition + 1)
BeamLib.RotatePart( Part, nRotation)
EgtSetInfo( nDispId, 'ROT', -1)
EgtSetInfo( nDispId, 'TYPE', 'MID2')
else
local nRotation = Part.nInitialPosition
BeamLib.RotatePart( Part, nRotation)
EgtSetInfo( nDispId, 'TYPE', 'END')
end
EgtSetInfo( nDispId, 'ORD', MACHININGS[i].Proc.nIndexPartInParts)