diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 014b36d..0f122d1 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -57,6 +57,7 @@ -- Migliorata 'CompareFeatures' per ordine forature -- 2024/02/19 In Collect aggiunta la scrittura nella Proc di Width e Height delle facce. -- 2024/02/29 Migliorata 'CompareFeatures' per ordine forature +-- 2024/03/04 Creata funzione calcolo dipendenze tra feature con calcolo topologia. -- Tabella per definizione modulo local BeamExec = {} @@ -355,7 +356,6 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) end end if Proc.Box and not Proc.Box:isEmpty() then - Proc.NeedTopology = NeedTopologyFeature( Proc) Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH) Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) table.insert( vProc, Proc) @@ -795,11 +795,11 @@ local function OrderFeatures( vProc, b3Raw) return B1.Head end -- se entrambi di testa e intersecano stesse facce e primo è scasso a due facce e secondo è un profilo caudato, lo scasso è una riduzione e va fatto prima - if ( ( B1.Head and B2.Head) or ( B1.Tail and B2.Tail)) and ( LapJoint.Identify( B1) and B1.Fct == 2) and ( ProfCamb.Identify( B2)) then + if ( ( B1.Head and B2.Head) or ( B1.Tail and B2.Tail)) and B1.Topology == 'Rabbet' and ( ProfCamb.Identify( B2) or ProfConcave.Identify( B2) or ProfConvex.Identify( B2)) then return true end -- se entrambi di testa e intersecano stesse facce e primo è un profilo caudato e secondo è scasso a due facce, lo scasso è una riduzione e va lasciato dopo - if ( ( B1.Head and B2.Head) or ( B1.Tail and B2.Tail)) and ( LapJoint.Identify( B2) and B2.Fct == 2) and ( ProfCamb.Identify( B1)) then + if ( ( B1.Head and B2.Head) or ( B1.Tail and B2.Tail)) and B2.Topology == 'Rabbet' and ( ProfCamb.Identify( B1) or ProfConcave.Identify( B1) or ProfConvex.Identify( B1)) then return false end -- se entrambi di testa e primo è scasso o mortasa e secondo no va messo dopo @@ -821,12 +821,12 @@ local function OrderFeatures( vProc, b3Raw) return true end -- se primo è foro e secondo è un ribasso, il foro va sempre prima a meno che il ribasso non sia di testa - if Drill.Identify(B1) and ( LapJoint.Identify(B2) or Mortise.Identify(B2)) and not B2.Head and + if Drill.Identify(B1) and ( LapJoint.Identify(B2) or Mortise.Identify(B2)) and B2.PassedByHole and B1.Box:getCenter():getX() > B2.Box:getMin():getX() and B1.Box:getCenter():getX() < B2.Box:getMax():getX() then return true end -- se primo è un ribasso e secondo è un foro, il ribasso va sempre dopo a meno che il ribasso non sia di testa - if ( LapJoint.Identify(B1) or Mortise.Identify(B1))and not B1.Head and Drill.Identify(B2) and + if ( LapJoint.Identify(B1) or Mortise.Identify(B1))and B1.PassedByHole and Drill.Identify(B2) and B2.Box:getCenter():getX() > B1.Box:getMin():getX() and B2.Box:getCenter():getX() < B1.Box:getMax():getX() then return false end @@ -1252,20 +1252,6 @@ local function ClassifyFeatures( vProc, b3Raw, Stats) return bAllOk, bSomeDown, bSomeSide, bSplitRot end -------------------------------------------------------------------------------------------------------------- -local function ClassifyTopology( vProc, nRawId) - local b3Raw = EgtGetRawPartBBox( nRawId) - local nRecognized = 0 - for i = 1, #vProc do - local Proc = vProc[i] - if Topology.Classify( Proc, b3Raw) then - nRecognized = nRecognized + 1 - end - end - - return nRecognized -end - ------------------------------------------------------------------------------------------------------------- local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT) local bOk = true @@ -1908,6 +1894,30 @@ local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeInt end end +------------------------------------------------------------------------------------------------------------- +function GetFeatureInfoAndDependency( vProc, b3Raw) + -- ciclo tutte le feature + for i = 1, #vProc do + -- calcolo topologia della feature + if NeedTopologyFeature( vProc[i]) then + Topology.Classify( vProc[i], b3Raw) + -- se non richiesto, setto 'SPECIAL' + else + vProc[i].Topology = 'SPECIAL' + vProc[i].TopologyLongName = vProc[i].Topology + end + + -- controllo la feature con tutte le altre per recuperare le dipendenze + for j = 1, #vProc do + local ProcB = vProc[j] + -- verifico se feature tipo LapJoint è attraversata da almeno un foro + if ( vProc[i].Topology == 'Pocket' or vProc[i].Topology == 'Tunnel' or vProc[i].Topology == 'Groove' or Mortise.Identify( vProc[i])) and Drill.Identify( ProcB) and Overlaps( vProc[i].Box, ProcB.Box) then + vProc[i].PassedByHole = true + end + end + end +end + ------------------------------------------------------------------------------------------------------------- function BeamExec.ProcessFeatures() if BD.IMPROVE_HEAD_TAIL_DRILLINGS == nil then @@ -1941,6 +1951,9 @@ function BeamExec.ProcessFeatures() local dCurrOvmT = EgtGetInfo( nRawId, 'TOVM', 'd') or 0 -- recupero le feature di lavorazione della trave local vProc = CollectFeatures( nPartId, b3Raw, dCurrOvmH, dCurrOvmT) + -- recupero informazioni ausiliarie feature e dipendenze tra feature stesse + GetFeatureInfoAndDependency( vProc, b3Raw) + -- verifica presenza forature influenzate da lavorazioni di testa o coda if BD.IMPROVE_HEAD_TAIL_DRILLINGS then vMachBeforeIntersDrillings = CalcHeadTailMachBeforeIntersDrillings( vProc, b3Raw) @@ -1950,8 +1963,6 @@ function BeamExec.ProcessFeatures() if BD.TWO_EQUAL_HEADS or BD.DOWN_HEAD then SetMirroredFeatures( vProc, b3Raw) end - -- classifico topologicamente le feature - ClassifyTopology( vProc, nRawId) -- le ordino lungo X OrderFeatures( vProc, b3Raw) -- le classifico diff --git a/LuaLibs/FeatureTopology.lua b/LuaLibs/FeatureTopology.lua index f4ee53a..5426c5d 100644 --- a/LuaLibs/FeatureTopology.lua +++ b/LuaLibs/FeatureTopology.lua @@ -5,6 +5,7 @@ -- 2023/10/16 In GetFacesParallelToPart rimossa Pocket e aggiunto Rabbet al check solo direzione principale -- 2023/11/03 In Classify ora si settano le AffectedFaces nella Proc, se non già presenti. -- Aggiunta groove 2 facce, differenziata da rabbet. +-- 2024/03/04 Feature senza topologia, calcolato in BeamExec -- Tabella per definizione modulo local FeatureTopology = {} @@ -173,13 +174,6 @@ function FeatureTopology.Classify( Proc, b3Raw) return false end - -- se non richiesto (default true, quindi nil vale true), esco - if Proc.NeedTopology == false then - Proc.Topology = 'SPECIAL' - Proc.TopologyLongName = Proc.Topology - return true - end - -- se già calcolato, esco if Proc.Topology then return true