Completata gestione scrittura dati nelle info del DISP
This commit is contained in:
+28
-24
@@ -487,6 +487,7 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
|
||||
PARTS[i].nIndexInParts = i
|
||||
PARTS[i].CombinationList = BeamExec.GetAvailableCombinations( PARTS[i])
|
||||
PARTS[i].SplittingPoints = BeamLib.GetPartSplittingPoints( PARTS[i])
|
||||
PARTS[i].NotClampableLength = { STD = { dHead = 0, dTail = 0}, SIDE = { dHead = 0, dTail = 0}, DOWN = { dHead = 0, dTail = 0}}
|
||||
else
|
||||
local sOut = 'Error: part L(' .. EgtNumToString( dPartLen, 1) .. ') too big for raw part L(' .. EgtNumToString( dLen - 0.1, 1) .. ')'
|
||||
return false, sOut
|
||||
@@ -630,12 +631,12 @@ local function CollectFeatures( Part)
|
||||
Proc.idTask = EgtGetInfo( ProcId, 'TASKID', 'i') or 0
|
||||
Proc.b3Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
|
||||
EgtOutLog( '------Feature ' .. Proc.idFeature .. '------')
|
||||
Proc.Topology = {}
|
||||
-- se esiste la geometria
|
||||
if Proc.b3Box and not Proc.b3Box:isEmpty() then
|
||||
-- informazioni facce e topologia
|
||||
Proc.AffectedFaces = BeamLib.GetAffectedFaces( Proc, Part)
|
||||
-- calcolo topologia solo se necessario, altrimenti si sfruttano le informazioni della feature BTL
|
||||
Proc.Topology = {}
|
||||
local bIsFeatureReadyForProcessing = false
|
||||
if FeatureLib.NeedTopologyFeature( Proc) then
|
||||
Proc.AdjacencyMatrix = FaceData.GetAdjacencyMatrix( Proc)
|
||||
@@ -1148,7 +1149,7 @@ local function CalculateMachinings( vProc, Part, nInitialRotation)
|
||||
-- se non esiste una strategia scelta (non dovrebbe mai succedere) cancello da lista generale
|
||||
PROCESSINGS[Proc.nIndexPartInParts].Rotation[Proc.nIndexRotation][Proc.nIndexInVProc].ChosenStrategy = nil
|
||||
|
||||
-- TODO dare messaggio che la feature non 0è stata eseguita nonostante la presenza di strategie disponibili
|
||||
-- TODO dare messaggio che la feature non è stata eseguita nonostante la presenza di strategie disponibili
|
||||
|
||||
end
|
||||
end
|
||||
@@ -1458,6 +1459,7 @@ local function GetBestResultFromCombinationsMatrix( ProcessingsOnPart, PartInfo)
|
||||
end
|
||||
BestCombination = GetBestCombination( CombinationsList)
|
||||
|
||||
PartInfo.ChosenCombination = BestCombination.sBitIndexCombination
|
||||
-- scrittura nel log delle combinazioni possibili
|
||||
if EgtGetDebugLevel() >= 3 then
|
||||
Logs.WriteCombinationLog( CombinationsList, BestCombination)
|
||||
@@ -1506,7 +1508,7 @@ function BeamExec.ProcessMachinings( PARTS)
|
||||
if nOrd == 1 then
|
||||
EgtSetCurrPhase( 1)
|
||||
else
|
||||
BeamLib.AddPhaseWithRawParts( PARTS[nPart].idRaw, BeamData.ptOriXR, BeamData.dPosXR, 0)
|
||||
BeamLib.AddPhaseWithRawParts( PARTS[nPart], BeamData.ptOriXR, BeamData.dPosXR, 0)
|
||||
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.
|
||||
@@ -1642,12 +1644,13 @@ function BeamExec.ProcessMachinings( PARTS)
|
||||
local bSplitAlreadyExecuted = false
|
||||
local bSplitExecutedOnRot = false
|
||||
local nPhase = EgtGetCurrPhase()
|
||||
local nDispId = EgtGetPhaseDisposition( nPhase)
|
||||
EgtSetInfo( nDispId, 'TYPE', 'START')
|
||||
EgtSetInfo( nDispId, 'ORD', nOrd)
|
||||
local idDisp = EgtGetPhaseDisposition( nPhase)
|
||||
EgtSetInfo( idDisp, 'TYPE', 'START')
|
||||
EgtSetInfo( idDisp, 'ORD', nOrd)
|
||||
EgtOutLog( ' *** Phase=' .. tostring( nPhase) .. ' Raw=' .. tostring( PARTS[nPart].idRaw) .. ' Part=' .. tostring( PARTS[nPart].id) .. ' ***', 1)
|
||||
|
||||
-- creazione effettiva delle lavorazioni
|
||||
MACHININGS.Info = {}
|
||||
local nCurrPosition = 1
|
||||
local nInitialPosition = MatrixResult.nInitialPosition
|
||||
-- se c'è almeno una lavorazione in posizionamento con trave ribaltata
|
||||
@@ -1655,7 +1658,7 @@ function BeamExec.ProcessMachinings( PARTS)
|
||||
local nRotation = EgtIf( nInitialPosition + 2 > 4, nInitialPosition + 2 - 4, nInitialPosition + 2)
|
||||
BeamLib.RotateRawPart( PARTS[nPart], nRotation - nCurrPosition)
|
||||
nCurrPosition = nRotation
|
||||
EgtSetInfo( nDispId, 'ROT', -2)
|
||||
EgtSetInfo( idDisp, 'ROT', -2)
|
||||
bAreAllMachiningApplyOk, sErr, bSplitExecutedOnRot = MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'DOWN')
|
||||
bSplitAlreadyExecuted = bSplitAlreadyExecuted or bSplitExecutedOnRot
|
||||
end
|
||||
@@ -1664,36 +1667,37 @@ function BeamExec.ProcessMachinings( PARTS)
|
||||
if MatrixResult.bSomeFeatureSide then
|
||||
-- se ci sono state lavorazioni in rotazione precedente devo creare altra fase. Altrimenti già creata da prima
|
||||
if MatrixResult.bSomeFeatureDown then
|
||||
BeamLib.AddPhaseWithRawParts( PARTS[nPart].idRaw, BeamData.ptOriXR, BeamData.dPosXR, EgtIf( bSplitAlreadyExecuted, BeamData.RAW_OFFSET, 0))
|
||||
BeamLib.AddPhaseWithRawParts( PARTS[nPart], BeamData.ptOriXR, BeamData.dPosXR, EgtIf( bSplitAlreadyExecuted, BeamData.RAW_OFFSET, 0))
|
||||
nPhase = EgtGetCurrPhase()
|
||||
nDispId = EgtGetPhaseDisposition( nPhase)
|
||||
EgtSetInfo( nDispId, 'ORD', nOrd)
|
||||
-- se c'è già stata seoparazione
|
||||
idDisp = EgtGetPhaseDisposition( nPhase)
|
||||
EgtSetInfo( idDisp, 'ORD', nOrd)
|
||||
-- se c'è già stata separazione
|
||||
if bSplitAlreadyExecuted then
|
||||
EgtSetInfo( nDispId, 'TYPE', 'MID2')
|
||||
EgtSetInfo( idDisp, 'TYPE', 'MID2')
|
||||
else
|
||||
EgtSetInfo( nDispId, 'TYPE', 'MID')
|
||||
EgtSetInfo( idDisp, 'TYPE', 'MID')
|
||||
end
|
||||
end
|
||||
local nRotation = EgtIf( nInitialPosition + 1 > 4, nInitialPosition + 1 - 4, nInitialPosition + 1)
|
||||
BeamLib.RotateRawPart( PARTS[nPart], nRotation - nCurrPosition)
|
||||
nCurrPosition = nRotation
|
||||
EgtSetInfo( nDispId, 'ROT', -1)
|
||||
EgtSetInfo( idDisp, 'ROT', -1)
|
||||
bAreAllMachiningApplyOk, sErr, bSplitExecutedOnRot = MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'SIDE')
|
||||
bSplitAlreadyExecuted = bSplitAlreadyExecuted or bSplitExecutedOnRot
|
||||
end
|
||||
|
||||
-- se ci sono state lavorazioni in rotazione precedente devo creare altra fase. Altrimenti già creata da prima
|
||||
if MatrixResult.bSomeFeatureDown or MatrixResult.bSomeFeatureSide then
|
||||
BeamLib.AddPhaseWithRawParts( PARTS[nPart].idRaw, BeamData.ptOriXR, BeamData.dPosXR, EgtIf( bSplitAlreadyExecuted, BeamData.RAW_OFFSET, 0))
|
||||
local sPrevRotation = EgtIf( MatrixResult.bSomeFeatureSide, 'SIDE', 'DOWN')
|
||||
BeamLib.AddPhaseWithRawParts( PARTS[nPart], BeamData.ptOriXR, BeamData.dPosXR, EgtIf( bSplitAlreadyExecuted, BeamData.RAW_OFFSET, 0))
|
||||
nPhase = EgtGetCurrPhase()
|
||||
nDispId = EgtGetPhaseDisposition( nPhase)
|
||||
EgtSetInfo( nDispId, 'ORD', nOrd)
|
||||
-- se c'è già stata seoparazione
|
||||
idDisp = EgtGetPhaseDisposition( nPhase)
|
||||
EgtSetInfo( idDisp, 'ORD', nOrd)
|
||||
-- se c'è già stata separazione
|
||||
if bSplitAlreadyExecuted then
|
||||
EgtSetInfo( nDispId, 'TYPE', 'END2')
|
||||
EgtSetInfo( idDisp, 'TYPE', 'END2')
|
||||
else
|
||||
EgtSetInfo( nDispId, 'TYPE', 'MID')
|
||||
EgtSetInfo( idDisp, 'TYPE', 'MID')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1713,11 +1717,11 @@ function BeamExec.ProcessMachinings( PARTS)
|
||||
-- ===== finiti i pezzi, si scarica il restante =====
|
||||
local idRestPart = EgtGetNextRawPart( PARTS[#PARTS].idRaw)
|
||||
if idRestPart and EgtGetRawPartBBox( idRestPart):getDimX() >= BeamData.dMinRaw then
|
||||
BeamLib.AddPhaseWithRawParts( idRestPart, BeamData.ptOriXR, BeamData.dPosXR, 0)
|
||||
BeamLib.AddPhaseWithRawParts( PARTS[#PARTS], BeamData.ptOriXR, BeamData.dPosXR, 0)
|
||||
local nPhase = EgtGetCurrPhase()
|
||||
local nDispId = EgtGetPhaseDisposition( nPhase)
|
||||
EgtSetInfo( nDispId, 'TYPE', 'REST')
|
||||
EgtSetInfo( nDispId, 'ORD', nOrd)
|
||||
local idDisp = EgtGetPhaseDisposition( nPhase)
|
||||
EgtSetInfo( idDisp, 'TYPE', 'REST')
|
||||
EgtSetInfo( idDisp, 'ORD', nOrd)
|
||||
end
|
||||
|
||||
-- Aggiornamento finale di tutto
|
||||
|
||||
@@ -107,14 +107,6 @@ end
|
||||
function BeamLib.AddPhaseWithRawParts( Part, OriXR, PosXR, dDeltaSucc)
|
||||
local idRaw = Part.idRaw
|
||||
|
||||
-- TODO scrittura ingombri sulla disposizione
|
||||
-- deve arrivare un valore per ogni rotazione
|
||||
-- deve essere spostato in configurazione macchina???
|
||||
local nPhase = EgtGetCurrPhase()
|
||||
local idDisp = EgtGetPhaseDisposition( nPhase)
|
||||
EgtSetInfo( idDisp, 'HCING', Part.NotClampableLength.dNotClampableLengthHead)
|
||||
EgtSetInfo( idDisp, 'TCING', Part.NotClampableLength.dNotClampableLengthTail)
|
||||
|
||||
EgtAddPhase()
|
||||
-- si aprono i limiti tavola per permettere rotazioni di pezzi più larghi della tavola
|
||||
EgtSetTableAreaOffset( 2000, 2000, 2000, 2000)
|
||||
|
||||
+20
-3
@@ -755,8 +755,8 @@ function FeatureLib.CalculateFeatureNotClampableLengths( Proc, Part)
|
||||
local dNotClampableLengthHead = 0
|
||||
local dNotClampableLengthTail = 0
|
||||
|
||||
-- TODO al momento con meno di 3 facce si restituisce 0
|
||||
if Proc.nFct < 3 then
|
||||
-- TODO al momento con almeno 3 facce si restituisce 0
|
||||
if true or Proc.nFct < 3 then
|
||||
-- eventuale segnalazione ingombro di testa o coda
|
||||
local dMinHIng = min( 0.5 * BeamData.VICE_MINH, 0.5 * Part.b3Raw:getDimZ())
|
||||
local dMinZ = max( BeamData.MIN_HEIGHT, 0.35 * Part.b3Raw:getDimZ())
|
||||
@@ -816,12 +816,29 @@ function FeatureLib.CalculateFeatureNotClampableLengths( Proc, Part)
|
||||
return NotClampableLength
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function FeatureLib.GetFeatureRotationNotClampableLengths( Proc, Part, nRotation)
|
||||
local nPartIndex = Part.nIndexInParts
|
||||
local nProcIndex = Proc.nIndexInVProc
|
||||
local Rotations = PROCESSINGS[nPartIndex].Rotation
|
||||
|
||||
local dLenOnHead = 0
|
||||
local dLenOnTail = 0
|
||||
-- controllo che la rotazione sia attiva
|
||||
if string.sub( Part.ChosenCombination, nRotation, nRotation) == '1' then
|
||||
dLenOnHead = Rotations[nRotation][nProcIndex].NotClampableLength.dNotClampableLengthHead
|
||||
dLenOnTail = Rotations[nRotation][nProcIndex].NotClampableLength.dNotClampableLengthTail
|
||||
end
|
||||
|
||||
return dLenOnHead, dLenOnTail
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function FeatureLib.GetFeatureMaxNotClampableLengths( Proc, Part)
|
||||
local nPartIndex = Part.nIndexInParts
|
||||
local nProcIndex = Proc.nIndexInVProc
|
||||
local Rotations = PROCESSINGS[nPartIndex].Rotation
|
||||
|
||||
|
||||
local dMaxOnHead = 0
|
||||
local dMaxOnTail = 0
|
||||
for i = 1, #Part.CombinationList do
|
||||
|
||||
+51
-10
@@ -979,9 +979,38 @@ function MachiningLib.AddOperations( vProc, Part, sRotation)
|
||||
RESULT[MACHININGS[i].Proc.nIndexInResult].ChosenStrategy.sStatus = 'Not-Applicable'
|
||||
RESULT[MACHININGS[i].Proc.nIndexInResult].ChosenStrategy.sApplyInfo = sErr
|
||||
RESULT[MACHININGS[i].Proc.nIndexInResult].ChosenStrategy.nApplyError = nErr
|
||||
-- si salva ingombro lavorazione attuale e fasi successive
|
||||
else
|
||||
-- TODO qui scrivere .NotClampableLength nella parte
|
||||
-- salvo ingombro non pinzabile testa/coda
|
||||
local nCurrRotation = MACHININGS[i].Proc.nIndexRotation
|
||||
local dNotClampHead, dNotClampTail = FeatureLib.GetFeatureRotationNotClampableLengths( MACHININGS[i].Proc, Part, nCurrRotation)
|
||||
Part.NotClampableLength[sRotation].dHead = max( Part.NotClampableLength[sRotation].dHead, dNotClampHead)
|
||||
Part.NotClampableLength[sRotation].dTail = max( Part.NotClampableLength[sRotation].dTail, dNotClampTail)
|
||||
|
||||
if sRotation == 'DOWN' then
|
||||
local nNextRotation = EgtIf( nCurrRotation - 1 < 1, nCurrRotation - 1 + 4, nCurrRotation - 1)
|
||||
-- se rotazione attiva (SIDE)
|
||||
if string.sub( Part.ChosenCombination, nNextRotation, nNextRotation) == '1' then
|
||||
dNotClampHead, dNotClampTail = FeatureLib.GetFeatureRotationNotClampableLengths( MACHININGS[i].Proc, Part, nNextRotation)
|
||||
Part.NotClampableLength['SIDE'].dHead = max( Part.NotClampableLength['SIDE'].dHead, dNotClampHead)
|
||||
Part.NotClampableLength['SIDE'].dTail = max( Part.NotClampableLength['SIDE'].dTail, dNotClampTail)
|
||||
end
|
||||
nNextRotation = EgtIf( nNextRotation - 1 < 1, nNextRotation - 1 + 4, nNextRotation - 1)
|
||||
-- se rotazione attiva (STD)
|
||||
if string.sub( Part.ChosenCombination, nNextRotation, nNextRotation) == '1' then
|
||||
dNotClampHead, dNotClampTail = FeatureLib.GetFeatureRotationNotClampableLengths( MACHININGS[i].Proc, Part, nNextRotation)
|
||||
Part.NotClampableLength['STD'].dHead = max( Part.NotClampableLength['STD'].dHead, dNotClampHead)
|
||||
Part.NotClampableLength['STD'].dTail = max( Part.NotClampableLength['STD'].dTail, dNotClampTail)
|
||||
end
|
||||
elseif sRotation == 'SIDE' then
|
||||
local nNextRotation = EgtIf( nCurrRotation - 1 < 1, nCurrRotation - 1 + 4, nCurrRotation - 1)
|
||||
-- se rotazione attiva (STD)
|
||||
if string.sub( Part.ChosenCombination, nNextRotation, nNextRotation) == '1' then
|
||||
dNotClampHead, dNotClampTail = FeatureLib.GetFeatureRotationNotClampableLengths( MACHININGS[i].Proc, Part, nNextRotation)
|
||||
Part.NotClampableLength['STD'].dHead = max( Part.NotClampableLength['STD'].dHead, dNotClampHead)
|
||||
Part.NotClampableLength['STD'].dTail = max( Part.NotClampableLength['STD'].dTail, dNotClampTail)
|
||||
end
|
||||
end
|
||||
end
|
||||
RESULT[MACHININGS[i].Proc.nIndexInResult].ChosenStrategy.bIsApplyOk = bIsApplyOk
|
||||
|
||||
@@ -989,28 +1018,33 @@ function MachiningLib.AddOperations( vProc, Part, sRotation)
|
||||
-- se era taglio di separazione, aggiungo nuova fase
|
||||
if MACHININGS[i].AuxiliaryData.bIsSplitOrCut then
|
||||
bSplitExecuted = true
|
||||
BeamLib.AddPhaseWithRawParts( MACHININGS[i].Proc.idRaw, BeamData.ptOriXR, BeamData.dPosXR, BeamData.RAW_OFFSET)
|
||||
MACHININGS.Info.bSplitExecuted = true
|
||||
local nPhase = EgtGetCurrPhase()
|
||||
local idDisp = EgtGetPhaseDisposition( nPhase)
|
||||
EgtSetInfo( idDisp, 'HCING', Part.NotClampableLength[sRotation].dHead or 0)
|
||||
|
||||
BeamLib.AddPhaseWithRawParts( Part, BeamData.ptOriXR, BeamData.dPosXR, BeamData.RAW_OFFSET)
|
||||
-- se grezzo successivo senza pezzi e finale, va tolto
|
||||
local nNextRawId = EgtGetNextRawPart( MACHININGS[i].Proc.idRaw)
|
||||
if nNextRawId and EgtGetPartInRawPartCount( nNextRawId) == 0 and EgtGetRawPartBBox( nNextRawId):getDimX() < BeamData.dMinRaw then
|
||||
EgtRemoveRawPartFromCurrPhase( nNextRawId)
|
||||
end
|
||||
local nPhase = EgtGetCurrPhase()
|
||||
local nDispId = EgtGetPhaseDisposition( nPhase)
|
||||
nPhase = EgtGetCurrPhase()
|
||||
idDisp = EgtGetPhaseDisposition( nPhase)
|
||||
|
||||
if sRotation == 'DOWN' then
|
||||
BeamLib.RotateRawPart( Part, Part.nInitialPosition - 3)
|
||||
EgtSetInfo( nDispId, 'ROT', -2)
|
||||
EgtSetInfo( nDispId, 'TYPE', 'MID2')
|
||||
EgtSetInfo( idDisp, 'ROT', -2)
|
||||
EgtSetInfo( idDisp, 'TYPE', 'MID2')
|
||||
elseif sRotation == 'SIDE' then
|
||||
BeamLib.RotateRawPart( Part, Part.nInitialPosition - 2)
|
||||
EgtSetInfo( nDispId, 'ROT', -1)
|
||||
EgtSetInfo( nDispId, 'TYPE', 'MID2')
|
||||
EgtSetInfo( idDisp, 'ROT', -1)
|
||||
EgtSetInfo( idDisp, 'TYPE', 'MID2')
|
||||
else
|
||||
BeamLib.RotateRawPart( Part, Part.nInitialPosition - 1)
|
||||
EgtSetInfo( nDispId, 'TYPE', 'END')
|
||||
EgtSetInfo( idDisp, 'TYPE', 'END')
|
||||
end
|
||||
EgtSetInfo( nDispId, 'ORD', MACHININGS[i].Proc.nIndexPartInParts)
|
||||
EgtSetInfo( idDisp, 'ORD', MACHININGS[i].Proc.nIndexPartInParts)
|
||||
end
|
||||
else
|
||||
return false, 'UNEXPECTED ERROR: Error on creating machining', bSplitExecuted
|
||||
@@ -1018,6 +1052,13 @@ function MachiningLib.AddOperations( vProc, Part, sRotation)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- si settano aree non pinzabili testa/coda
|
||||
local nPhase = EgtGetCurrPhase()
|
||||
local idDisp = EgtGetPhaseDisposition( nPhase)
|
||||
EgtSetInfo( idDisp, 'HCING', Part.NotClampableLength[sRotation].dHead or 0)
|
||||
if MACHININGS.Info.bSplitExecuted then
|
||||
EgtSetInfo( idDisp, 'TCING', Part.NotClampableLength[sRotation].dTail or 0)
|
||||
end
|
||||
|
||||
return bAreAllMachiningApplyOk, sErr, bSplitExecuted
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user