DataBeam :

- migliorie e correzioni varie
- unificati BirdsMouth con LapJoint.
This commit is contained in:
Dario Sassi
2019-07-03 10:27:55 +00:00
parent 9ac596d5d7
commit 7c1a4ba546
20 changed files with 473 additions and 511 deletions
+44 -22
View File
@@ -1,4 +1,4 @@
-- ProcessTenon.lua by Egaltech s.r.l. 2019/03/23
-- ProcessTenon.lua by Egaltech s.r.l. 2019/07/01
-- Gestione calcolo tenone per Travi
-- Tabella per definizione modulo
@@ -25,14 +25,13 @@ end
---------------------------------------------------------------------
-- Classificazione della feature
function ProcessTenon.Classify( Proc)
-- recupero i dati della faccia top
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
-- verifico sia una superficie
if not vtN then
return false
end
-- recupero i dati della curva di contorno della faccia top
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if not AuxId then return false end
AuxId = AuxId + Proc.Id
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
-- verifico se il tenone è lavorabile solo da sotto
local bDown = ( vtN:getZ() < - 0.1)
local bDown = ( vtExtr:getZ() < - 0.1)
return true, bDown
end
@@ -57,24 +56,29 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati della curva e del top
local dDepth = abs( EgtCurveThickness( AuxId))
-- recupero i dati della curva di contorno della faccia top
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
local ptBC = EgtGP( AuxId, GDB_RT.GLOB)
local bClosed = EgtCurveIsClosed( AuxId)
-- verifico che il tenone non sia orientato verso il basso (-5 deg)
if vtN:getZ() < - 0.1 then
if vtExtr:getZ() < - 0.1 then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Tenon from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- determino altezza del tenone
local frTen = Frame3d( ptC, vtN)
local frTen = Frame3d( ptBC, vtExtr)
local b3Ten = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frTen)
local dTenH = b3Ten:getDimZ()
-- assegno centro e normale della faccia top
local vtN = vtExtr
local ptC = ptBC + vtN * dTenH
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
-- determino larghezza massima di svuotatura
local b3Aux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frTen)
local dPockL = 0.5 * max( b3Ten:getDimX() - b3Aux:getDimX(), b3Ten:getDimY() - b3Aux:getDimY())
local dPockX = max( b3Ten:getMax():getX() - b3Aux:getMax():getX(), b3Aux:getMin():getX() - b3Ten:getMin():getX())
local dPockY = max( b3Ten:getMax():getY() - b3Aux:getMax():getY(), b3Aux:getMin():getY() - b3Ten:getMin():getY())
local dPockL = max( dPockX, dPockY)
-- porto inizio curva il più possibile sul bordo
BL.PutStartNearestToEdge( AuxId, b3Solid)
-- se vero tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa
@@ -116,9 +120,10 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
end
end
-- determino il numero di passate concentriche
local nPass = ceil( dPockL / ( 0.5 * dMillDiam))
local dStep = dPockL / nPass
-- determino il numero di passate concentriche (max 4)
local MAX_PASS = 4
local nPass = min( ceil( dPockL / ( 0.7 * dMillDiam)), MAX_PASS)
local dStep = min( dPockL, 0.7 * dMillDiam * MAX_PASS) / nPass
for i = nPass, 1, -1 do
-- inserisco la passata finale della lavorazione
local sNameF = 'TenF_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -134,6 +139,13 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dTenH, 1) .. ';')
local dOffset = ( i - 1) * dStep
EgtSetMachiningParam( MCH_MP.OFFSR, dOffset)
-- se contorno aperto, cambio parametri di attacco/uscita
if not bClosed then
EgtSetMachiningParam( MCH_MP.LITANG, 0.7 * dMillDiam)
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
EgtSetMachiningParam( MCH_MP.LOTANG, 0.7 * dMillDiam)
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -142,10 +154,20 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
end
-- eventuale segnalazione ingombro di testa o coda
if Proc.Head then
BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX())
elseif Proc.Tail then
BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Raw:getMin():getX())
if abs( vtN:getY()) > 0.1 or ( b3Raw:getDimZ() - Proc.Box:getDimZ()) < BD.MIN_HEIGHT then
if Proc.Head then
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
if abs( vtN:getY()) < 0.1 and vtN:getZ() > 0.5 then
dOffs = dOffs / 2
end
BL.UpdateHCING( nRawId, dOffs)
elseif Proc.Tail then
local dOffs = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
if abs( vtN:getY()) < 0.1 and vtN:getZ() > 0.5 then
dOffs = dOffs / 2
end
BL.UpdateTCING( nRawId, dOffs)
end
end
return true
end