DataBeam :

- correzioni e migliorie varie.
This commit is contained in:
Dario Sassi
2019-09-30 06:50:03 +00:00
parent e42f60cebe
commit 79b7d2337f
6 changed files with 130 additions and 49 deletions
+58 -33
View File
@@ -1,4 +1,4 @@
-- ProcessLapJoint.lua by Egaltech s.r.l. 2019/09/25
-- ProcessLapJoint.lua by Egaltech s.r.l. 2019/09/27
-- Gestione calcolo mezzo-legno per Travi
-- Tabella per definizione modulo
@@ -144,6 +144,31 @@ function ProcessLapJoint.Classify( Proc)
end
end
---------------------------------------------------------------------
local function TestElleShape( Proc)
-- valida solo nel caso di tre facce
if Proc.Fct ~= 3 then
return false
end
-- determino se L con una faccia terminale o U con tre facce
local bIsL = true
for i = 1, 3 do
local vFacAdj = EgtSurfTmFacetAdjacencies( Proc.Id, i - 1)[1]
-- le conto
local nCount = 0
for j = 1, #vFacAdj do
if vFacAdj[j] >= 0 then
nCount = nCount + 1
end
end
if nCount == 1 then
bIsL = false
break
end
end
return bIsL
end
---------------------------------------------------------------------
-- Lavorazione con fresa
---------------------------------------------------------------------
@@ -227,14 +252,19 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId)
local nFacInd
-- se entrambe possibili
if bFaceOk[1] and bFaceOk[2] then
-- se in testa o coda, scelgo quella con la normale più parallela all'asse trave
if Proc.Head or Proc.Tail then
if vtN[1]:getZ() < BD.NZ_MINA then
nFacInd = 1
elseif vtN[2]:getZ() < BD.NZ_MINA then
-- se in testa, scelgo quella orientata verso la testa
if Proc.Head then
if vtN[1]:getX() > vtN[2]:getX() then
nFacInd = 0
else
nFacInd = EgtIf( abs( vtN[1]:getX()) > abs( vtN[2]:getX()), 0, 1)
nFacInd = 1
end
-- se altrimenti in coda, scelgo quella orientata verso la coda
elseif Proc.Tail then
if vtN[1]:getX() < vtN[2]:getX() then
nFacInd = 0
else
nFacInd = 1
end
-- altrimenti, scelgo quella con la normale più perpendicolare all'asse trave (se uguali, quella verso X+)
else
@@ -512,8 +542,10 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
return false, sErr
end
end
-- recupero la lavorazione
local dDiam = min( dH, dV) * EgtIf( Proc.Fct > 3, 1, 1.4)
-- verifico se tre facce a L con una faccia di terminazione
local bIsL = TestElleShape( Proc)
-- recupero la lavorazione ( se L posso accettare utensili un poco più grandi)
local dDiam = min( dH, dV) * EgtIf( bIsL, 1.4, 1)
EgtOutLog( 'Mortise Find Diam =' .. EgtNumToString( dDiam))
local sPocketing = ML.FindPocketing( 'Mortise', dDiam)
-- se non trova una svuotatura adatta, provo con la sega a catena o lama
@@ -628,34 +660,27 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- due facce
elseif Proc.Fct == 2 then
-- determino se due facce lunghe oppure una lunga e l'altra terminale
return Long2Cut.Make( Proc, nPhase, nRawId, nPartId)
-- tre facce
elseif Proc.Fct == 3 then
-- determino se L con una faccia terminale o U con tre facce
local bIsL = true
for i = 1, 3 do
local vFacAdj = EgtSurfTmFacetAdjacencies( Proc.Id, i - 1)[1]
-- le conto
local nCount = 0
for j = 1, #vFacAdj do
if vFacAdj[j] >= 0 then
nCount = nCount + 1
end
end
if nCount == 1 then
bIsL = false
break
end
end
-- se una faccia terminale e due lunghe
if bIsL then
local CopyId = EgtCopyGlob( Proc.Id, Proc.Id, GDB_IN.AFTER)
local NewId, nCount = EgtExplodeSurf( CopyId)
local b3Fac1 = EgtGetBBoxGlob( NewId, GDB_BB.STANDARD)
local b3Fac2 = EgtGetBBoxGlob( NewId + 1, GDB_BB.STANDARD)
if abs( b3Fac1:getDimX() - b3Fac2:getDimX()) < 10 then
return Long2Cut.Make( Proc, nPhase, nRawId, nPartId)
-- altrimenti U lunga
elseif b3Fac1:getDimX() < 1 then
-- la faccia 0 deve essere quella lunga
local nNew2Id = EgtSurfTmBySewing( EgtGetParent( Proc.Id), { NewId+1, NewId})
EgtCopyAttributes( Proc.Id, nNew2Id)
EgtErase( Proc.Id)
EgtChangeId( nNew2Id, Proc.Id)
return LongCut.Make( Proc, nPhase, nRawId, nPartId)
elseif b3Fac2:getDimX() < 1 then
EgtErase( {NewId, NewId+1})
return LongCut.Make( Proc, nPhase, nRawId, nPartId)
else
EgtErase( {NewId, NewId+1})
return MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId)
end
-- più facce
-- tre o più facce
else
return MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId)
end