|
|
|
@@ -10,6 +10,7 @@ local BL = require( 'BeamLib')
|
|
|
|
|
local Fbs = require( 'FacesBySaw')
|
|
|
|
|
local Cut = require( 'ProcessCut')
|
|
|
|
|
local DC = require( 'DiceCut')
|
|
|
|
|
local FreeContour = require( 'ProcessFreeContour')
|
|
|
|
|
|
|
|
|
|
EgtOutLog( ' ProcessRidgeLap started', 1)
|
|
|
|
|
|
|
|
|
@@ -26,8 +27,10 @@ end
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
-- Classificazione della feature
|
|
|
|
|
function ProcessRidgeLap.Classify( Proc, b3Raw)
|
|
|
|
|
-- se PF con testa da sotto, ammessa qualunque orientazione
|
|
|
|
|
if BD.C_SIMM and BD.DOWN_HEAD then
|
|
|
|
|
-- se forzato utilizzo fresa non ruoto la trave
|
|
|
|
|
local bForceSideMill = ( EgtGetInfo( Proc.Id, 'Q04', 'd') or 0) > 0
|
|
|
|
|
-- se PF con testa da sotto oppure forzato utilizzo fresa, ammessa qualunque orientazione
|
|
|
|
|
if ( BD.C_SIMM and BD.DOWN_HEAD) or bForceSideMill then
|
|
|
|
|
return true, false
|
|
|
|
|
end
|
|
|
|
|
-- Se più corta del limite si può fare anche da sotto
|
|
|
|
@@ -137,59 +140,68 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
|
|
|
if not bOk then return bOk, sErr end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- recupero gruppo per geometria addizionale
|
|
|
|
|
local nAddGrpId = BL.GetAddGroup( nPartId)
|
|
|
|
|
if not nAddGrpId then
|
|
|
|
|
local sErr = 'Error : missing AddGroup'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
|
|
|
|
|
local vCuts = {}
|
|
|
|
|
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
|
|
|
|
|
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
|
|
|
|
|
end
|
|
|
|
|
if #vCuts > 0 then
|
|
|
|
|
-- sistemo posizione nel DB e nome
|
|
|
|
|
for i = 1, #vCuts do
|
|
|
|
|
for j = 1, #vCuts[i] do
|
|
|
|
|
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
|
|
|
|
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
|
|
|
|
end
|
|
|
|
|
-- se forzato utilizzo fresa richiamo la freecontour
|
|
|
|
|
local bForceSideMill = EgtGetInfo( Proc.Id, 'Q04', 'd') == 1 or
|
|
|
|
|
( EgtGetInfo( Proc.Id, 'Q04', 'd') == 2 and abs( vtN[vFaceOrd[3]]:getY()) < 0.1) or
|
|
|
|
|
( EgtGetInfo( Proc.Id, 'Q04', 'd') == 3 and abs( vtN[vFaceOrd[3]]:getY()) < 0.1 and vtN[vFaceOrd[3]]:getZ() < 0.1)
|
|
|
|
|
if bForceSideMill then
|
|
|
|
|
bOk, sErr = FreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
|
|
|
if not bOk then return bOk, sErr end
|
|
|
|
|
else
|
|
|
|
|
-- recupero gruppo per geometria addizionale
|
|
|
|
|
local nAddGrpId = BL.GetAddGroup( nPartId)
|
|
|
|
|
if not nAddGrpId then
|
|
|
|
|
local sErr = 'Error : missing AddGroup'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
-- calcolo riferimenti per facce inclinate
|
|
|
|
|
local vtRef = Vector3d( vtN[vFaceOrd[3]])
|
|
|
|
|
local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
|
|
|
|
|
-- eseguo
|
|
|
|
|
for i = 1, #vCuts do
|
|
|
|
|
local nOrthoOpposite
|
|
|
|
|
if i % 2 == 1 then
|
|
|
|
|
nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef)
|
|
|
|
|
else
|
|
|
|
|
nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef2)
|
|
|
|
|
end
|
|
|
|
|
-- lavoro la faccia
|
|
|
|
|
for j = 1, #vCuts[i] do
|
|
|
|
|
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
|
|
|
|
if not bOk then
|
|
|
|
|
return bOk, sErr
|
|
|
|
|
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
|
|
|
|
|
local vCuts = {}
|
|
|
|
|
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
|
|
|
|
|
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
|
|
|
|
|
end
|
|
|
|
|
if #vCuts > 0 then
|
|
|
|
|
-- sistemo posizione nel DB e nome
|
|
|
|
|
for i = 1, #vCuts do
|
|
|
|
|
for j = 1, #vCuts[i] do
|
|
|
|
|
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
|
|
|
|
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
-- taglio sulla faccia interna
|
|
|
|
|
if vFaceOrd[2] ~= 0 then
|
|
|
|
|
-- inserisco la lavorazione
|
|
|
|
|
local nOrthoOpposite = BL.GetNearestOrthoOpposite( vtN[vFaceOrd[3]])
|
|
|
|
|
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[2] - 1, sCutting, dSawDiam, nOrthoOpposite, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
|
|
|
|
if not bOk then return bOk, sErr end
|
|
|
|
|
end
|
|
|
|
|
-- taglio sulla faccia intermedia
|
|
|
|
|
if vFaceOrd[3] ~= 0 then
|
|
|
|
|
-- inserisco la lavorazione
|
|
|
|
|
local nOrthoOpposite = BL.GetNearestOrthoOpposite( EgtIf( bHead, X_AX(), -X_AX()))
|
|
|
|
|
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, nOrthoOpposite, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
|
|
|
|
if not bOk then return bOk, sErr end
|
|
|
|
|
-- calcolo riferimenti per facce inclinate
|
|
|
|
|
local vtRef = Vector3d( vtN[vFaceOrd[3]])
|
|
|
|
|
local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
|
|
|
|
|
-- eseguo
|
|
|
|
|
for i = 1, #vCuts do
|
|
|
|
|
local nOrthoOpposite
|
|
|
|
|
if i % 2 == 1 then
|
|
|
|
|
nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef)
|
|
|
|
|
else
|
|
|
|
|
nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef2)
|
|
|
|
|
end
|
|
|
|
|
-- lavoro la faccia
|
|
|
|
|
for j = 1, #vCuts[i] do
|
|
|
|
|
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
|
|
|
|
if not bOk then
|
|
|
|
|
return bOk, sErr
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
-- taglio sulla faccia interna
|
|
|
|
|
if vFaceOrd[2] ~= 0 then
|
|
|
|
|
-- inserisco la lavorazione
|
|
|
|
|
local nOrthoOpposite = BL.GetNearestOrthoOpposite( vtN[vFaceOrd[3]])
|
|
|
|
|
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[2] - 1, sCutting, dSawDiam, nOrthoOpposite, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
|
|
|
|
if not bOk then return bOk, sErr end
|
|
|
|
|
end
|
|
|
|
|
-- taglio sulla faccia intermedia
|
|
|
|
|
if vFaceOrd[3] ~= 0 then
|
|
|
|
|
-- inserisco la lavorazione
|
|
|
|
|
local nOrthoOpposite = BL.GetNearestOrthoOpposite( EgtIf( bHead, X_AX(), -X_AX()))
|
|
|
|
|
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, nOrthoOpposite, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
|
|
|
|
if not bOk then return bOk, sErr end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- aggiornamento ingombro di testa o coda
|
|
|
|
|