DataBeam :

- correzioni e migliorie varie.
This commit is contained in:
Dario Sassi
2019-07-29 15:01:19 +00:00
parent 7e3c951901
commit 8dee1a0c97
12 changed files with 325 additions and 159 deletions
+36 -26
View File
@@ -1,4 +1,4 @@
-- ProcessLapJoint.lua by Egaltech s.r.l. 2019/07/12
-- ProcessLapJoint.lua by Egaltech s.r.l. 2019/07/26
-- Gestione calcolo mezzo-legno per Travi
-- Tabella per definizione modulo
@@ -46,8 +46,12 @@ function ProcessLapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
return true
end
-- deve avere la normale principale diretta verso la testa
local nFacInd = BL.GetFaceWithMostAdj( Proc.Id)
local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id)
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN:getZ() < BD.NZ_MINA and nFacInd2 then
ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
nFacInd, nFacInd2 = nFacInd2, nFacInd
end
if vtN:getX() < 0.5 then
return false
elseif Proc.Fct >= 5 then
@@ -77,19 +81,17 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw)
return true
end
-- deve avere la normale principale diretta verso la coda
local nFacInd = BL.GetFaceWithMostAdj( Proc.Id)
local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id)
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN:getZ() < BD.NZ_MINA and nFacInd2 then
ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
nFacInd, nFacInd2 = nFacInd2, nFacInd
end
if vtN:getX() > -0.5 then
return false
elseif Proc.Fct >= 5 then
else
return true
end
-- deve occupare la maggior parte dell'area
if Proc.Box:getDimY() > 0.75 * b3Raw:getDimY() or Proc.Box:getDimZ() > 0.75 * b3Raw:getDimZ() then
return true
end
-- non è di coda
return false
end
---------------------------------------------------------------------
@@ -110,19 +112,29 @@ function ProcessLapJoint.Classify( Proc)
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
-- verifico se è lavorabile solo dal basso
local bSmall = (Proc.Head or Proc.Tail) and ( Proc.Box:getDimX() < BD.MAX_LEN_RIDGELAP_FROM_BOTTOM)
local bSmall = ( (Proc.Head or Proc.Tail) and ( Proc.Box:getDimX() < BD.MAX_LEN_RIDGELAP_FROM_BOTTOM)) or Proc.Box:getDimY() < BD.MAX_LEN_RIDGELAP_FROM_BOTTOM
local bDown = ( vtN[1]:getZ() < BD.NZ_MINB and vtN[2]:getZ() < BD.NZ_MINB) or
( vtN[1]:getZ() < BD.NZ_MINA and ( vtN[2]:getZ() < -0.1 or not bSmall)) or
( vtN[2]:getZ() < BD.NZ_MINA and ( vtN[1]:getZ() < -0.1 or not bSmall))
return true, bDown
-- se più di 2 facce
else
-- recupero la faccia con il maggior numero di adiacenze più grande
local nFacInd = BL.GetFaceWithMostAdj( Proc.Id)
-- recupero la faccia con il maggior numero di adiacenze e minor elevazione
local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id)
if nFacInd < 0 then
return false
end
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
-- verifico se è lavorabile solo dal basso
local bDown = ( vtN:getZ() < BD.NZ_MINA)
-- se verso il basso, verifico se utilizzabile seconda faccia
if bDown then
if nFacInd2 then
local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
bDown = ( vtN2:getZ() < BD.NZ_MINA)
end
end
return true, bDown
end
end
@@ -463,13 +475,18 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
-- recupero il numero di facce della tacca
assert( ( Proc.Fct > 2), 'Error : MakeMoreFaces in LapJoint with ' .. tostring( Proc.Fct) .. ' faces')
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id)
local nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id)
assert( nFacInd, 'Error : MakeMoreFaces could not find reference face')
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
-- se orientata verso il basso, verifico l'alternativa
if vtN:getZ() < BD.NZ_MINA and nFacInd2 then
ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
nFacInd, nFacInd2 = nFacInd2, nFacInd
end
local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
-- verifico non sia orientata verso il basso
local bFaceOk = ( vtN:getZ() >= BD.NZ_MINB)
local bFaceOk = ( vtN:getZ() >= BD.NZ_MINA)
if not bFaceOk then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' LapJoint from bottom impossible'
EgtOutLog( sErr)
@@ -483,26 +500,19 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
end
end
-- recupero la lavorazione
local sPocketing = ML.FindPocketing( 'Mortise')
local sPocketing = ML.FindPocketing( 'Mortise', min( dH, dV))
-- se non trova una svuotatura adatta, provo con la sega a catena o lama
if not sPocketing then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' pocketing not found in library'
EgtOutLog( sErr)
return false, sErr
return MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH, dV, dFacElev)
end
-- recupero i dati dell'utensile
local dMillDiam = 20
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMaxDepth = ( EgtTdbGetCurrToolMaxDepth() or dMaxDepth) - BD.COLL_SIC
dMaxDepth = ( EgtTdbGetCurrToolMaxDepth() or dMaxDepth)
end
end
-- se una dimensione della faccia è più piccola del diametro utensile, va usata la sega a catena o la lama
if dH < dMillDiam or dV < dMillDiam then
return MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH, dV, dFacElev)
end
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sPocketing)