diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 4633774..d9eeb9a 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1,4 +1,4 @@ --- BeamExec.lua by Egaltech s.r.l. 2022/09/24 +-- BeamExec.lua by Egaltech s.r.l. 2022/09/28 -- Libreria esecuzione lavorazioni per Travi -- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3. -- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato. @@ -36,6 +36,7 @@ -- 2022/08/08 Modifica per macchine senza BD.MAX_WIDTH2 e BD.MAX_HEIGHT2. -- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata. -- 2022/09/21 Nella funzione di ordinamento il foro del birdsmouth viene sempre fatto prima della lavorazione stessa +-- 2022/09/28 I fori vengono sempre fatti prima delle tacche. -- Tabella per definizione modulo local BeamExec = {} @@ -321,6 +322,8 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) Proc2.Fce = Proc.Fcs Proc2.CutId = Proc.CutId Proc2.TaskId = Proc.TaskId + Proc2.AdjId = Proc.AdjId + Proc2.MainId = Proc.MainId table.insert( vProc, Proc2) end -- se BlockHaus HalfLap @@ -651,7 +654,7 @@ end local function OrderFeatures( vProc, b3Raw) local dDrillPenalty = EgtIf( BD.PRESS_ROLLER, 200, 100) - local dSmallDrillRange = EgtIf( b3Raw:getDimX() < BD.LEN_SHORT_PART, 200, 600) + local dSmallDrillRange = EgtIf( b3Raw:getDimX() < BD.LEN_SHORT_PART, BD.DRILL_RANGE_SP or 200, BD.DRILL_RANGE or 600) -- funzione di confronto -- secondo centro box in X (taglio di intestazione prima di altri tagli di testa e taglio di separazione però prima di altri tagli di coda) @@ -680,12 +683,14 @@ local function OrderFeatures( vProc, b3Raw) if B1.Head ~= B2.Head then return B1.Head end - -- se primo è foro di un birdsmouth e secondo è il suo birdsmouth, il foro va sempre prima - if Drill.Identify(B1) and LapJoint.Identify(B2) and B1.MainId == B2.Id then + -- se primo è foro e secondo è un ribasso, il foro va sempre prima + if Drill.Identify(B1) and LapJoint.Identify(B2) and + B1.Box:getCenter():getX() > B2.Box:getMin():getX() and B1.Box:getCenter():getX() < B2.Box:getMax():getX() then return true end - -- se primo è birdsmouth e secondo è il suo foro, il birdsmouth va sempre dopo - if LapJoint.Identify(B1) and Drill.Identify(B2) and B1.AdjId == B2.Id then + -- se primo è un ribasso e secondo è un foro, il ribasso va sempre dopo + if LapJoint.Identify(B1) and Drill.Identify(B2) and + B2.Box:getCenter():getX() > B1.Box:getMin():getX() and B2.Box:getCenter():getX() < B1.Box:getMax():getX() then return false end -- se entrambi tenoni e si intersecano, metto prima tenone vero e poi base tenone diff --git a/LuaLibs/DiceCut.lua b/LuaLibs/DiceCut.lua index f8c5162..32d0a9e 100644 --- a/LuaLibs/DiceCut.lua +++ b/LuaLibs/DiceCut.lua @@ -377,12 +377,13 @@ end -- ptCBond*: il punto centrale della superfice limitante (se non esistono altre superfici può essere omesso) -- vtNBond*: il versore normale della superfice limitante (se non esistono altre superfici può essere omesso) -- dOrthoMaxDim : massima profondità taglio se faccia singola perpendicolare facce laterali trave --- dCustMaxDimDice: dimensione massima customizzata, sostituisce il parametro BD.MAX_DIM_DICE +-- dCustMaxDimDice: dimensione massima customizzata, sostituisce il parametro BD.MAX_DIM_DICE (se negativa qualunque, se positiva deve stare nel MAX) -- bDownHead : taglio con testa da sotto ---------------------------------------------------------------------------------------------------------------------------------------------------- function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPlanes, ptCBond, vtNBond, dOrthoMaxDim, dCustMaxDimDice, bDownHead) - local dMaxDimDice = EgtIf( dCustMaxDimDice and dCustMaxDimDice < BD.MAX_DIM_DICE, dCustMaxDimDice, BD.MAX_DIM_DICE) + local dMaxDimDice = BD.MAX_DIM_DICE + if dCustMaxDimDice and dCustMaxDimDice < BD.MAX_DIM_DICE then dMaxDimDice = abs( dCustMaxDimDice) end local dTolerance = 0 -- distanza di sicurezza per i tagli ortogonali local OffsetP = dMaxDimDice -- distanza tra i piani paralleli local StepP = 100 -- numero massimo di piani paralleli da generare diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index af6d7c3..93c8e47 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -1,4 +1,4 @@ --- ProcessCut.lua by Egaltech s.r.l. 2022/07/28 +-- ProcessCut.lua by Egaltech s.r.l. 2022/09/30 -- 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. @@ -353,9 +353,29 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b vtExtra = X_AX() bAutoCalcSurf = false end + -- verifico elevazione max del materiale tagliato + local dMaxElev + if vtN:getX() > 0 then + dMaxElev = b3Solid:getMax():getX() - Proc.Box:getMin():getX() + else + dMaxElev = Proc.Box:getMax():getX() - b3Solid:getMin():getX() + end + -- per macchina TURN aggiusto massima dimensione cubetto + local dNewDiceDim + if BD.TURN then + local dDimRef = GEO.INFINITO + if abs( vtN:getZ()) < 0.003 then + dDimRef = b3Raw:getDimZ() + elseif abs( vtN:getY()) < 0.003 then + dDimRef = b3Raw:getDimY() + end + if dDimRef + BD.CUT_EXTRA < dMaxDepth then + dNewDiceDim = - ( dMaxDepth - BD.CUT_EXTRA) + end + end -- se il taglio è più spesso della lama abilito il dicing, altrimenti no - if Proc.Box:getDimX() >= dSawThick then - vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA) + if dMaxElev > dSawThick then + vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, dNewDiceDim) -- 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( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY()) @@ -754,7 +774,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, if not bOk then return false, sErr end end -- Aggiornamento ingombro (se vero taglio o richiesto) - -- Se lascio il cordolo (bNoDicing) non aggiorno il grezzo perchèlo scarto rimane attaccato + -- Se lascio il cordolo (bNoDicing) non aggiorno il grezzo perchè lo scarto rimane attaccato if ( ProcessCut.Identify( Proc) or bUpdateIng) and not bNoDicing then UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw) end diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index 11abebf..deb3095 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -4,6 +4,7 @@ -- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita. -- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata. -- 2022/09/08 Migliorato verso di lavorazione in caso di DoubleCut +-- 2022/09/26 Gestione dei tagli di lama (Horiz, double, etc.) estesa anche a BigSection -- Tabella per definizione modulo local ProcessHeadCut = {} @@ -191,9 +192,9 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM)) local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and ( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) - local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA) - local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) - local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) + local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA) + local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) + local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) -- dati geometrici del taglio local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) -- se non obbligatorio e coincide con inizio grezzo, non va fatto @@ -203,14 +204,14 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut -- determino se più tagli con offset local nCuts = max( ceil( dOvmHead / ( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP)), 1) local dOffsL = dOvmHead / nCuts + local bFinishByBlade = not bBigSectionCut -- se taglio per sezioni alte e larghe if bBigSectionCut then if dOvmHead > 0 then local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0 - -- se finitura con lama + -- se finitura con lama rimando ai casi standard if nQ05 == 1 or nQ05 == 0 then - local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT) - if not bOk then return bOk, sErr end + bFinishByBlade = true -- se finitura con truciolatore elseif nQ05 == 2 then local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) @@ -229,73 +230,76 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut if not bOk then return bOk, sErr end end end - -- se tagli standard - elseif not bDoubleHorizCut then - -- flag di lavorazione faccia - local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT) - -- calcolo extra taglio ed accorciamento - local dCutExtra = 0 - local dAccStart = 0 - local dAccEnd = 0 - if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then - dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA) - else - dCutExtra = - ( b3Raw:getDimY() - dMaxDepth) - local dSawRad = dSawDiam / 2 - local dKL = dSawRad - dMaxDepth + b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN - if BD.C_SIMM then - dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL) + end + -- tagli standard con lama + if bFinishByBlade then + if not bDoubleHorizCut then + -- flag di lavorazione faccia + local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT) + -- calcolo extra taglio ed accorciamento + local dCutExtra = 0 + local dAccStart = 0 + local dAccEnd = 0 + if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then + dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA) else - dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL) + dCutExtra = - ( b3Raw:getDimY() - dMaxDepth) + local dSawRad = dSawDiam / 2 + local dKL = dSawRad - dMaxDepth + b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN + if BD.C_SIMM then + dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL) + else + dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL) + end end - end - -- se necessari tagli in doppio, eseguo gli opposti - if bDoubleCut then + -- se necessari tagli in doppio, eseguo gli opposti + if bDoubleCut then + for i = nCuts, 1, -1 do + local dCutOffset = ( i - 1) * dOffsL + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw, true) + if not bOk then return false, sErr end + end + end + -- eseguo i tagli necessari for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsL - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw, true) + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw) + if not bOk then return false, sErr end + end + -- altrimenti necessari tagli da sopra e sotto con testa opportuna + else + -- verifico esistenza della lavorazione con lama da sotto + if not sCutting2 then + local sErr = 'Error : cutting H2 not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- verifico che le due lame riescano a lavorare la sezione + local dDimZ = b3Raw:getDimZ() + local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ + if dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0 then + local sErr = 'Error : section too big for head cut' + EgtOutLog( sErr) + return false, sErr + end + -- calcolo extra taglio ed accorciamento + local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN + local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN + local dAccStart = 0 + local dVzLimDwnUp + if BD.TURN then dVzLimDwnUp = -2 end + -- eseguo i tagli da sotto necessari + for i = nCuts, 1, -1 do + local dCutOffset = ( i - 1) * dOffsL + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw) + if not bOk then return false, sErr end + end + -- eseguo i tagli da sopra necessari + for i = nCuts, 1, -1 do + local dCutOffset = ( i - 1) * dOffsL + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw) if not bOk then return false, sErr end end - end - -- eseguo i tagli necessari - for i = nCuts, 1, -1 do - local dCutOffset = ( i - 1) * dOffsL - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw) - if not bOk then return false, sErr end - end - -- altrimenti necessari tagli da sopra e sotto con testa opportuna - else - -- verifico esistenza della lavorazione con lama da sotto - if not sCutting2 then - local sErr = 'Error : cutting H2 not found in library' - EgtOutLog( sErr) - return false, sErr - end - -- verifico che le due lame riescano a lavorare la sezione - local dDimZ = b3Raw:getDimZ() - local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ - if dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0 then - local sErr = 'Error : section too big for head cut' - EgtOutLog( sErr) - return false, sErr - end - -- calcolo extra taglio ed accorciamento - local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN - local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN - local dAccStart = 0 - local dVzLimDwnUp - if BD.TURN then dVzLimDwnUp = -2 end - -- eseguo i tagli da sotto necessari - for i = nCuts, 1, -1 do - local dCutOffset = ( i - 1) * dOffsL - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw) - if not bOk then return false, sErr end - end - -- eseguo i tagli da sopra necessari - for i = nCuts, 1, -1 do - local dCutOffset = ( i - 1) * dOffsL - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw) - if not bOk then return false, sErr end end end return true diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index aff82b1..2b8ff49 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2022/07/05 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/09/27 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. -- 2021/01/24 Con sega a catena ora sempre impostato asse A. @@ -54,6 +54,7 @@ -- 2022/09/15 Implementata gestione feature Planing L090, gestita come LapJoint -- Implementata, in caso di fresatura di lato con altezza tasca molto bassa, la contornatura con unica passata -- Migliorata gestione AntiSplint (Mill e Saw) +-- 2022/09/27 Aggiunta gestione SCC per svuotature con TURN (solo dopo applicazione lavorazione). -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -3001,7 +3002,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe end --------------------------------------------------------------------- -local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRoughTool, sMasterPocket, dPrevFaceElev, tDimAndRef, dAng, bOpenOutRaw) +local function MakePocket( Proc, nPartId, b3Solid, ptPs, tvtN, nFaceRef, sMchFind, nUseRoughTool, sMasterPocket, dPrevFaceElev, tDimAndRef, dAng, bOpenOutRaw) -- calcolo l'elevazione dal punto medio local dElev @@ -3119,6 +3120,24 @@ local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRo return false, sErr end end + if BD.TURN then + -- centro del pezzo + local ptCen = ORIG() + if b3Solid then ptCen = b3Solid:getCenter() end + -- punto inizio lavorazione + local ptStart = EgtGetMachiningStartPoint() or ORIG() + -- orientamento braccio + local nSCC = MCH_SCC.NONE + -- se faccia verso alto o basso + if abs( tvtN[2]:getZ()) > abs( tvtN[2]:getY()) then + nSCC = EgtIf( ptStart:getY() > ptCen:getY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) + -- altrimenti faccia verso davanti o dietro + else + nSCC = EgtIf( ptStart:getZ() > ptCen:getZ(), MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM) + end + EgtSetMachiningParam( MCH_MP.SCC, nSCC) + ML.ApplyMachining( true, false) + end return true, sWarn, sTuuidPk, dDiamTool, dDepth end @@ -3144,7 +3163,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas -- se l'angolo dalla verticale si discosta di più dell'angolo limite impostato, utilizzo la svuotatura if cos( dDiffFromSqAng) < cos( dAngLimit) then -- applico la svuotatura - local bOk, sWarn, sTuuidPk, dDiamTool, dElev = MakePocket( Proc, nPartId, ptPs, tvtN, nSideFace, sMchFind, nUseRoughTool, sPocketing, dPrevFaceElev, tDimAndRef, dAng) + local bOk, sWarn, sTuuidPk, dDiamTool, dElev = MakePocket( Proc, nPartId, b3Solid, ptPs, tvtN, nSideFace, sMchFind, nUseRoughTool, sPocketing, dPrevFaceElev, tDimAndRef, dAng) if not bOk then -- se ho id utensile e diametro è perchè non ha fatto svuotatura perchè la faccia è più stretta del diametro utensile -- e provo ad inserire singola passata di testa @@ -5145,7 +5164,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa dToolMaxDiam = min ( dFacDim1, dFacDim2, dToolTargetDiam) end local _, sPocketing = VerifyPocket( Proc, dToolMaxDiam, dFacElev, nil, sMyMchFind) - bOk, sWarn2, sTuuidPk, dDiamTool, dDepth = MakePocket( Proc, nPartId, ptPs, tvtNx, nFacInd, sMyMchFind, nUseRoughTool, sPocketing, dMachDepth, nil, nil, bAllWithEndCap) + bOk, sWarn2, sTuuidPk, dDiamTool, dDepth = MakePocket( Proc, nPartId, b3Solid, ptPs, tvtNx, nFacInd, sMyMchFind, nUseRoughTool, sPocketing, dMachDepth, nil, nil, bAllWithEndCap) if not bOk then return false, sWarn2 end if sWarn2 then if not sWarn then sWarn = '' end @@ -5327,7 +5346,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local tvtNx = {} tvtNx[2] = vtN local bOk, sWarn2 - bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, ptC, tvtNx, nFacInd, sMchFind, nUseRoughTool, sPocketing, dFacElev + dCollSic, nil, nil, bAllWithEndCap) + bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, b3Solid, ptC, tvtNx, nFacInd, sMchFind, nUseRoughTool, sPocketing, dFacElev + dCollSic, nil, nil, bAllWithEndCap) if not bOk then return false, sWarn2 end if sWarn2 then if not sWarn then sWarn = '' end diff --git a/LuaLibs/ProcessMortise.lua b/LuaLibs/ProcessMortise.lua index b1c0db6..1b8a87d 100644 --- a/LuaLibs/ProcessMortise.lua +++ b/LuaLibs/ProcessMortise.lua @@ -4,6 +4,8 @@ -- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda). -- 2022/07/26 Aggiunta gestione del parametro P04=1 per la pulizia degli angoli con mortasatrice (sega a catena) specifica -- 2022/07/29 Nella pulitura angoli aggiunto il check dimensioni tasca vs utensile. Corretta direzione utensile per mortasa frontale. +-- 2022/09/27 Migliorata la scelta utensile. Se c'è almeno una lavorazione 'mortise' si cerca di usare quelle, riducendo l'elevazione se necessario. +-- Se non c'è nemmeno una lavorazione 'mortise' si passa alle pocket. -- Tabella per definizione modulo local ProcessMortise = {} @@ -229,6 +231,35 @@ local function CleanCorners( Proc, dMorH, vtN, bDoubleDir, AuxId) return true, sWarn end +--------------------------------------------------------------------- +local function VerifyMortiseOrPocket( Proc, dDiam, dDepth, dMaxTotLen, sType, bPocketDown) + -- ricerca della svuotatura + local sPocketing + if dDepth then + sPocketing = ML.FindPocketing( sType, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or + ML.FindPocketing( sType, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or + ML.FindPocketing( sType, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or + ML.FindPocketing( sType, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or + ML.FindPocketing( sType, dDiam, 0, dMaxTotLen) + else + sPocketing = ML.FindPocketing( sType, dDiam, 0, dMaxTotLen) + end + if not sPocketing then + return false + end + -- recupero i dati dell'utensile + local dMaxDepth = 0 + local dToolDiam = 0 + if EgtMdbSetCurrMachining( sPocketing) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam + dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth + end + end + return sPocketing, dMaxDepth, dToolDiam +end + --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) @@ -309,8 +340,10 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- se il percorso ausiliario è esterno al grezzo, lo riavvicino if abs( dMove) > GEO.EPS_SMALL then AuxId = EgtCopyGlob( AuxId, BL.GetAddGroup( nPartId)) - EgtMove( AuxId, Vector3d(0,0,-dMove)) - EgtMove( nFlat, Vector3d(0,0,-dMove)) + local vtMove = Vector3d(0,0,dMove) + vtMove:toGlob(frMor) + EgtMove( AuxId, vtMove, GDB_RT.GLOB) + EgtMove( nFlat, vtMove, GDB_RT.GLOB) frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT) ptC = frMor:getOrigin() vtN = frMor:getVersZ() @@ -387,16 +420,16 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end local sPocketing if Proc.Prc ~= 53 then - sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown) + sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown) if not sPocketing and bPockUp then - sPocketing = ML.FindPocketing( sPockType, dW) + sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt) end end if not sPocketing then sPockType = 'Pocket' - sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown) + sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown) if not sPocketing and bPockUp then - sPocketing = ML.FindPocketing( sPockType, dW) + sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt) end end if not sPocketing then diff --git a/LuaLibs/ProcessScarfJoint.lua b/LuaLibs/ProcessScarfJoint.lua index f54cabf..71bb9e4 100644 --- a/LuaLibs/ProcessScarfJoint.lua +++ b/LuaLibs/ProcessScarfJoint.lua @@ -1,4 +1,4 @@ --- ProcessScarfJoint.lua by Egaltech s.r.l. 2022/07/12 +-- ProcessScarfJoint.lua by Egaltech s.r.l. 2022/09/30 -- Gestione calcolo giunto Gerber per Travi -- 2021/06/28 Aggiunto extra-taglio alle lamate orizzontali. -- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe) @@ -173,7 +173,11 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli if vtO then vtOrthoO = Vector3d( vtO) else - vtOrthoO = Y_AX() + if vtN[vFaceOrd[4]]:getZ() < 0.1 then + vtOrthoO = Z_AX() + else + vtOrthoO = Y_AX() + end end end end @@ -310,10 +314,12 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa end -- recupero i dati dell'utensile local dSawDiam = 400 + local dMaxDepth = 0 if EgtMdbSetCurrMachining( sCutting) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam + dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth end end @@ -346,7 +352,6 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa EgtOutLog( sErr) return false, sErr end - -- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti nGoodFace1 = EgtSurfTmFacetCount( nFace1) nGoodFace4 = EgtSurfTmFacetCount( nFace4) @@ -356,21 +361,27 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa nGoodFace1 = EgtSurfTmFacetCount( nFace1) end - local bOkd, sErrD, vCuts = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw) + -- per macchina TURN aggiusto massima dimensione cubetto + local dNewDiceDim + if BD.TURN and nGoodFace4 and nGoodFace4 > 0 then + local dDimRef = EgtIf( abs( vtN[vFaceOrd[4]]:getZ()) < 0.1, b3Raw:getDimZ(), b3Raw:getDimY()) + if dDimRef + BD.CUT_EXTRA < dMaxDepth then + dNewDiceDim = - ( dMaxDepth - BD.CUT_EXTRA) + end + end + + local bOkd, sErrD, vCuts = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim) if not bOkd then return bOkd, sErrD end if #vCuts == 0 then -- se ho la faccia intermedia, per prima cosa verifico se ho intersezione con la faccia tappo if nGoodFace4 ~= 0 then - -- taglio sulla faccia interna - if vFaceOrd[1] ~= 0 then - -- inserisco la lavorazione - local vtOrthoO = Vector3d( vtRef) - bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) - if not bOkd then return bOkd, sErrD end - end -- se non ho intersezione con la faccia tappo posso fare il taglio sul fianco if not nGoodFace1 or nGoodFace1 == 0 then + -- inserisco la lavorazione + local vtRef2 = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, Z_AX(), EgtIf( bHead, Y_AX(), -Y_AX())) + bOkd, sErrD = Fbs.MakeOne( nFace4, nGoodFace4 - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) + if not bOkd then return bOkd, sErrD end -- lavoro la faccia opposta (definita dal parametro P11) if vFaceOrd[3] ~= 0 then -- inserisco la lavorazione @@ -378,16 +389,20 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) if not bOkd then return bOkd, sErrD end end - -- inserisco la lavorazione - local vtRef2 = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, Z_AX(), EgtIf( bHead, Y_AX(), -Y_AX())) - bOkd, sErrD = Fbs.MakeOne( nFace4, nGoodFace4 - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) - if not bOkd then return bOkd, sErrD end - else -- altrimenti se ho intersezione forzo il DiceCut ad essere eseguito con distanze più piccole + -- altrimenti se ho intersezione forzo il DiceCut ad essere eseguito con distanze più piccole + else -- definisco la nuova dimensione massima del dice cut local dNewDiceDim = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, b3Raw:getDimZ(), b3Raw:getDimY()) bOkd, sErrD = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim) if not bOkd then return bOkd, sErrD end end + -- taglio sulla faccia interna + if vFaceOrd[1] ~= 0 then + -- inserisco la lavorazione + local vtOrthoO = Vector3d( vtRef) + bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) + if not bOkd then return bOkd, sErrD end + end else -- taglio sulla faccia interna if vFaceOrd[1] ~= 0 then diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index db567be..c47745b 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -4,6 +4,7 @@ -- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita. -- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata. -- 2022/09/08 Migliorato verso di lavorazione in caso di DoubleCut +-- 2022/09/26 Gestione dei tagli di lama (Horiz, double, etc.) estesa anche a BigSection -- Tabella per definizione modulo local ProcessSplit = {} @@ -279,9 +280,9 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM)) local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and ( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) - local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)) - local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) - local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) + local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)) + local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) + local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) -- dati geometrici del taglio local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) -- flag di lavorazione faccia @@ -305,6 +306,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt end -- se taglio per pezzi alti e larghi local nNewPhase = 0 + local bFinishByBlade = not bBigSectionCut if bBigSectionCut then local bFinishingNeeded = false if bSplit then @@ -381,12 +383,12 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt sNotes = 'Precut;' sNotesFinal = 'Cut;' end - -- se finitura con lama - if not nOriId or EgtGetInfo( nOriId, 'Q05', 'i') == 1 or EgtGetInfo( nOriId, 'Q05', 'i') == 0 or not bSplit then - local bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dLenEndRaw, nil, false, true, b3Raw, sNotes, dCurrOvmT) - if not bOk then return bOk, sErr, nNewPhase end + local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0 + -- se finitura con lama rimando ai casi standard + if nQ05 == 1 or nQ05 == 0 or not bSplit then + bFinishByBlade = true -- se finitura con truciolatore - elseif EgtGetInfo( nOriId, 'Q05', 'i') == 2 then + elseif nQ05 == 2 then local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) if not b3Solid then local sErr = 'Error : part box not found' @@ -406,86 +408,89 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal) end end - -- se tagli standard - elseif not bDoubleHorizCut then - -- calcolo extra taglio ed accorciamento - local dCutExtra = 0 - local dAccStart = 0 - local dAccEnd = 0 - if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then - dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA) - else - dCutExtra = - ( b3Raw:getDimY() - dMaxDepth) - local dSawRad = dSawDiam / 2 - local dKL = dSawRad - dMaxDepth + b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN - if BD.C_SIMM then - dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL) + end + -- tagli standard con lama + if bFinishByBlade then + if not bDoubleHorizCut then + -- calcolo extra taglio ed accorciamento + local dCutExtra = 0 + local dAccStart = 0 + local dAccEnd = 0 + if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then + dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA) else - dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL) + dCutExtra = - ( b3Raw:getDimY() - dMaxDepth) + local dSawRad = dSawDiam / 2 + local dKL = dSawRad - dMaxDepth + b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN + if BD.C_SIMM then + dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL) + else + dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL) + end end - end - -- se necessari tagli in doppio, eseguo gli opposti - if bDoubleCut then + -- se necessari tagli in doppio, eseguo gli opposti + if bDoubleCut then + for i = nCuts, 1, -1 do + local dCutOffset = ( i - 1) * dOffsL + local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;') + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, true) + if not bOk then return false, sErr end + end + end + -- eseguo i tagli necessari + for i = nCuts, 1, -1 do + local dCutOffset = ( i - 1) * dOffsL + local sNotes + if bSplit then + sNotes = EgtIf( i == 1, 'Split;', 'Presplit;') + else + sNotes = EgtIf( i == 1, 'Cut;', 'Precut;') + end + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw) + if not bOk then return false, sErr end + end + -- altrimenti necessari tagli da sopra e sotto con testa opportuna + else + -- verifico esistenza della lavorazione con lama da sotto + if not sCutting2 then + local sErr = 'Error : cutting H2 not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- verifico che le due lame riescano a lavorare la sezione + local dDimZ = b3Raw:getDimZ() + local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ + if dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0 then + local sErr = 'Error : section too big for tail cut' + EgtOutLog( sErr) + return false, sErr + end + -- calcolo extra taglio ed accorciamento + local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN + local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN + local dAccStart = 0 + -- limiti da sotto + local dVzLimDwnUp + if BD.TURN then dVzLimDwnUp = -2 end + -- eseguo i tagli da sotto necessari for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsL local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;') - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, true) + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw) if not bOk then return false, sErr end end - end - -- eseguo i tagli necessari - for i = nCuts, 1, -1 do - local dCutOffset = ( i - 1) * dOffsL - local sNotes - if bSplit then - sNotes = EgtIf( i == 1, 'Split;', 'Presplit;') - else - sNotes = EgtIf( i == 1, 'Cut;', 'Precut;') + -- eseguo i tagli da sopra necessari + for i = nCuts, 1, -1 do + local dCutOffset = ( i - 1) * dOffsL + local sNotes + if bSplit then + sNotes = EgtIf( i == 1, 'Split;', 'Presplit;') + else + sNotes = EgtIf( i == 1, 'Cut;', 'Precut;') + end + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw) + if not bOk then return false, sErr end end - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw) - if not bOk then return false, sErr end - end - -- altrimenti necessari tagli da sopra e sotto con testa opportuna - else - -- verifico esistenza della lavorazione con lama da sotto - if not sCutting2 then - local sErr = 'Error : cutting H2 not found in library' - EgtOutLog( sErr) - return false, sErr - end - -- verifico che le due lame riescano a lavorare la sezione - local dDimZ = b3Raw:getDimZ() - local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ - if dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0 then - local sErr = 'Error : section too big for tail cut' - EgtOutLog( sErr) - return false, sErr - end - -- calcolo extra taglio ed accorciamento - local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN - local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN - local dAccStart = 0 - -- limiti da sotto - local dVzLimDwnUp - if BD.TURN then dVzLimDwnUp = -2 end - -- eseguo i tagli da sotto necessari - for i = nCuts, 1, -1 do - local dCutOffset = ( i - 1) * dOffsL - local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;') - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw) - if not bOk then return false, sErr end - end - -- eseguo i tagli da sopra necessari - for i = nCuts, 1, -1 do - local dCutOffset = ( i - 1) * dOffsL - local sNotes - if bSplit then - sNotes = EgtIf( i == 1, 'Split;', 'Presplit;') - else - sNotes = EgtIf( i == 1, 'Cut;', 'Precut;') - end - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw) - if not bOk then return false, sErr end end end return true, nil, nNewPhase