From 58eb8df2471fd470b70e937070f393780081b87f Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Wed, 13 Mar 2024 15:24:59 +0100 Subject: [PATCH] - Gestion Predrill su foro da due parti - Ordinamento, Predrill sempre prima del foro --- LuaLibs/BeamExec.lua | 22 ++++++++++++++---- LuaLibs/ProcessDrill.lua | 49 +++++++++++++++++++++++++++++++++++----- 2 files changed, 60 insertions(+), 11 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index d12f226..94275a7 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -61,6 +61,7 @@ -- 2024/03/07 Implementate le lavorazioni in doppio per fori specchiati non passanti e DrillPocket. -- 2024/03/11 In CollectFeatures si scrive ora Width e Height della faccia sia trimmate con il grezzo che intere. -- 2024/03/13 In CollectFeatures si scrive lunghezza foro su Proc e si controla se serve Predrill +-- In OrderFeature, preforo sempre prima del foro -- Tabella per definizione modulo local BeamExec = {} @@ -370,7 +371,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) end end end - if Proc.Box and not Proc.Box:isEmpty() then + if Proc.Box and not Proc.Box:isEmpty() then Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH) Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) table.insert( vProc, Proc) @@ -380,7 +381,10 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) Proc.Diam, Proc.Len, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw) -- verifico se devo inserire i prefori if Drill.IsPredrillNeeded( Proc) then - Drill.AddPredrillFromDrillProc( Proc) + local bAddProc, PredrillProc= Drill.AddPredrillFromDrillProc( Proc) + if bAddProc then + table.insert( vProc, PredrillProc) + end end -- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta if Drill.Split( Proc, b3Raw) then @@ -407,9 +411,13 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) Proc2.TaskId = Proc.TaskId Proc2.AdjId = Proc.AdjId Proc2.MainId = Proc.MainId + table.insert( vProc, Proc2) -- verifico se devo inserire i prefori if Drill.IsPredrillNeeded( Proc2) then - Drill.AddPredrillFromDrillProc( Proc2) + local bAddProc, PredrillProc= Drill.AddPredrillFromDrillProc( Proc2) + if bAddProc then + table.insert( vProc, PredrillProc) + end end end -- se BlockHaus HalfLap @@ -931,7 +939,11 @@ local function OrderFeatures( vProc, b3Raw) end -- se entrambi fori con posizione praticamente uguale ordino secondo diametro e faccia di inizio (Fcs) if B1.Prc == 40 and B2.Prc == 40 and abs( B1.Box:getCenter():getX() - B2.Box:getCenter():getX()) < dSmallDrillRange then - if abs( B1.Diam - B2.Diam) < 1.0 then + if B1.IsPredrill and not B2.IsPredrill then + return true + elseif not B1.IsPredrill and B2.IsPredrill then + return false + elseif abs( B1.Diam - B2.Diam) < 1.0 then if B1.Fcs == B2.Fcs then if abs( B1.Box:getCenter():getX() - B2.Box:getCenter():getX()) < 1.0 then if abs( B1.Box:getCenter():getY() - B2.Box:getCenter():getY()) < 1.0 then @@ -2056,7 +2068,7 @@ function BeamExec.ProcessFeatures() -- verifica presenza forature influenzate da lavorazioni di testa o coda if BD.IMPROVE_HEAD_TAIL_DRILLINGS then - vMachBeforeIntersDrillings = CalcHeadTailMachBeforeIntersDrillings( vProc, b3Raw) + local vMachBeforeIntersDrillings = CalcHeadTailMachBeforeIntersDrillings( vProc, b3Raw) SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachBeforeIntersDrillings) end -- verifica presenza di feature specchiate per eventuali lavorazioni simultanee diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index c997af8..b944499 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -162,16 +162,53 @@ function ProcessDrill.AddPredrillFromDrillProc( Proc) if Proc.Len <= dDepthPredrill then Proc.IsPredrill = true Proc.IsPredrillOf = Proc.Id + return false -- altrimenti creo un nuovo process else -- recupero gruppo per geometria aggiuntiva - local AddGrpId = BL.GetAddGroup( Proc.PartId) - if not AddGrpId then - local sErr = 'Error on Predrill impossible to find AddGroup' - EgtOutLog( sErr) - return false, sErr + local nAddGrpId = BL.GetAddGroup( Proc.PartId) + -- recupero e verifico l'entità foro + local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0 + local ptCen = EgtCP( Proc.Id + AuxId, GDB_RT.GLOB) + local vtExtr = EgtCurveExtrusion( Proc.Id + AuxId, GDB_RT.GLOB) + + -- copio foro originale + local nPreHoleId = EgtCopyGlob( Proc.Id, nAddGrpId) + local nPreHoleAux = EgtCopyGlob( Proc.Id + AuxId, nAddGrpId) + + -- se foro invertito sposto geometria dall'altro lato del foro + if Proc.Flg == -2 then + local vsExtr = vtExtr * Proc.Len + EgtMove( nPreHoleAux, vsExtr) + EgtModifyCurveThickness( nPreHoleAux, dDepthPredrill) + -- altrimenti creo il foro direttamente + else + EgtModifyCurveThickness( nPreHoleAux, -dDepthPredrill) end + -- definisco dati seconda parte + local PredrillProc = {} + PredrillProc.PartId = Proc.PartId + PredrillProc.Id = nPreHoleId + PredrillProc.Grp = Proc.Grp + PredrillProc.Prc = Proc.Prc + PredrillProc.Flg = Proc.Flg + PredrillProc.Box = Proc.Box + PredrillProc.Fct = Proc.Fct + PredrillProc.Diam = Proc.Diam + PredrillProc.Len = dDepthPredrill + PredrillProc.Head = Proc.Head + PredrillProc.Tail = Proc.Tail + PredrillProc.Fcs = Proc.Fcs + PredrillProc.Fce = Proc.Fce + PredrillProc.CutId = Proc.CutId + PredrillProc.TaskId = Proc.TaskId + PredrillProc.AdjId = Proc.AdjId + PredrillProc.MainId = Proc.MainId + PredrillProc.IsPredrill = true + PredrillProc.IsPredrillOf = Proc.Id + + return true, PredrillProc end end @@ -325,7 +362,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.421) local bExcludeH2 = false if Proc.Double and Proc.Double > 0 then - bMillUp = true + -- bMillUp = true bDrillDown = false bExcludeH2 = true end