diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 8131b40..c741973 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1,4 +1,4 @@ --- BeamExec.lua by Egaltech s.r.l. 2022/12/28 +-- BeamExec.lua by Egaltech s.r.l. 2023/03/31 -- Libreria esecuzione lavorazioni per Travi -- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3. -- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato. @@ -44,6 +44,7 @@ -- 2023/02/17 Ora le forature che intersecano le mortase sono sempre fatte prima della mortasa stessa. -- 2023/02/17 Nelle tasche in doppio, la distanza minima ammessa tra le feature è stata portata a 50. -- 2023/02/20 Ora le mortase a coda di rondine laterali sono sempre fatte prima dei tagli longitudinali. +-- 2023/03/31 Corretto ordinamento per fori di coda da lasciare in coda. -- Tabella per definizione modulo local BeamExec = {} @@ -696,41 +697,6 @@ local function OrderFeatures( vProc, b3Raw) if B1.Head ~= B2.Head then return B1.Head end - -- se primo è foro e secondo è un ribasso, il foro va sempre prima - if Drill.Identify(B1) and ( LapJoint.Identify(B2) or Mortise.Identify(B2)) 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 - if (LapJoint.Identify(B1) or Mortise.Identify(B1)) 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 - -- se prima è mortasa coda di rondine sul fianco e secondo taglio longitudinale, la coda di rondine va sempre prima - if DtMortise.SideIdentify(B1) and ( LongCut.Identify(B2) or Long2Cut.Identify(B2)) and - OverlapsX( B1.Box, B2.Box) then - return true - end - -- se primo è taglio longitudinale e seconda è mortasa coda di rondine sul fianco, il taglio longitudinale va sempre dopo - if ( LongCut.Identify(B1) or Long2Cut.Identify(B1)) and DtMortise.SideIdentify(B2) and - OverlapsX( B1.Box, B2.Box) then - return false - end - -- se entrambi tenoni e si intersecano, metto prima tenone vero e poi base tenone - if ( Tenon.Identify( B1) or DtTenon.Identify( B1)) and ( Tenon.Identify( B2) or DtTenon.Identify( B2)) and - B1.Box:getMin():getX() < B2.Box:getMax():getX() + 100 * GEO.EPS_SMALL and B2.Box:getMin():getX() < B1.Box:getMax():getX() + 100 * GEO.EPS_SMALL then - return ( ( B1.Prc == 50 or B1.Prc == 55) and B2.Prc == 52) - end - -- se primo house mortise, secondo mortise e si intersecano, metto prima house mortise - if Mortise.Identify( B1) and B1.Prc == 53 and ( Mortise.Identify( B2) or DtMortise.Identify( B2)) and B2.Prc ~= 53 and - B1.Box:getMin():getX() < B2.Box:getMax():getX() + 100 * GEO.EPS_SMALL and B2.Box:getMin():getX() < B1.Box:getMax():getX() + 100 * GEO.EPS_SMALL then - return true - end - -- se primo mortise, secondo house mortise e si intersecano, metto prima house mortise - if ( Mortise.Identify( B1) or DtMortise.Identify( B1)) and B1.Prc ~= 53 and Mortise.Identify( B2) and B2.Prc == 53 and - B1.Box:getMin():getX() < B2.Box:getMax():getX() + 100 * GEO.EPS_SMALL and B2.Box:getMin():getX() < B1.Box:getMax():getX() + 100 * GEO.EPS_SMALL then - return false - end -- se entrambi di testa e primo è scasso o mortasa e secondo no va messo dopo if B1.Head and B2.Head and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) and not ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2)) then @@ -741,14 +707,6 @@ local function OrderFeatures( vProc, b3Raw) not ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) then return true end - -- se primo è feature di coda e l'altro è separazione o non è feature di coda - if B1.Tail and ( Split.Identify( B2) or not B2.Tail) then - return false - end - -- se secondo è feature di coda e l'altro è separazione o non è feature di coda - if B2.Tail and ( Split.Identify( B1) or not B1.Tail) then - return true - end -- se primo è feature di coda anticipata e l'altro non è feature di coda if B1.AdvTail and ( not Split.Identify( B2) or not B2.Tail) then return false @@ -757,6 +715,14 @@ local function OrderFeatures( vProc, b3Raw) if B2.AdvTail and ( not Split.Identify( B1) or not B1.Tail) then return true end + -- se primo è feature di coda e l'altro è separazione o non è feature di coda + if B1.Tail and ( Split.Identify( B2) or not B2.Tail) then + return false + end + -- se secondo è feature di coda e l'altro è separazione o non è feature di coda + if B2.Tail and ( Split.Identify( B1) or not B1.Tail) then + return true + end -- se primo è scasso o mortasa di coda e secondo no, sempre dopo if B1.Tail and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) and not ( B2.Tail and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2))) then @@ -784,6 +750,16 @@ local function OrderFeatures( vProc, b3Raw) if abs( B2.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then return not ( B1.Tail or B2.Box:getMin():getX() + 20 > B1.Box:getCenter():getX()) end + -- se primo è foro e secondo è un ribasso, il foro va sempre prima + if Drill.Identify(B1) and ( LapJoint.Identify(B2) or Mortise.Identify(B2)) 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 + if (LapJoint.Identify(B1) or Mortise.Identify(B1)) 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 -- se primo è foro e l'altro no, lo penalizzo if B1.Prc == 40 and B2.Prc ~= 40 then return ( B1.Box:getCenter():getX() > B2.Box:getMax():getX() + dDrillPenalty) @@ -792,6 +768,31 @@ local function OrderFeatures( vProc, b3Raw) if B1.Prc ~= 40 and B2.Prc == 40 then return ( B1.Box:getMax():getX() + dDrillPenalty > B2.Box:getCenter():getX()) end + -- se prima è mortasa coda di rondine sul fianco e secondo taglio longitudinale, la coda di rondine va sempre prima + if DtMortise.SideIdentify(B1) and ( LongCut.Identify(B2) or Long2Cut.Identify(B2)) and + OverlapsX( B1.Box, B2.Box) then + return true + end + -- se primo è taglio longitudinale e seconda è mortasa coda di rondine sul fianco, il taglio longitudinale va sempre dopo + if ( LongCut.Identify(B1) or Long2Cut.Identify(B1)) and DtMortise.SideIdentify(B2) and + OverlapsX( B1.Box, B2.Box) then + return false + end + -- se entrambi tenoni e si intersecano, metto prima tenone vero e poi base tenone + if ( Tenon.Identify( B1) or DtTenon.Identify( B1)) and ( Tenon.Identify( B2) or DtTenon.Identify( B2)) and + B1.Box:getMin():getX() < B2.Box:getMax():getX() + 100 * GEO.EPS_SMALL and B2.Box:getMin():getX() < B1.Box:getMax():getX() + 100 * GEO.EPS_SMALL then + return ( ( B1.Prc == 50 or B1.Prc == 55) and B2.Prc == 52) + end + -- se primo house mortise, secondo mortise e si intersecano, metto prima house mortise + if Mortise.Identify( B1) and B1.Prc == 53 and ( Mortise.Identify( B2) or DtMortise.Identify( B2)) and B2.Prc ~= 53 and + B1.Box:getMin():getX() < B2.Box:getMax():getX() + 100 * GEO.EPS_SMALL and B2.Box:getMin():getX() < B1.Box:getMax():getX() + 100 * GEO.EPS_SMALL then + return true + end + -- se primo mortise, secondo house mortise e si intersecano, metto prima house mortise + if ( Mortise.Identify( B1) or DtMortise.Identify( B1)) and B1.Prc ~= 53 and Mortise.Identify( B2) and B2.Prc == 53 and + B1.Box:getMin():getX() < B2.Box:getMax():getX() + 100 * GEO.EPS_SMALL and B2.Box:getMin():getX() < B1.Box:getMax():getX() + 100 * GEO.EPS_SMALL then + return false + 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