diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 3daa60b..61708ee 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -248,8 +248,10 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead) ForEnd = 1 ForStep = -1 end + -- se scelta testa migliorata oppure se non devo usare la testa da sotto parto sempre da testa 1 if ( BEAM and BEAM.BW) or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then _, sType = EgtEndsWith( sType, '_H2') + -- se scelta testa migliorata è disattivata e devo usare la testa sotto forzo testa 2 elseif ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bDownHead then if not EgtEndsWith( sType, '_H2') then sType = sType .. '_H2' diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 93c8e47..4e89599 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -356,9 +356,17 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b -- verifico elevazione max del materiale tagliato local dMaxElev if vtN:getX() > 0 then - dMaxElev = b3Solid:getMax():getX() - Proc.Box:getMin():getX() + if bForced then + dMaxElev = b3Raw:getMax():getX() - Proc.Box:getMin():getX() + else + dMaxElev = b3Solid:getMax():getX() - Proc.Box:getMin():getX() + end else - dMaxElev = Proc.Box:getMax():getX() - b3Solid:getMin():getX() + if bForced then + dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX() + else + dMaxElev = Proc.Box:getMax():getX() - b3Solid:getMin():getX() + end end -- per macchina TURN aggiusto massima dimensione cubetto local dNewDiceDim diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index deb3095..11abebf 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -4,7 +4,6 @@ -- 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 = {} @@ -192,9 +191,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 = ( ( 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) + 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) -- 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 @@ -204,14 +203,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 rimando ai casi standard + -- se finitura con lama if nQ05 == 1 or nQ05 == 0 then - bFinishByBlade = true + local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT) + if not bOk then return bOk, sErr end -- se finitura con truciolatore elseif nQ05 == 2 then local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) @@ -230,77 +229,74 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut if not bOk then return bOk, sErr end end end - 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 - 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 - -- 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, 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 + -- 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 - -- 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 + 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 - -- 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 + end + -- 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, 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) + 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, 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 end diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index c47745b..cdb3873 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -4,7 +4,6 @@ -- 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 = {} @@ -280,9 +279,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 = ( ( 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) + 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) -- dati geometrici del taglio local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) -- flag di lavorazione faccia @@ -306,7 +305,6 @@ 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 @@ -384,9 +382,10 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt sNotesFinal = 'Cut;' end local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0 - -- se finitura con lama rimando ai casi standard + -- se finitura con lama if nQ05 == 1 or nQ05 == 0 or not bSplit then - bFinishByBlade = true + 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 -- se finitura con truciolatore elseif nQ05 == 2 then local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) @@ -408,89 +407,86 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal) end end - 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 - 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 - -- 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 + -- 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 - -- 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 + 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 - -- 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 + end + -- 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, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw) + 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 - -- 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 + -- 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, 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