- implemento split e relative finiture per travi con sezioni grandi

- split con sega a catena
- distinzione finitura con lama o truciolatore in base al parametro Q05
- finiture evitate in presenza di feature che tagliano tutta la sezione
- gestione sovramateriale grezzo
This commit is contained in:
luca.mazzoleni
2022-06-10 17:50:22 +02:00
parent c9b0f1e90d
commit b29074cbb1
18 changed files with 833 additions and 348 deletions
+73 -47
View File
@@ -1,4 +1,4 @@
-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/05/04
-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/05/24
-- Gestione calcolo mezzo-legno per Travi
-- 2019/10/08 Agg. gestione OpenPocket.
-- 2021/01/24 Con sega a catena ora sempre impostato asse A.
@@ -41,6 +41,8 @@
-- 2022/03/29 Aggiunta gestione antischeggia con Q06 anche su 3/4-033-X.
-- 2022/04/28 Lavorazione BH forzata sempre OneWay.
-- 2022/05/04 Corretta classificazione due facce sotto. Modificati criteri assegnazione due facce alla coda.
-- 2022/05/24 Miglioramenti vari per BH, compreso controlli per lavorazione da sotto.
-- 2022/05/31 Rese globali le funzioni GetChainSawBlockedAxis e GetChainSawInitAngs per essere richiamate dalla ProcessSplit per taglio sega a catena in sezioni alte e larghe.
-- Tabella per definizione modulo
local ProcessLapJoint = {}
@@ -254,7 +256,7 @@ local function TestElleShape4( Proc)
end
---------------------------------------------------------------------
local function GetChainSawBlockedAxis( nInd)
function ProcessLapJoint.GetChainSawBlockedAxis( nInd)
if BD.GetChainSawBlockedAxis then
return BD.GetChainSawBlockedAxis( nInd)
else
@@ -267,7 +269,7 @@ local function GetChainSawBlockedAxis( nInd)
end
---------------------------------------------------------------------
local function GetChainSawInitAngs( vtN, vtO, nInd)
function ProcessLapJoint.GetChainSawInitAngs( vtN, vtO, nInd)
if BD.GetChainSawInitAngs then
return BD.GetChainSawInitAngs( vtN, vtO, nInd)
else
@@ -382,7 +384,7 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
-- le facce devono contenere X e quelle di chiusura devono essere perpendicolari a X
local bStopY, bStopZ
for i = 1, Proc.Fct do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, i-1, GDB_ID.ROOT)
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i-1, GDB_ID.ROOT)
if abs( vtN:getX()) > 0.001 and abs( vtN:getX()) < 0.999962 then
return false
end
@@ -412,20 +414,35 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
-- recupero i dati dell'utensile
local dToolLength = 0
local dToolDiam = 0
local dMaxDepth = 0
local dThickTool = 0
local dToolMaxDepth = 0
local dToolThick = 0
local dToolFreeLen = 0
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolLength = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dToolLength
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
dThickTool = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dThickTool
local dToolThDiam = EgtTdbGetCurrToolThDiam() or 150
if ( EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE) ~= 0 then
dToolMaxDepth = EgtTdbGetCurrToolMaxDepth() or dToolMaxDepth
dToolThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dToolThick
dToolFreeLen = dToolLength
else
dToolMaxDepth = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or 0.5 * ( dToolDiam - dToolThDiam)
dToolThick = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
dToolFreeLen = EgtTdbGetCurrToolMaxDepth() or dToolFreeLen
end
end
end
-- verifico se abbastanza larga (oppure L) rispetto all'utensile
if Proc.Box:getDimX() < dThickTool - 15 * GEO.EPS_SMALL and not bIsL then
if Proc.Box:getDimX() < dToolThick - 15 * GEO.EPS_SMALL and not bIsL then
return false
end
-- limiti trasversali
local dDepth = min( Proc.Box:getDimY(), Proc.Box:getDimZ())
if dDepth > dToolMaxDepth then
return false
end
@@ -440,14 +457,14 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
local bHead = bHeadDir
-- verifico se raggiungibile con la testa senza collisioni
local bUseBHSideMill = EgtIf( bHead, ( dMaxT - dMinXF), ( dMaxXF - dMinT)) < dMaxDepth
local bUseBHSideMill = EgtIf( bHead, ( dMaxT - dMinXF), ( dMaxXF - dMinT)) < dToolFreeLen
-- se diametro utensile maggiore della testa
if BD.HEAD_DIM_FOR_BH and dToolDiam > BD.HEAD_DIM_FOR_BH then
if BD.HEAD_DIM_FOR_BH and dToolDiam - 2 * dDepth > BD.HEAD_DIM_FOR_BH then
bHead = true
bUseBHSideMill = true
end
return bUseBHSideMill, bHead, bHeadDir, sMilling, dThickTool, dToolDiam
return bUseBHSideMill, bHead, bHeadDir, sMilling, dToolThick, dToolDiam
end
---------------------------------------------------------------------
@@ -557,6 +574,29 @@ local function CalcCollisionSafety( vtDir)
return dCollSic
end
---------------------------------------------------------------------
local function UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
-- verifico siano una o due facce
if Proc.Fct > 2 then return end
-- eventuale segnalazione ingombro di testa o coda
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
if Proc.Head then
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
BL.UpdateHCING( nRawId, dOffs)
elseif Proc.Tail then
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
BL.UpdateTCING( nRawId, dOffs)
elseif Proc.Fct > 1 and Proc.Box:getCenter():getX() > b3Solid:getCenter():getX() then
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
local dDist = b3Solid:getMax():getX() - Proc.Box:getMax():getX()
-- sempre concavo aumento la distanza (rimane una punta...)
dDist = dDist + 10
BL.UpdateHCING( nRawId, dOffs, dDist)
end
end
end
---------------------------------------------------------------------
-- Verifica se feature di testa
function ProcessLapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
@@ -660,11 +700,6 @@ end
function ProcessLapJoint.Classify( Proc, b3Raw)
-- se 1 faccia
if Proc.Fct == 1 then
-- dati della faccia
--local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- verifico se è lavorabile solo dal basso
--local bDown = ( vtN:getZ() < BD.NZ_MINA)
--return true, bDown
return true, false
-- se 2 facce
elseif Proc.Fct == 2 then
@@ -764,9 +799,14 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
rfFac:rotate( rfFac:getOrigin(), rfFac:getVersZ(), 90)
end
-- se può essere fatto con utensile tipo lama
local bUseBHSideMill = VerifyBHSideMill( Proc)
local bUseBHSideMill, _, _, _, _, dTDiam = VerifyBHSideMill( Proc)
if bUseBHSideMill then
return true, false
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN:getZ() > -0.5 or b3Raw:getDimZ() - Proc.Box:getDimZ() < ( BD.MAX_DIST_BH_FROM_BOTTOM or 395) - dTDiam / 2 then
return true, false
else
return true, true
end
-- altrimenti controllo se deve essere ruotato con le altre lavorazioni
else
-- dati della faccia
@@ -863,16 +903,7 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId)
return false, sErr
end
-- eventuale segnalazione ingombro di testa o coda
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
if Proc.Head then
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
BL.UpdateHCING( nRawId, dOffs)
elseif Proc.Tail then
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
BL.UpdateTCING( nRawId, dOffs)
end
end
UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
return true
end
@@ -1040,22 +1071,7 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead)
return false, sErr
end
-- eventuale segnalazione ingombro di testa o coda
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
if Proc.Head then
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
BL.UpdateHCING( nRawId, dOffs)
elseif Proc.Tail then
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
BL.UpdateTCING( nRawId, dOffs)
elseif Proc.Box:getCenter():getX() > b3Solid:getCenter():getX() then
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
local dDist = b3Solid:getMax():getX() - Proc.Box:getMax():getX()
-- sempre concavo aumento la distanza (rimane una punta...)
dDist = dDist + 10
BL.UpdateHCING( nRawId, dOffs, dDist)
end
end
UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
return true
end
@@ -2664,7 +2680,6 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
return false, sErr
end
end
if bOrthoFaces then
-- ottengo le dimensioni del tunnel
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc, nPartId)
@@ -4531,6 +4546,15 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
if bMakeBySideMill then
-- se smusso non è esclusivo
if nChamfer < 2 then
-- verifico che la faccia non sia diretta come X, altrimenti cerco di cambiarla
if abs( vtN:getX()) > 0.866 and nFacInd2 then
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd2, GDB_ID.ROOT)
if vtN2 and abs( vtN2:getX()) < 0.866 then
nFacInd, nFacInd2 = nFacInd2, nFacInd
dFacElev, dFacElev2 = dFacElev2, dFacElev
vtN, vtN2 = vtN2, vtN
end
end
-- se lavorazione da sotto e lunga, va divisa in due metà
local bDouble = ( vtN:getZ() < -0.5 and dH > ( BD.MAX_LEN_BH_FROM_BOTTOM or 200))
-- inserisco la lavorazione di fresatura
@@ -4573,7 +4597,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG)
EgtSetMachiningParam( MCH_MP.LOTANG, -( dToolDiam / 2 + b3Raw:getDimY() + BD.CUT_SIC))
EgtSetMachiningParam( MCH_MP.LOPERP, dFacElev + BD.COLL_SIC)
EgtSetMachiningParam( MCH_MP.LOPERP, EgtIf( vtN:getZ() > -0.5, dFacElev + BD.COLL_SIC, BD.COLL_SIC))
if bDouble then
EgtSetMachiningParam( MCH_MP.ENDADDLEN, - dH / 2)
EgtSetMachiningParam( MCH_MP.LOTANG, -( dToolDiam / 2 + dH / 2 + BD.CUT_SIC))
@@ -5298,6 +5322,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
end
end
end
-- eventuale segnalazione ingombro di testa o coda
UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
end
return true, sWarn, bPrevBhSideMill