DataBeam :
- migliorie e correzioni varie - unificati BirdsMouth con LapJoint.
This commit is contained in:
+109
-68
@@ -8,6 +8,7 @@ local ProcessDoubleCut = {}
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
local DC = require( 'DiceCut')
|
||||
local Cut = require( 'ProcessCut')
|
||||
|
||||
EgtOutLog( ' ProcessDoubleCut started', 1)
|
||||
|
||||
@@ -92,10 +93,8 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- verifico se necessari tagli supplementari
|
||||
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
|
||||
--DC.PrintOrderCut( vCuts)
|
||||
if #vCuts > 0 then
|
||||
-- se convesso, lo tratto come due tagli singoli
|
||||
if bConvex then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
@@ -103,87 +102,129 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- sistemo posizione nel DB e nome
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
end
|
||||
-- creo piano di taglio coincidente con la prima faccia e lo lavoro
|
||||
local AddId = EgtSurfTmPlaneInBBox( EgtGetParent( Proc.Id), ptC[1], vtN[1], b3Solid, GDB_RT.GLOB)
|
||||
if AddId then
|
||||
EgtRelocate( AddId, nAddGrpId)
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, 0)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- eseguo
|
||||
for i = 1, #vCuts do
|
||||
-- determino il modo di tagliare
|
||||
local k, l = nBigInd, nSmaInd
|
||||
if ( i % 2 == 1) == ( not bConvex) then
|
||||
k, l = l, k
|
||||
-- creo piano di taglio coincidente con la seconda faccia e lo lavoro
|
||||
local AddId = EgtSurfTmPlaneInBBox( EgtGetParent( Proc.Id), ptC[2], vtN[2], b3Solid, GDB_RT.GLOB)
|
||||
if AddId then
|
||||
EgtRelocate( AddId, nAddGrpId)
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, 0)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- altrimenti
|
||||
else
|
||||
-- verifico se necessari tagli supplementari
|
||||
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
|
||||
--DC.PrintOrderCut( vCuts)
|
||||
if #vCuts > 0 then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local nOrthoOpposite
|
||||
if bOnY then
|
||||
local bFront = ( ptC[k]:getY() < ptPs:getY())
|
||||
nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT)
|
||||
else
|
||||
if bConvex then
|
||||
if dLen < dMaxDepth then
|
||||
local bFront = ( vtN[k]:getY() < 0.02)
|
||||
nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT)
|
||||
-- sistemo posizione nel DB e nome
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
end
|
||||
end
|
||||
-- eseguo
|
||||
for i = 1, #vCuts do
|
||||
-- determino il modo di tagliare
|
||||
local k, l = nBigInd, nSmaInd
|
||||
if ( i % 2 == 1) == ( not bConvex) then
|
||||
k, l = l, k
|
||||
end
|
||||
local nOrthoOpposite
|
||||
if bOnY then
|
||||
local bFront = ( ptC[k]:getY() < ptPs:getY())
|
||||
nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT)
|
||||
else
|
||||
if bConvex then
|
||||
if dLen < dMaxDepth then
|
||||
local bFront = ( vtN[k]:getY() < 0.02)
|
||||
nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT)
|
||||
else
|
||||
local bOver = ( ptC[k]:getZ() > ptC[l]:getZ())
|
||||
nOrthoOpposite = EgtIf( bOver, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP)
|
||||
end
|
||||
else
|
||||
local bOver = ( ptC[k]:getZ() > ptC[l]:getZ())
|
||||
nOrthoOpposite = EgtIf( bOver, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP)
|
||||
end
|
||||
else
|
||||
local bOver = ( ptC[k]:getZ() > ptC[l]:getZ())
|
||||
nOrthoOpposite = EgtIf( bOver, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP)
|
||||
end
|
||||
-- lavoro la faccia
|
||||
for j = 1, #vCuts[i] do
|
||||
local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, nil, 0, BD.CUT_SIC, 0, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
-- lavoro la faccia
|
||||
for j = 1, #vCuts[i] do
|
||||
local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, nil, 0, BD.CUT_SIC, 0, nil, b3Raw)
|
||||
end
|
||||
-- se non ci sono tagli supplementari o convesso, tagli diretti delle facce
|
||||
if #vCuts == 0 then
|
||||
-- imposto eventuale affondamento aggiuntivo
|
||||
local dExtraCut = EgtIf( bConvex, BD.CUT_EXTRA, 0)
|
||||
-- eseguo sulle due facce
|
||||
for j = 1, 2 do
|
||||
-- determino ordine dei tagli
|
||||
local i = j
|
||||
if not bOnY and ptC[1]:getZ() > ptC[2]:getZ() then
|
||||
i = 3 - j
|
||||
end
|
||||
-- lavoro la faccia
|
||||
local nOrthoOpposite
|
||||
if bOnY then
|
||||
local bFront = ( ptC[i]:getY() < ptPs:getY())
|
||||
nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT)
|
||||
else
|
||||
if bConvex then
|
||||
if dLen < dMaxDepth then
|
||||
local bFront = ( vtN[i]:getY() < 0.02)
|
||||
nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT)
|
||||
else
|
||||
nOrthoOpposite = MCH_MILL_FU.ORTHO_DOWN
|
||||
end
|
||||
else
|
||||
local bOver = ( ptC[i]:getZ() > ptC[3-i]:getZ())
|
||||
nOrthoOpposite = EgtIf( bOver, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP)
|
||||
end
|
||||
end
|
||||
local bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, i - 1, sCutting, dSawDiam, nOrthoOpposite, nil, dExtraCut, BD.CUT_SIC, 0, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se non ci sono tagli supplementari o convesso, tagli diretti delle facce
|
||||
if #vCuts == 0 or bConvex then
|
||||
-- imposto eventuale affondamento aggiuntivo
|
||||
local dExtraCut = EgtIf( bConvex, BD.CUT_EXTRA, 0)
|
||||
-- eseguo sulle due facce
|
||||
for j = 1, 2 do
|
||||
-- determino ordine dei tagli
|
||||
local i = j
|
||||
if not bOnY and ptC[1]:getZ() > ptC[2]:getZ() then
|
||||
i = 3 - j
|
||||
end
|
||||
-- lavoro la faccia
|
||||
local nOrthoOpposite
|
||||
if bOnY then
|
||||
local bFront = ( ptC[i]:getY() < ptPs:getY())
|
||||
nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT)
|
||||
else
|
||||
if bConvex then
|
||||
if dLen < dMaxDepth then
|
||||
local bFront = ( vtN[i]:getY() < 0.02)
|
||||
nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT)
|
||||
else
|
||||
nOrthoOpposite = MCH_MILL_FU.ORTHO_DOWN
|
||||
end
|
||||
else
|
||||
local bOver = ( ptC[i]:getZ() > ptC[3-i]:getZ())
|
||||
nOrthoOpposite = EgtIf( bOver, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP)
|
||||
end
|
||||
end
|
||||
local bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, i - 1, sCutting, dSawDiam, nOrthoOpposite, nil, dExtraCut, BD.CUT_SIC, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
-- eventuale segnalazione ingombro di testa o coda
|
||||
if Proc.Head then
|
||||
BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX())
|
||||
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
|
||||
if vtNm:getZ() > 0.5 then
|
||||
dOffs = 0.5 * dOffs
|
||||
end
|
||||
BL.UpdateHCING( nRawId, dOffs)
|
||||
elseif Proc.Tail then
|
||||
BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Raw:getMin():getX())
|
||||
if vtNm:getZ() > 0.5 then
|
||||
dOffs = 0.5 * dOffs
|
||||
end
|
||||
local dOffs = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
|
||||
BL.UpdateTCING( nRawId, dOffs)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user