Merge remote-tracking branch 'origin/master' into lapjoint
This commit is contained in:
+79
-38
@@ -1,4 +1,4 @@
|
||||
-- BeamExec.lua by Egaltech s.r.l. 2021/11/27
|
||||
-- BeamExec.lua by Egaltech s.r.l. 2021/12/20
|
||||
-- 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.
|
||||
@@ -23,6 +23,8 @@
|
||||
-- 2021/02/25 Aggiunta gestione eventuale ricalcolo per macchine tipo PF.
|
||||
-- 2021/07/13 Aggiunta gestione posizionamento pezzo TR/BR per macchine con carico a destra e scarico a sinistra.
|
||||
-- 2021/11/27 House mortise sempre prima di (dt)mortise, house tenon sempre dopo (dt)tenon.
|
||||
-- 2021/12/15 Corretta CompareFeature (risultato deve essere simmetrico scambiando le feature).
|
||||
-- 2021/12/20 Ulteriore correzione a CompareFeature (caso con entrambe senza geometria).
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local BeamExec = {}
|
||||
@@ -338,6 +340,24 @@ local function IsTailFeature( Proc, b3Raw, dCurrOvmH)
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function PrintFeatures( vProc, b3Raw)
|
||||
EgtOutLog( ' RawBox=' .. tostring( b3Raw))
|
||||
for i = 1, #vProc do
|
||||
local Proc = vProc[i]
|
||||
local sOut = string.format( ' Id=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Down=%s Side=%s Head=%s Tail=%s Fcse=%1d,%1d Diam=%.2f Fct=%2d Box=%s',
|
||||
Proc.Id, Proc.Grp, Proc.Prc, Proc.TaskId, Proc.CutId,
|
||||
Proc.Flg, EgtIf( Proc.Down, 'T', 'F'), EgtIf( Proc.Side, 'T', 'F'), EgtIf( Proc.Head, 'T', 'F'), EgtIf( Proc.Tail, 'T', 'F'),
|
||||
Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, tostring( Proc.Box))
|
||||
-- info speciali per Block Haus Half Lap
|
||||
if Proc.Prc == 37 then
|
||||
local sSpec = string.format( ' N=%s Hd=%s', tostring( Proc.vtN or V_NULL()), EgtIf( Proc.HeadDir, 'T', 'F'))
|
||||
sOut = sOut .. sSpec
|
||||
end
|
||||
EgtOutLog( sOut)
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CollectFeatures( PartId, b3Raw, dCurrOvmH)
|
||||
-- recupero le feature
|
||||
@@ -434,14 +454,18 @@ local function OrderFeatures( vProc, b3Raw)
|
||||
-- funzione di confronto
|
||||
-- secondo centro box in X (taglio di intestazione prima di altri tagli di testa e taglio di separazione però prima di altri tagli di coda)
|
||||
local function CompareFeatures( B1, B2)
|
||||
-- se primo disabilitato va sempre alla fine
|
||||
if B1.Flg == 0 then
|
||||
-- se primo disabilitato e secondo no va dopo
|
||||
if B1.Flg == 0 and B2.Flg ~= 0 then
|
||||
return false
|
||||
end
|
||||
-- se secondo disabilitato va sempre alla fine
|
||||
if B2.Flg == 0 then
|
||||
-- se secondo disabilitato e primo no va lasciato dopo
|
||||
if B2.Flg == 0 and B1.Flg ~= 0 then
|
||||
return true
|
||||
end
|
||||
-- se entrambi disabilitati seguo l'Id
|
||||
if B1.Flg == 0 and B2.Flg == 0 then
|
||||
return ( B1.Id < B2.Id)
|
||||
end
|
||||
-- se primo è intestazione va sempre prima
|
||||
if Hcut.Identify( B1) then
|
||||
return true
|
||||
@@ -460,21 +484,23 @@ local function OrderFeatures( vProc, b3Raw)
|
||||
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
|
||||
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 Mortise.Identify( B2) and B2.Prc == 53 and
|
||||
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 va messo dopo
|
||||
if B1.Head and B2.Head and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) then
|
||||
-- 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
|
||||
return false
|
||||
end
|
||||
-- se entrambi di testa e secondo è scasso o mortasa va messo dopo
|
||||
if B1.Head and B2.Head and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2)) then
|
||||
-- se entrambi di testa e secondo è scasso o mortasa e primo no va lasciato dopo
|
||||
if B1.Head and B2.Head and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2)) and
|
||||
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
|
||||
@@ -485,12 +511,14 @@ local function OrderFeatures( vProc, b3Raw)
|
||||
if B2.Tail and ( Split.Identify( B1) or not B1.Tail) then
|
||||
return true
|
||||
end
|
||||
-- se primo è scasso o mortasa di coda, sempre dopo tutto
|
||||
if B1.Tail and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) then
|
||||
-- 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
|
||||
return false
|
||||
end
|
||||
-- se secondo è scasso o mortasa di coda, sempre dopo tutto
|
||||
if B2.Tail and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2)) then
|
||||
-- se secondo è scasso o mortasa di coda e primo no, va lasciato dopo
|
||||
if B2.Tail and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2)) and
|
||||
not ( B1.Tail and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1))) then
|
||||
return true
|
||||
end
|
||||
-- se primo è taglio longitudinale completo o altra lav. lunga, dopo tutte le altre feature non di coda
|
||||
@@ -508,19 +536,31 @@ local function OrderFeatures( vProc, b3Raw)
|
||||
end
|
||||
-- se primo è foro e l'altro no, lo penalizzo
|
||||
if B1.Prc == 40 and B2.Prc ~= 40 then
|
||||
return B1.Box:getCenter():getX() - dDrillPenalty > B2.Box:getMax():getX()
|
||||
return ( B1.Box:getCenter():getX() > B2.Box:getMax():getX() + dDrillPenalty)
|
||||
end
|
||||
-- se primo è altro e secondo è foro, lo premio
|
||||
if B1.Prc ~= 40 and B2.Prc == 40 then
|
||||
return B1.Box:getMax():getX() + dDrillPenalty > B2.Box:getCenter():getX()
|
||||
return ( B1.Box:getMax():getX() + dDrillPenalty > B2.Box:getCenter():getX())
|
||||
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.Fcs == B2.Fcs then
|
||||
return B1.Box:getCenter():getX() > B2.Box:getCenter():getX()
|
||||
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
|
||||
if abs( B1.Box:getCenter():getZ() - B2.Box:getCenter():getZ()) < 1.0 then
|
||||
return ( B1.Id < B2.Id)
|
||||
else
|
||||
return ( B1.Box:getCenter():getZ() > B2.Box:getCenter():getZ())
|
||||
end
|
||||
else
|
||||
return ( B1.Box:getCenter():getY() > B2.Box:getCenter():getY())
|
||||
end
|
||||
else
|
||||
return ( B1.Box:getCenter():getX() > B2.Box:getCenter():getX())
|
||||
end
|
||||
else
|
||||
return B1.Fcs > B2.Fcs
|
||||
return ( B1.Fcs > B2.Fcs)
|
||||
end
|
||||
else
|
||||
return ( B1.Diam > B2.Diam)
|
||||
@@ -534,7 +574,26 @@ local function OrderFeatures( vProc, b3Raw)
|
||||
elseif abs( B1.Box:getCenter():getZ() - B2.Box:getCenter():getZ()) > 0.1 * ( B1.Box:getDimZ() + B2.Box:getDimZ()) then
|
||||
return B1.Box:getCenter():getZ() > B2.Box:getCenter():getZ()
|
||||
else
|
||||
return B1.Box:getCenter():getX() > B2.Box:getCenter():getX()
|
||||
return ( B1.Id < B2.Id)
|
||||
end
|
||||
end
|
||||
|
||||
-- test della funzione di ordinamento
|
||||
if EgtGetDebugLevel() >= 3 then
|
||||
EgtOutLog( ' CompareFeatures Test ')
|
||||
local bCompTest = true
|
||||
for i = 1, #vProc do
|
||||
for j = i + 1, #vProc do
|
||||
local bComp1 = CompareFeatures( vProc[i], vProc[j])
|
||||
local bComp2 = CompareFeatures( vProc[j], vProc[i])
|
||||
if bComp1 == bComp2 then
|
||||
bCompTest = false
|
||||
EgtOutLog( string.format( ' ProcId : %d vs %d --> ERROR', vProc[i].Id, vProc[j].Id))
|
||||
end
|
||||
end
|
||||
end
|
||||
if bCompTest then
|
||||
EgtOutLog( ' ALL OK')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -812,24 +871,6 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
|
||||
return bAllOk, bSomeDown, bSomeSide, bSplitRot
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function PrintFeatures( vProc, b3Raw)
|
||||
EgtOutLog( ' RawBox=' .. tostring( b3Raw))
|
||||
for i = 1, #vProc do
|
||||
local Proc = vProc[i]
|
||||
local sOut = string.format( ' Id=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Down=%s Side=%s Head=%s Tail=%s Fcse=%1d,%1d Diam=%.2f Fct=%2d Box=%s',
|
||||
Proc.Id, Proc.Grp, Proc.Prc, Proc.TaskId, Proc.CutId,
|
||||
Proc.Flg, EgtIf( Proc.Down, 'T', 'F'), EgtIf( Proc.Side, 'T', 'F'), EgtIf( Proc.Head, 'T', 'F'), EgtIf( Proc.Tail, 'T', 'F'),
|
||||
Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, tostring( Proc.Box))
|
||||
-- info speciali per Block Haus Half Lap
|
||||
if Proc.Prc == 37 then
|
||||
local sSpec = string.format( ' N=%s Hd=%s', tostring( Proc.vtN or V_NULL()), EgtIf( Proc.HeadDir, 'T', 'F'))
|
||||
sOut = sOut .. sSpec
|
||||
end
|
||||
EgtOutLog( sOut)
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw)
|
||||
local bOk = true
|
||||
|
||||
Reference in New Issue
Block a user