Completata gestione scrittura dati nelle info del DISP

This commit is contained in:
andrea.villa
2025-05-20 15:44:32 +02:00
parent 3198287dfe
commit cdfebf83fb
4 changed files with 99 additions and 45 deletions
+51 -10
View File
@@ -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