Merge branch 'DrillPocketDoubleFix' into develop

This commit is contained in:
luca.mazzoleni
2026-03-11 09:50:05 +01:00
+35 -18
View File
@@ -37,6 +37,7 @@ EgtOutLog( ' ProcessDrill started', 1)
-- Dati
local BD = require( 'BeamData')
local ML = require( 'MachiningLib')
local FreeContour = require( 'ProcessFreeContour')
---------------------------------------------------------------------
-- Riconoscimento della feature
@@ -345,8 +346,6 @@ end
function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- Se forzato contorno foro forzo richiamo a FreeContour e uscita dalla funzione
if EgtGetInfo( Proc.Id, 'Q04', 'i') == 1 then
_G.package.loaded.ProcessFreeContour = nil
local FreeContour = require( 'ProcessFreeContour')
return FreeContour.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
-- default per costanti
@@ -717,23 +716,41 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
else
-- se DrillPocket passante in doppio si fa lavorazione aggiuntiva dell'ultimo step
if Proc.Double and Proc.Double > 0 and ( sType == 'Pocket_AT' or sType == 'Pocket') and bOpen then
local nAddGrpId = BL.GetAddGroup( Proc.PartId)
local idProcLastStep = EgtCopyGlob( Proc.Id, nAddGrpId)
local idAuxIdLastStep = EgtCopyGlob( AuxId, nAddGrpId)
EgtModifyCurveThickness( idAuxIdLastStep, -dLastStepDepth)
local ProcLastStep = BL.TableCopyDeep( Proc)
ProcLastStep.Id = idProcLastStep
ProcLastStep.Flg = 1
ProcLastStep.Double = 0
ProcLastStep.dCustomMaxElev = dLastStepDepth - dDepth
local bOkLastStep, sWarnLastStep = ProcessDrill.Make( ProcLastStep, nPhase, nRawId, nPartId)
if not bOkLastStep then
sWarnLastStep = 'Drillpocket double : incomplete, last step missing'
local idMachiningLastStep = EgtCopyMachining( EgtIf( EgtStartsWith( sType, 'Predrill'), 'Predrill_', 'Drill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)), sName)
EgtSetCurrMachining( idMachiningLastStep)
if dLastStepDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
sMyWarn = 'Warning in drill pocket last step: depth (' .. EgtNumToString( dLastStepDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dLastStepDepth = dMaxDepth
end
local sPreviousWarn = sMyWarn or sWarn
if sWarnLastStep then
if not sPreviousWarn then sPreviousWarn = '' end
sMyWarn = EgtIf( #sPreviousWarn > 0, sPreviousWarn .. '\n' .. sWarnLastStep, sWarnLastStep)
local dMaxElevLastStep = dLastStepDepth - dDepth
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElevLastStep, 1))
EgtSetMachiningParam( MCH_MP.DEPTH, dLastStepDepth)
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', '')
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', '')
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
local bOkLastStep = ML.ApplyMachining( true, false)
if not bOkLastStep and bDownDrill and bOpen and abs( Proc.Flg) == 1 then
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, true)
else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end
bOkLastStep = ML.ApplyMachining( true, false)
end
if not bOkLastStep then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
local _, sWarnLastStep = EgtGetMachMgrWarning( 0)
if not bOkLastStep then
sWarnLastStep = 'Drillpocket double : incomplete, last step missing'
end
local sPreviousWarn = sMyWarn or sWarn
if sWarnLastStep then
if not sPreviousWarn then sPreviousWarn = '' end
sMyWarn = EgtIf( #sPreviousWarn > 0, sPreviousWarn .. '\n' .. sWarnLastStep, sWarnLastStep)
end
end
end
return true, ( sMyWarn or sWarn)