diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index 7dcf2c8..149d432 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -264,35 +264,35 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt end -- recupero i dati dell'utensile local dSawDiam = 400 - local dMaxDepth = 50 + local dSawMaxDepth = 50 local dSawThick = 2 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 + dSawMaxDepth = EgtTdbGetCurrToolMaxDepth() or dSawMaxDepth dSawThick = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick end end - local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) + local dMaxVertDepth = dSawMaxDepth - ( BD.DECR_VERT_CUT or 0) -- recupero la eventuale lavorazione con lama da sotto local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true) -- recupero i dati della eventuale seconda lama local dSawDiam2 = 0 - local dMaxDepth2 = 0 + local dSawMaxDepth2 = 0 local dSawThick2 = 0 if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2 - dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2 + dSawMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dSawMaxDepth2 dSawThick2 = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick2 end end -- caratteristiche taglio - local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM)) + local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dSawMaxDepth, 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) + ( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dSawMaxDepth2) - 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) @@ -334,6 +334,26 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt dTLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dTLen end end + + ---@alias SplitType + ---| '"single horizontal"' # taglio con motosega da sopra + ---| '"single vertical"' # taglio con motosega da davanti + ---| '"double vertical"' # taglio doppio con motosega da sopra e lama da sotto + ---| '"double horizontal"' # taglio doppio con motosega davanti e dietro + + ---@type ( SplitType) + local bigSectionSplitType + + if b3Raw:getDimZ() < dMaxMat - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL then + bigSectionSplitType = "single horizontal" + elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dMaxMat, dTLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then + bigSectionSplitType = "single vertical" + elseif 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dMaxMat, dTLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then + bigSectionSplitType = "double vertical" + else + + end + -- assegno offset in lunghezza local dOffs = 0 if dOvmTail > BD.OVM_CHAIN_HBEAM then @@ -343,21 +363,21 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt -- se pezzo non troppo alto, taglio singolo da sopra if b3Raw:getDimZ() < dMaxMat - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL then local cutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - sNotesSplit = 'Split;' - bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, cutDepth, sNotesSplit, dOffs) + local sNotesSplit = 'Split;' + local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, cutDepth, sNotesSplit, dOffs) if not bOk then return bOk, sErr, nNewPhase end -- se pezzo non troppo largo, taglio singolo da davanti elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dMaxMat, dTLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then local cutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN - sNotesSplit = 'Split;' - bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs) + local sNotesSplit = 'Split;' + local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs) if not bOk then return bOk, sErr, nNewPhase end -- altrimenti tagli dai due fianchi (dietro e davanti) else local cutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN -- se la sega a catena non può completare lo split esco if cutDepth >= min( dMaxMat, dTLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then - sErr = 'Error : section too big for splitting' + local sErr = 'Error : section too big for splitting' EgtOutLog( sErr) return false, sErr, -1 end @@ -372,7 +392,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt if bFinishingNeeded then BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET) nNewPhase = EgtGetCurrPhase() - nDispId = EgtGetPhaseDisposition( nNewPhase) + local nDispId = EgtGetPhaseDisposition( nNewPhase) if sDownOrSideOrStd == 'down' then EgtRotateRawPart( nRawId, X_AX(), 180) EgtSetInfo( nDispId, 'TYPE', 'MID2') @@ -467,11 +487,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt elseif 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) + dCutExtra = - ( b3Raw:getDimY() - dSawMaxDepth) local dSawRad = dSawDiam / 2 -- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra -- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave - local dKL = dSawRad - dMaxDepth + EgtIf( bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA) + local dKL = dSawRad - dSawMaxDepth + EgtIf( bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA) -- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa local dMinSawingLength = 5 if BD.C_SIMM then @@ -558,14 +578,14 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt end -- verifico che le due lame riescano a lavorare la sezione local dDimZ = b3Raw:getDimZ() - local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ + local dExtra = dMaxVertDepth + dSawMaxDepth2 - dDimZ if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not bBigSectionCut 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 dCutExtra = -dSawMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN local dAccStart = 0 -- limiti da sotto