Merge branch 'master' into Feature/BigSection
This commit is contained in:
+47
-61
@@ -1,4 +1,4 @@
|
||||
-- ProcessCut.lua by Egaltech s.r.l. 2022/02/06
|
||||
-- ProcessCut.lua by Egaltech s.r.l. 2022/02/11
|
||||
-- Gestione calcolo singoli tagli di lama per Travi
|
||||
-- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito.
|
||||
-- 2021/06/06 Correzioni per tagli con testa da sotto.
|
||||
@@ -43,7 +43,7 @@ function ProcessCut.Classify( Proc, b3Raw)
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
if vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1 or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then
|
||||
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
|
||||
if DimH > BD.MAX_DIM_DICE then
|
||||
if DimH > BD.MAX_DIM_DICE and DimV > BD.MAX_DIM_DICE then
|
||||
return true, true
|
||||
end
|
||||
end
|
||||
@@ -195,7 +195,7 @@ end
|
||||
local function UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
||||
-- eventuale segnalazione ingombro di testa o coda (se non chiamata da altre feature)
|
||||
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
|
||||
if ProcessCut.Identify( Proc) and Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
|
||||
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
|
||||
if Proc.Head then
|
||||
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
|
||||
if vtN:getZ() > 0.5 then
|
||||
@@ -228,13 +228,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
end
|
||||
-- ingombro del pezzo
|
||||
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
|
||||
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
if not b3Solid then
|
||||
local sErr = 'Error : part box not found'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
-- dati geometrici del taglio
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- limiti di taglio (se molto di lato e inclinati sono permessi fino a -45deg)
|
||||
@@ -297,7 +291,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
end
|
||||
end
|
||||
-- se vero taglio, eventuale inserimento smussi
|
||||
if Proc.Prc == 10 then
|
||||
if ProcessCut.Identify( Proc) then
|
||||
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOkc then return bOkc, sErrC end
|
||||
end
|
||||
@@ -319,6 +313,13 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
dCutH = min( dCutH, b3Raw:getDimY() / abs( frFac:getVersX():getY()))
|
||||
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA and not bDownCut)
|
||||
local bVertCutOk = ( dCutH < dMaxDepth - BD.CUT_EXTRA)
|
||||
-- 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
|
||||
-- verifico se necessari tagli supplementari
|
||||
EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3)
|
||||
local vCuts = {}
|
||||
@@ -332,13 +333,13 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
bAutoCalcSurf = false
|
||||
end
|
||||
if bForced then
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Raw, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Raw, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
|
||||
else
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
|
||||
end
|
||||
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate
|
||||
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
|
||||
end
|
||||
end
|
||||
-- se il ProcessCut viene lanciato dal ProcessSawCut e non ci sono tagli a cubetti, esco
|
||||
@@ -347,18 +348,10 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
end
|
||||
--DC.PrintOrderCut( vCuts)
|
||||
if #vCuts > 0 then
|
||||
-- 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
|
||||
-- sistemo posizione nel DB e nome
|
||||
local bOrthInv = false
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
if ( i % 2) == 1 then
|
||||
@@ -427,9 +420,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
if not BD.C_SIMM and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.707 end
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, dVzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- tutti gli altri casi vengono saltati
|
||||
-- caso generale
|
||||
@@ -452,9 +443,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
local dVzLimDwnUp = dNzLimDwnUp
|
||||
if not BD.C_SIMM and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -493,12 +482,8 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
end
|
||||
-- taglio
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- Aggiornamento ingombro
|
||||
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -508,17 +493,11 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
|
||||
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
if not b3Solid then
|
||||
local sErr = 'Error : part box not found'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
-- dati geometrici del taglio
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- se vero taglio, eventuale inserimento smussi
|
||||
if Proc.Prc == 10 then
|
||||
if ProcessCut.Identify( Proc) then
|
||||
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOkc then return bOkc, sErrC end
|
||||
end
|
||||
@@ -539,6 +518,13 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local frFac, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0)
|
||||
dCutH = min( dCutH, b3Raw:getDimY() / abs( frFac:getVersX():getY()))
|
||||
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA) or Proc.AdvTail
|
||||
-- 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
|
||||
-- verifico se necessari tagli supplementari
|
||||
EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3)
|
||||
local vCuts = {}
|
||||
@@ -551,22 +537,14 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
vtExtra = X_AX()
|
||||
bAutoCalcSurf = false
|
||||
end
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, nil ,true)
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, nil ,true)
|
||||
end
|
||||
--DC.PrintOrderCut( vCuts)
|
||||
if #vCuts > 0 then
|
||||
-- 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
|
||||
-- sistemo posizione nel DB e nome
|
||||
local bOrthInv = false
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
if ( i % 2) == 1 then
|
||||
@@ -645,9 +623,7 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire)
|
||||
if vCuts[i+1][j] then
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -688,18 +664,14 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
dCutExtra = min( -BD.ADVANCE_TAIL_OFFS, dMaxVertDepth - dCutV)
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, -2, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- Aggiornamento ingombro
|
||||
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail)
|
||||
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng)
|
||||
if not dOvmTail then
|
||||
dOvmTail = BD.OVM_MID
|
||||
end
|
||||
@@ -707,6 +679,13 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
|
||||
-- ingombro del grezzo
|
||||
b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
end
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
if not b3Solid then
|
||||
local sErr = 'Error : part box not found'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
-- dati geometrici del taglio
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- se taglio di testa
|
||||
@@ -744,11 +723,18 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
|
||||
end
|
||||
-- se taglio con testa da sopra
|
||||
if not bDownHead and not bDownTurn then
|
||||
return MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
|
||||
local bOk, sErr = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
|
||||
if not bOk then return false, sErr end
|
||||
-- altrimenti taglio con testa da sotto
|
||||
else
|
||||
return MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
|
||||
local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- Aggiornamento ingombro (se vero taglio o richiesto)
|
||||
if ProcessCut.Identify( Proc) or bUpdateIng then
|
||||
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user