From b0dea42f313b76531f7eb72c1dec2970bbb0ec9a Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 20 Dec 2023 17:17:28 +0100 Subject: [PATCH 01/16] primi test --- LuaLibs/ProcessSplit.lua | 54 +++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 17 deletions(-) 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 From 5f7f98855213e6501361c8ee3a35b01fc48d4bd4 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 4 Jan 2024 11:44:44 +0100 Subject: [PATCH 02/16] - in split -> bigSection primo implemento sega a catena da sopra e lama da sotto - in split -> bigSection scelta sega a catena in base a lunghezza --- LuaLibs/MachiningLib.lua | 4 +- LuaLibs/ProcessSplit.lua | 84 ++++++++++++++++++++++++++-------------- 2 files changed, 57 insertions(+), 31 deletions(-) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 3918710..c985f0c 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -410,8 +410,8 @@ function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHe end --------------------------------------------------------------------- -function MachiningLib.FindSawing( sType) - return FindMachining( MCH_MY.MORTISING, sType) +function MachiningLib.FindSawing( sType, dDepth) + return FindMachining( MCH_MY.MORTISING, sType, { Depth = dDepth}) end ------------------------------------------------------------------------------------------------------------- diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index 149d432..e0a73da 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -323,35 +323,48 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt if bBigSectionCut then local bFinishingNeeded = false if bSplit then - -- recupero lunghezza massima di lavoro della sega a catena + -- recupero dati utensile della sega a catena più lunga a disposizione local sSawing = ML.FindSawing( 'Sawing') - local dMaxMat = 0 - local dTLen = 0 + local dChainSawMaxMat = 0 + local dChainSawLen = 0 if EgtMdbSetCurrMachining( sSawing or '') then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then - dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat - dTLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dTLen + dChainSawMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dChainSawMaxMat + dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen + end + end + local sSawing2 = ML.FindSawing( 'Sawing', dChainSawMaxMat + 1) + if sSawing2 then + sSawing = sSawing2 + dChainSawMaxMat = 0 + dChainSawLen = 0 + if EgtMdbSetCurrMachining( sSawing or '') then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dChainSawMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dChainSawMaxMat + dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen + end 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 + ---| '"double vertical"' # taglio doppio con motosega davanti e dietro + ---| '"double horizontal"' # taglio doppio con motosega da sopra e lama da sotto ---@type ( SplitType) local bigSectionSplitType - if b3Raw:getDimZ() < dMaxMat - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL then + if b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < dChainSawMaxMat + 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 + elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dChainSawMaxMat, dChainSawLen - 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 + elseif 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dChainSawMaxMat, dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then bigSectionSplitType = "double vertical" - else - + elseif BD.DOWN_HEAD and ( b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < dSawMaxDepth2 + dChainSawMaxMat + 10 * GEO.EPS_SMALL) then + bigSectionSplitType = "double horizontal" end -- assegno offset in lunghezza @@ -361,32 +374,45 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt bFinishingNeeded = true end -- 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 + if bigSectionSplitType == "single horizontal" then + local dCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN local sNotesSplit = 'Split;' - local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, cutDepth, sNotesSplit, dOffs) + local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, dCutDepth, 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 + elseif bigSectionSplitType == "single vertical" then + local dCutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN local sNotesSplit = 'Split;' - local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs) + local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, dCutDepth, 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 - local sErr = 'Error : section too big for splitting' - EgtOutLog( sErr) - return false, sErr, -1 - end + -- se pezzo non troppo largo, tagli dai due fianchi (dietro e davanti) + elseif bigSectionSplitType == "double vertical" then + local dCutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN local sNotesSplit = 'Presplit;' - local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_BACK, cutDepth, sNotesSplit, dOffs) + local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_BACK, dCutDepth, sNotesSplit, dOffs) if not bOk then return bOk, sErr, nNewPhase end sNotesSplit = 'Split;' - bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs) + bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs) if not bOk then return bOk, sErr, nNewPhase end + -- altrimenti taglio con sega a catena da sopra e con lama da sotto + elseif bigSectionSplitType == "double horizontal" then + -- sega a catena da sopra + local dChainSawCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - dSawMaxDepth2 + local sNotesSplit = 'Presplit;' + local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, dChainSawCutDepth, sNotesSplit, dOffs) + if not bOk then return bOk, sErr, nNewPhase end + -- lama da sotto + local dCutExtra = dSawMaxDepth2 - b3Raw:getDimZ() + local dVzLimDwnUp + if BD.TURN then dVzLimDwnUp = -2 end + local sNotes = 'Split;' + bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw) + if not bOk then return false, sErr end + -- se la sega a catena non può completare lo split esco + else + local sErr = 'Error : section too big for splitting' + EgtOutLog( sErr) + return false, sErr, -1 end -- se necessaria finitura, creo nuova fase if bFinishingNeeded then From bc04b680d4a7cc43b84c06960654dd816037b21b Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 4 Jan 2024 17:29:42 +0100 Subject: [PATCH 03/16] - aggiunta GetSawBlockedAxis per scegliere asse bloccato aggregato lama --- LuaLibs/BeamLib.lua | 9 +++++++++ LuaLibs/FacesBySaw.lua | 9 ++++++++- LuaLibs/ProcessLongCut.lua | 3 +++ LuaLibs/ProcessLongDoubleCut.lua | 6 ++++++ LuaLibs/ProcessSawCut.lua | 3 +++ LuaLibs/ProcessSplit.lua | 21 ++++++++++++--------- 6 files changed, 41 insertions(+), 10 deletions(-) diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 5af8fa3..dc21b9a 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -844,6 +844,15 @@ function BeamLib.GetChainSawInitAngs( vtN, vtO, nInd) end end +--------------------------------------------------------------------- +function BeamLib.GetSawBlockedAxis( nInd, bDownHead) + if BD.GetSawBlockedAxis then + return BD.GetSawBlockedAxis( nInd, bDownHead) + else + return '' + end +end + --------------------------------------------------------------------- -- Trova l'Ind (0 based) della faccia meglio orientata come l'asse vtAx. Restituisce anche vtN e ptC della faccia stessa. La faccia di indice (0 based) fctExclude non viene considerata nella ricerca. function BeamLib.FindFaceBestOrientedAsAxis( Proc, vtAx, fctExclude) diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 10f0e26..dd368dc 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -135,6 +135,9 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD -- imposto allungamenti iniziale e finale EgtSetMachiningParam( MCH_MP.STARTADDLEN, -dAccStart) EgtSetMachiningParam( MCH_MP.ENDADDLEN, -dAccEnd) + -- imposto angolo 3° asse rot + local bIsDownHead = EgtEndsWith( sCutting, '_H2') + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bIsDownHead)) -- eventuali note if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end -- eseguo @@ -172,7 +175,7 @@ local function GetNameSolidFaceIncludingLine( b3Solid, ptP1Comp, ptP2Comp) end --------------------------------------------------------------------- -function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert) +function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bMaximizeVerticalDepth) -- se lama con asse parallelo alla faccia, passo alla apposita funzione if ( Par5 == MCH_MILL_FU.PARAL_DOWN or Par5 == MCH_MILL_FU.PARAL_TOP or @@ -432,6 +435,10 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw -- imposto allungamenti iniziale e finale EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAllStart - dAccStart) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAllEnd - dAccEnd) + -- imposto angolo 3° asse rot + bMaximizeVerticalDepth = bMaximizeVerticalDepth or false + local bIsDownHead = EgtEndsWith( sCutting, '_H2') + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( EgtIf( bMaximizeVerticalDepth, 0, 1), bIsDownHead)) -- eventuali note if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end -- eseguo diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index fc7d371..a83b968 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -1178,6 +1178,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp) -- imposto posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, nSCC) + -- imposto angolo 3° asse rot + local bIsDownHead = EgtEndsWith( sCutting, '_H2') + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bIsDownHead)) -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index e903811..5f705bf 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -877,6 +877,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp) -- imposto posizione braccio porta testa per non ingombrare agli estremi EgtSetMachiningParam( MCH_MP.SCC, nSCC) + -- imposto angolo 3° asse rot + local bIsDownHead = EgtEndsWith( sCutting, '_H2') + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bIsDownHead)) -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() @@ -1066,6 +1069,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- determino e imposto l'utilizzo della faccia EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]]) + -- imposto angolo 3° asse rot + local bIsDownHead = EgtEndsWith( sCutting, '_H2') + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bIsDownHead)) -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessSawCut.lua b/LuaLibs/ProcessSawCut.lua index 809ab39..a433fcd 100644 --- a/LuaLibs/ProcessSawCut.lua +++ b/LuaLibs/ProcessSawCut.lua @@ -229,6 +229,9 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- imposto uso della faccia EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) + -- imposto angolo 3° asse rot + local bIsDownHead = EgtEndsWith( sCutting, '_H2') + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bIsDownHead)) -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index e0a73da..5294bdb 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -357,13 +357,17 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt ---@type ( SplitType) local bigSectionSplitType + -- se pezzo non troppo alto, taglio singolo da sopra if b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < dChainSawMaxMat + 10 * GEO.EPS_SMALL then bigSectionSplitType = "single horizontal" + -- se pezzo non troppo largo, taglio singolo da davanti elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dChainSawMaxMat, dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then bigSectionSplitType = "single vertical" + -- se pezzo non troppo largo, tagli dai due fianchi (dietro e davanti) elseif 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dChainSawMaxMat, dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then bigSectionSplitType = "double vertical" - elseif BD.DOWN_HEAD and ( b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < dSawMaxDepth2 + dChainSawMaxMat + 10 * GEO.EPS_SMALL) then + -- altrimenti taglio con sega a catena da sopra e con lama da sotto + elseif BD.DOWN_HEAD and ( b3Raw:getDimZ() + 2 * BD.CUT_EXTRA_MIN < dSawMaxDepth2 + dChainSawMaxMat + 10 * GEO.EPS_SMALL) then bigSectionSplitType = "double horizontal" end @@ -373,19 +377,18 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt dOffs = dOvmTail - BD.OVM_CHAIN_HBEAM bFinishingNeeded = true end - -- se pezzo non troppo alto, taglio singolo da sopra + + -- in base alle scelte precedenti, applico le lavorazioni if bigSectionSplitType == "single horizontal" then local dCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN local sNotesSplit = 'Split;' local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, dCutDepth, sNotesSplit, dOffs) if not bOk then return bOk, sErr, nNewPhase end - -- se pezzo non troppo largo, taglio singolo da davanti elseif bigSectionSplitType == "single vertical" then local dCutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN local sNotesSplit = 'Split;' local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs) if not bOk then return bOk, sErr, nNewPhase end - -- se pezzo non troppo largo, tagli dai due fianchi (dietro e davanti) elseif bigSectionSplitType == "double vertical" then local dCutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN local sNotesSplit = 'Presplit;' @@ -394,21 +397,21 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt sNotesSplit = 'Split;' bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs) if not bOk then return bOk, sErr, nNewPhase end - -- altrimenti taglio con sega a catena da sopra e con lama da sotto elseif bigSectionSplitType == "double horizontal" then -- sega a catena da sopra - local dChainSawCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - dSawMaxDepth2 + local dChainSawCutDepth = b3Raw:getDimZ() + 2 * BD.CUT_EXTRA_MIN - dSawMaxDepth2 local sNotesSplit = 'Presplit;' local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, dChainSawCutDepth, sNotesSplit, dOffs) if not bOk then return bOk, sErr, nNewPhase end -- lama da sotto - local dCutExtra = dSawMaxDepth2 - b3Raw:getDimZ() + local dCutExtra = -dChainSawCutDepth + 2 * BD.CUT_EXTRA_MIN local dVzLimDwnUp if BD.TURN then dVzLimDwnUp = -2 end local sNotes = 'Split;' - bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw) + local bMaximizeVerticalDepth = true + bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dOffs, 0, 0, sNotes, b3Raw, nil, bMaximizeVerticalDepth) if not bOk then return false, sErr end - -- se la sega a catena non può completare lo split esco + -- se è comunque troppo grande per essere separato, esco else local sErr = 'Error : section too big for splitting' EgtOutLog( sErr) From 3acebbd892ff965f0b78e9de11dacddb0edb74a2 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 4 Jan 2024 18:33:07 +0100 Subject: [PATCH 04/16] in split -> bigSection piccola correzione al sormonto tra sega a catena e lama --- LuaLibs/ProcessSplit.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index 5294bdb..b40c9a4 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -367,7 +367,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt elseif 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dChainSawMaxMat, dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then bigSectionSplitType = "double vertical" -- altrimenti taglio con sega a catena da sopra e con lama da sotto - elseif BD.DOWN_HEAD and ( b3Raw:getDimZ() + 2 * BD.CUT_EXTRA_MIN < dSawMaxDepth2 + dChainSawMaxMat + 10 * GEO.EPS_SMALL) then + elseif BD.DOWN_HEAD and ( b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < dSawMaxDepth2 + dChainSawMaxMat + 10 * GEO.EPS_SMALL) then bigSectionSplitType = "double horizontal" end @@ -399,12 +399,12 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt if not bOk then return bOk, sErr, nNewPhase end elseif bigSectionSplitType == "double horizontal" then -- sega a catena da sopra - local dChainSawCutDepth = b3Raw:getDimZ() + 2 * BD.CUT_EXTRA_MIN - dSawMaxDepth2 + local dChainSawCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - dSawMaxDepth2 local sNotesSplit = 'Presplit;' local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, dChainSawCutDepth, sNotesSplit, dOffs) if not bOk then return bOk, sErr, nNewPhase end -- lama da sotto - local dCutExtra = -dChainSawCutDepth + 2 * BD.CUT_EXTRA_MIN + local dCutExtra = -dChainSawCutDepth + BD.CUT_EXTRA_MIN local dVzLimDwnUp if BD.TURN then dVzLimDwnUp = -2 end local sNotes = 'Split;' From 22c74c3252b3130f50fea8f542dc0961fb2a90ae Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 8 Jan 2024 16:55:31 +0100 Subject: [PATCH 05/16] - in headcut e split varie correzioni a tagli aggiuntivi per trave larga; rimangono da implementare per BigSection - test annotations @param, #return in funzione GetFaceHvRefDim del BeamLib --- LuaLibs/BeamLib.lua | 7 ++++++ LuaLibs/ProcessHeadCut.lua | 46 ++++++++++++++++++++++++++++++---- LuaLibs/ProcessSplit.lua | 51 +++++++++++++++++++++++++++++--------- 3 files changed, 87 insertions(+), 17 deletions(-) diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index dc21b9a..b181c7d 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -676,6 +676,13 @@ function BeamLib.GetFaceWithMostAdj( Proc, nPartId, bCompare3Fc, dCosSideAng) end --------------------------------------------------------------------- +--- ritorna il riferimento di tipo OCS della faccia *nFacet* della trimesh *nSurfId* e le dimensioni orizzontale e verticale, eventualmente limitate dal grezzo *b3Raw* +---@param nSurfId integer Id della trimesh +---@param nFacet integer Indice 0-based della faccia della trimesh di cui restituire le informazioni +---@param b3Raw? BBox3d Eventuale box del grezzo per limitare le dimensioni +---@return Frame3d frHv riferimento faccia OCS +---@return number dDimH dimensione orizzontale OCS +---@return number dDmiV dimensione verticale OCS function BeamLib.GetFaceHvRefDim( nSurfId, nFacet, b3Raw) -- recupero centro e normale della faccia local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT) diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index dcfd8ff..d0639a3 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -151,6 +151,31 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead) return true, nil end +--------------------------------------------------------------------- +-- tagli verticali aggiuntivi +local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw ) + local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) + local nVerticalCuts = ceil( dimH / ( 2 * BD.MAX_DIM_DICE)) - 1 + local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1) + -- recupero il diametro dell'utensile + local dSawDiam = 400 + if EgtMdbSetCurrMachining( sCutting) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam + end + end + local bOk, sErr + -- tagli orizzontali + for j = nVerticalCuts, 1, -1 do + local nFaceUse = MCH_MILL_FU.PARAL_FRONT + local dVerticalCutOffset = dVerticalSliceHeight * -j + bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw) + if not bOk then return bOk, sErr end + end + return bOk, sErr +end + --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut) @@ -162,6 +187,8 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut local bOkc, sErrC = MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead) if not bOkc then return bOkc, sErrC end end + -- eventuali informazioni sul tipo di finitura + local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0 -- recupero la lavorazione local sCutting = ML.FindCutting( 'HeadSide') if not sCutting then @@ -212,12 +239,13 @@ 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) + 0.5)), 1) local dOffsL = dOvmHead / nCuts + local _, dimH, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) + local dMinOvmHeadForAddeddCuts = 10.123 -- 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 - if nQ05 == 1 or nQ05 == 0 then + if nQ05 < 2 then local dSawThickCheck = dSawThick if dSawThick2 > 0 and bDoubleHorizCut then dSawThickCheck = min( dSawThick, dSawThick2) @@ -228,6 +256,11 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut else dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX() end + -- se trave larga effettuo tagli verticali aggiuntivi + if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then + local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, 0, b3Raw) + if not bOk then return bOk, sErr end + end -- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard if dMaxElev > dSawThickCheck then local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT) @@ -286,9 +319,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut end -- per travi alte faccio dei tagli orizzontali aggiuntivi - local _, _, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) - local dMinOvmHeadForHorizontalCuts = 10.123 - local bAreHorizontalCutsNeeded = ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dOvmHead > dMinOvmHeadForHorizontalCuts - 10 * GEO.EPS_SMALL) + local bAreHorizontalCutsNeeded = ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) if bAreHorizontalCutsNeeded then local nHorizontalCuts = ceil( dimV / BD.MAX_DIM_DICE) - 1 local dHorizontalSliceHeight = dimV / ( nHorizontalCuts + 1) @@ -328,6 +359,11 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut -- eseguo i tagli necessari for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsL + -- se trave larga effettuo tagli verticali aggiuntivi + if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then + local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw) + if not bOk then return bOk, sErr end + end 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 diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index b40c9a4..f5f69cb 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -241,6 +241,31 @@ local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs) return true, sName, nMchFId end +--------------------------------------------------------------------- +-- tagli verticali aggiuntivi +local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw ) + local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) + local nVerticalCuts = ceil( dimH / ( 2 * BD.MAX_DIM_DICE)) - 1 + local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1) + -- recupero il diametro dell'utensile + local dSawDiam = 400 + if EgtMdbSetCurrMachining( sCutting) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam + end + end + local bOk, sErr + -- tagli orizzontali + for j = nVerticalCuts, 1, -1 do + local nFaceUse = MCH_MILL_FU.PARAL_FRONT + local dVerticalCutOffset = dVerticalSliceHeight * -j + bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw) + if not bOk then return bOk, sErr end + end + return bOk, sErr +end + --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dOvmTail) @@ -307,6 +332,8 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt local dLenEndRaw = dOvmTail local nCuts = 1 local dOffsL = 0 + local _, dimH, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) + local dMinTailScrapForAdditionalCuts = 10.123 if not bSplit then -- cerco grezzo successivo che sia nella fase if nNextRawId and EgtVerifyRawPartPhase( nNextRawId, nPhase) then @@ -348,15 +375,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt end end - ---@alias SplitType - ---| '"single horizontal"' # taglio con motosega da sopra - ---| '"single vertical"' # taglio con motosega da davanti - ---| '"double vertical"' # taglio doppio con motosega davanti e dietro - ---| '"double horizontal"' # taglio doppio con motosega da sopra e lama da sotto - - ---@type ( SplitType) local bigSectionSplitType - -- se pezzo non troppo alto, taglio singolo da sopra if b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < dChainSawMaxMat + 10 * GEO.EPS_SMALL then bigSectionSplitType = "single horizontal" @@ -464,7 +483,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX() end -- se finitura con lama - if nQ05 == 1 or nQ05 == 0 or ( not bSplit and dMaxElev > dSawThickCheck) then + if nQ05 < 2 or ( not bSplit and dMaxElev > dSawThickCheck) then -- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard if bSplit or dMaxElev > dSawThickCheck then local bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT) @@ -539,9 +558,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt end -- per travi alte faccio faccio dei tagli orizzontali aggiuntivi - local _, _, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) - local dMinTailScrapForHorizontalCuts = 10.123 - local bAreHorizontalCutsNeeded = not bSplit and ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dLenEndRaw > dMinTailScrapForHorizontalCuts - 10 * GEO.EPS_SMALL) + local bAreHorizontalCutsNeeded = not bSplit and ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) if bAreHorizontalCutsNeeded then local nHorizontalCuts = ceil ( dimV / BD.MAX_DIM_DICE) - 1 local dHorizontalSliceHeight = dimV / ( nHorizontalCuts + 1) @@ -584,6 +601,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt -- eseguo i tagli necessari for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsL + -- se trave larga effettuo tagli verticali aggiuntivi + if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then + local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw) + if not bOk then return bOk, sErr end + end local sNotes if bSplit then sNotes = EgtIf( i == 1, 'Split;', 'Presplit;') @@ -630,6 +652,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt -- eseguo i tagli da sopra necessari for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsL + -- se trave larga effettuo tagli verticali aggiuntivi + if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then + local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw) + if not bOk then return bOk, sErr end + end local sNotes if bSplit then sNotes = EgtIf( i == 1, 'Split;', 'Presplit;') From 0a830c7f4b5360ae924a9dcdabf5017ff0c5fea5 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 9 Jan 2024 11:43:07 +0100 Subject: [PATCH 06/16] correzioni alle chiamate a GetSawBlockedAxis per Oikos --- LuaLibs/ProcessLongCut.lua | 5 +++-- LuaLibs/ProcessLongDoubleCut.lua | 12 ++++++++---- LuaLibs/ProcessSawCut.lua | 4 ++-- LuaLibs/ProcessSplit.lua | 3 +-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index a83b968..55821f7 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -1179,8 +1179,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- imposto posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- imposto angolo 3° asse rot - local bIsDownHead = EgtEndsWith( sCutting, '_H2') - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bIsDownHead)) + local bDownHead = not bIsTopBladeCurrent + local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX()) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bDownHead, b3Raw, vtN, vtOut)) -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index 5f705bf..d3a36f4 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -878,8 +878,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- imposto posizione braccio porta testa per non ingombrare agli estremi EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- imposto angolo 3° asse rot - local bIsDownHead = EgtEndsWith( sCutting, '_H2') - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bIsDownHead)) + local bDownHead = not bIsTopBladeCurrent + local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX()) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bDownHead, b3Raw, vtN, vtOut)) -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() @@ -1019,10 +1020,12 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster local dLioTang = 0 local sNameF local nMchFId + local bMachDown nM = nM + 1 if bCanUseBlade then sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM) nMchFId = EgtAddMachining( sNameF, sCutting) + bMachDown = false if not nMchFId then local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCutting EgtOutLog( sErr) @@ -1034,6 +1037,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster elseif bCanUseUnderBlade then sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM) nMchFId = EgtAddMachining( sNameF, sCuttingDn) + bMachDown = true if not nMchFId then local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCuttingDn EgtOutLog( sErr) @@ -1070,8 +1074,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- determino e imposto l'utilizzo della faccia EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]]) -- imposto angolo 3° asse rot - local bIsDownHead = EgtEndsWith( sCutting, '_H2') - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bIsDownHead)) + local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX()) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bMachDown, b3Raw, vtN, vtOut)) -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessSawCut.lua b/LuaLibs/ProcessSawCut.lua index a433fcd..8e2729a 100644 --- a/LuaLibs/ProcessSawCut.lua +++ b/LuaLibs/ProcessSawCut.lua @@ -230,8 +230,8 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) -- imposto uso della faccia EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) -- imposto angolo 3° asse rot - local bIsDownHead = EgtEndsWith( sCutting, '_H2') - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bIsDownHead)) + local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX()) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bDownHead, b3Raw, vtN, vtOut)) -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index f5f69cb..67765bf 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -424,8 +424,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt if not bOk then return bOk, sErr, nNewPhase end -- lama da sotto local dCutExtra = -dChainSawCutDepth + BD.CUT_EXTRA_MIN - local dVzLimDwnUp - if BD.TURN then dVzLimDwnUp = -2 end + local dVzLimDwnUp = -2 local sNotes = 'Split;' local bMaximizeVerticalDepth = true bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dOffs, 0, 0, sNotes, b3Raw, nil, bMaximizeVerticalDepth) From 0acffe8d524628d95525fd89ead24679c040ca7d Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 11 Jan 2024 12:25:28 +0100 Subject: [PATCH 07/16] - in HeadCut gestiti i tagli aggiuntivi verticali in tutti i casi - in Cut gestito il passaggio di superficie limitante alla GetDice - in Split manca la gestione dei tagli aggiuntivi verticali in caso di BigSection --- LuaLibs/ProcessCut.lua | 13 +++++---- LuaLibs/ProcessHeadCut.lua | 54 ++++++++++++++++++++++++++++++-------- LuaLibs/ProcessSplit.lua | 5 ++-- 3 files changed, 53 insertions(+), 19 deletions(-) diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index f6fc9a1..4ae224f 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -251,7 +251,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione con testa da sopra -local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes) +local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf) -- ingombro del grezzo b3Raw = b3Raw or EgtGetRawPartBBox( nRawId) -- ingombro del pezzo @@ -361,7 +361,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b EgtOutLog( sErr) return false, sErr end - -- verifico se necessari tagli supplementari + -- verifico se necessari tagli supplementari o se presente superficie limitante EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3) local vCuts = {} if not Proc.AdvTail and ( dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then @@ -372,6 +372,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b ptExtra = Point3d( b3Solid:getMin():getX() + 5*GEO.EPS_SMALL, ptMiddle:getY(), ptMiddle:getZ()) vtExtra = X_AX() bAutoCalcSurf = false + -- superficie limitante + elseif nLimitingSurf then + ptExtra, vtExtra = EgtSurfTmFacetCenter( nLimitingSurf, 0, GDB_ID.ROOT) end -- verifico elevazione max del materiale tagliato local dMaxElev @@ -791,7 +794,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione -function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng) +function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng, nLimitingSurf) -- sovramateriale di coda dOvmTail = dOvmTail or BD.OVM_MID -- ingombro del grezzo @@ -843,12 +846,12 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, local bNoDicing = false -- se taglio con testa da sopra if not bDownHead and not bDownTurn then - local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes) + local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf) bNoDicing = bNoDicing2 if not bOk then return false, sErr end -- altrimenti taglio con testa da sotto else - local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut) + local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, nLimitingSurf) if not bOk then return false, sErr end end -- Aggiornamento ingombro (se vero taglio o richiesto) diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index d0639a3..97bc8ab 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -19,6 +19,7 @@ local BL = require( 'BeamLib') local Fbs = require( 'FacesBySaw') local Cut = require( 'ProcessCut') local Pocket = require( 'FaceByPocket') +local Topology = require( 'FeatureTopology') EgtOutLog( ' ProcessHeadCut started', 1) @@ -155,7 +156,7 @@ end -- tagli verticali aggiuntivi local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw ) local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) - local nVerticalCuts = ceil( dimH / ( 2 * BD.MAX_DIM_DICE)) - 1 + local nVerticalCuts = ceil( dimH / ( BD.MAX_DIM_DICE)) - 1 local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1) -- recupero il diametro dell'utensile local dSawDiam = 400 @@ -236,7 +237,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut if not bNeedHCut and AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL then return true end - -- determino se più tagli con offset + -- determino se lo spessore del materiale da rimuovere è eccessivo e quindi vanno fatti più tagli con offset local nCuts = max( ceil( dOvmHead / (( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP) + 0.5)), 1) local dOffsL = dOvmHead / nCuts local _, dimH, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) @@ -256,14 +257,41 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut else dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX() end - -- se trave larga effettuo tagli verticali aggiuntivi - if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then - local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, 0, b3Raw) - if not bOk then return bOk, sErr end - end -- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard if dMaxElev > dSawThickCheck then - local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT) + local bOk, sErr + -- se trave larga effettuo tagli verticali aggiuntivi + if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then + -- ad ogni offset di taglio dovrò fare prima i tagli verticali e poi i cubetti + for i = nCuts, 1, -1 do + local nAddGrpId = BL.GetAddGroup( Proc.PartId) + -- faccia di taglio all'offset corrente + local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + local AddProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, PartId = Proc.PartId} + Topology.Classify( AddProc, b3Raw) + local dCutOffset = ( i - 1) * dOffsL + local vtMove = Vector3d( dCutOffset, 0, 0) + EgtMove( AddId, vtMove, GDB_RT.GLOB) + -- eventuale faccia di taglio all'offset precedente, per limitare il dicing e evitare di tagliare i cubetti nel vuoto + local nLimitingSurf + if nCuts > 1 then + nLimitingSurf = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + local dLastCutOffset = i * dOffsL + local vtMoveLimitingSurf = Vector3d( dLastCutOffset - 10 * GEO.EPS_SMALL, 0, 0) + EgtMove( nLimitingSurf, vtMoveLimitingSurf, GDB_RT.GLOB) + local vtNLimitingSurf = EgtSurfTmFacetNormVersor( nLimitingSurf, 0) + if AreSameVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end + end + -- tagli verticali + bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw) + if not bOk then return bOk, sErr end + -- tagli a cubetti con superficie limitante + bOk, sErr = Cut.Make( AddProc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT, nil, nLimitingSurf) + end + -- tagli aggiuntivi non necessari + else + bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT) + end return bOk, sErr end -- se finitura con truciolatore @@ -387,17 +415,21 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut 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 + local dVzLimDwnUp = -2 -- 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) + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw, nil, 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 + -- se trave larga effettuo tagli verticali aggiuntivi + if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then + local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw) + if not bOk then return bOk, sErr end + end 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 diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index 67765bf..1829661 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -639,13 +639,12 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN local dAccStart = 0 -- limiti da sotto - local dVzLimDwnUp - if BD.TURN then dVzLimDwnUp = -2 end + local dVzLimDwnUp = -2 -- 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) + 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, nil, true) if not bOk then return false, sErr end end -- eseguo i tagli da sopra necessari From eb937690554d8953e7964fb96ffd900bbb5e6e47 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 11 Jan 2024 16:22:39 +0100 Subject: [PATCH 08/16] - in Split gestiti i tagli aggiuntivi verticali in tutti i casi --- LuaLibs/ProcessHeadCut.lua | 2 +- LuaLibs/ProcessSplit.lua | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index 97bc8ab..a849c1a 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -285,7 +285,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut -- tagli verticali bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw) if not bOk then return bOk, sErr end - -- tagli a cubetti con superficie limitante + -- tagli a cubetti con eventuale superficie limitante bOk, sErr = Cut.Make( AddProc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT, nil, nLimitingSurf) end -- tagli aggiuntivi non necessari diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index 1829661..762ac15 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -24,6 +24,7 @@ local BL = require( 'BeamLib') local Fbs = require( 'FacesBySaw') local Cut = require( 'ProcessCut') local Pocket = require( 'FaceByPocket') +local Topology = require( 'FeatureTopology') EgtOutLog( ' ProcessSplit started', 1) @@ -245,7 +246,7 @@ end -- tagli verticali aggiuntivi local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw ) local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) - local nVerticalCuts = ceil( dimH / ( 2 * BD.MAX_DIM_DICE)) - 1 + local nVerticalCuts = ceil( dimH / ( BD.MAX_DIM_DICE)) - 1 local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1) -- recupero il diametro dell'utensile local dSawDiam = 400 @@ -485,7 +486,38 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt if nQ05 < 2 or ( not bSplit and dMaxElev > dSawThickCheck) then -- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard if bSplit or dMaxElev > dSawThickCheck then - local bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT) + local bOk, sErr + if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then + -- ad ogni offset di taglio dovrò fare prima i tagli verticali e poi i cubetti + for i = nCuts, 1, -1 do + local nAddGrpId = BL.GetAddGroup( Proc.PartId) + -- faccia di taglio all'offset corrente + local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + local AddProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, PartId = Proc.PartId} + Topology.Classify( AddProc, b3Raw) + local dCutOffset = ( i - 1) * dOffsL + local vtMoveSurf = Vector3d( -dCutOffset, 0, 0) + EgtMove( AddId, vtMoveSurf, GDB_RT.GLOB) + -- eventuale faccia di taglio all'offset precedente, per limitare il dicing e evitare di tagliare i cubetti nel vuoto + local nLimitingSurf + if nCuts > 1 then + nLimitingSurf = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + local dLastCutOffset = i * dOffsL + local vtMoveLimitingSurf = Vector3d( -dLastCutOffset + 10 * GEO.EPS_SMALL, 0, 0) + EgtMove( nLimitingSurf, vtMoveLimitingSurf, GDB_RT.GLOB) + local vtNLimitingSurf = EgtSurfTmFacetNormVersor( nLimitingSurf, 0) + if AreOppositeVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end + end + -- tagli verticali + bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw) + if not bOk then return bOk, sErr end + -- tagli a cubetti con eventuale superficie limitante + bOk, sErr = Cut.Make( AddProc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nLimitingSurf) + end + -- tagli aggiuntivi non necessari + else + bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT) + end if sNotesFinal then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal) end From ffb7580a65a6c408e533bcc8b43970298c21db0e Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 16 Jan 2024 15:51:59 +0100 Subject: [PATCH 09/16] - implementata funzione GetBlockedAxis, in BeamLib, che sostituisce le altre specifiche per sega a catena e lama; modificate le relative chiamate --- LuaLibs/BeamLib.lua | 52 +++++++++++++++++++++----------- LuaLibs/FacesBySaw.lua | 6 ++-- LuaLibs/ProcessHeadCut.lua | 3 +- LuaLibs/ProcessLapJoint.lua | 12 ++++---- LuaLibs/ProcessLongCut.lua | 7 ++--- LuaLibs/ProcessLongDoubleCut.lua | 4 +-- LuaLibs/ProcessMortise.lua | 4 +-- LuaLibs/ProcessSawCut.lua | 2 +- LuaLibs/ProcessSplit.lua | 7 +++-- 9 files changed, 57 insertions(+), 40 deletions(-) diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 0a7ee73..55ea999 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -822,19 +822,6 @@ function BeamLib.GetDistanceToNextPart( nRawId, nPhase) return dDistToNextPiece end ---------------------------------------------------------------------- -function BeamLib.GetChainSawBlockedAxis( nInd) - if BD.GetChainSawBlockedAxis then - return BD.GetChainSawBlockedAxis( nInd) - else - if nInd == 1 then - return EgtIf( BD.C_SIMM, 'A=90', 'A=90') - else - return EgtIf( BD.C_SIMM, 'A=0', 'A=0') - end - end -end - --------------------------------------------------------------------- function BeamLib.GetChainSawInitAngs( vtN, vtO, nInd) if BD.GetChainSawInitAngs then @@ -853,12 +840,41 @@ function BeamLib.GetChainSawInitAngs( vtN, vtO, nInd) end --------------------------------------------------------------------- -function BeamLib.GetSawBlockedAxis( nInd, bDownHead, b3Raw, vtTool, vtOut) - if BD.GetSawBlockedAxis then - return BD.GetSawBlockedAxis( nInd, bDownHead, b3Raw, vtTool, vtOut) - else - return '' +--- +---@param sMachining string nome della lavorazione di cui bloccare l'asse +---@param sBlockedAxis string rappresenta lo stato desiderato dell'asse bloccato, parallelo o perpendicolare all'asse rotante da cui dipende (*parallel* o *perpendicular*) +---@param b3Raw? BBox3d +---@param vtTool? Vector3d +---@param vtOut? Vector3d +---@return string # testo contenente il valore dell'asse rotante bloccato da scrivere nel parametro *MCH_MP.BLOCKEDAXIS* della lavorazione (es: 'A2=90') +function BeamLib.GetBlockedAxis( sMachining, sBlockedAxis, b3Raw, vtTool, vtOut) + -- informazioni sull'utensile della lavorazione + local nToolType, sHead + if EgtMdbSetCurrMachining( sMachining) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + nToolType = EgtTdbGetCurrToolParam( MCH_TP.TYPE) + sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) + end end + -- se presente funzione specifica nella macchina, la richiamo + if BD.GetBlockedAxis then + return BD.GetBlockedAxis( sHead, nToolType, sBlockedAxis, b3Raw, vtTool, vtOut) + -- sezione mantenuta per retrocompatibilità con GetChainSawBlockedAxis + elseif nToolType == MCH_TY.MORTISE_STD then + local nInd = EgtIf( sBlockedAxis == 'parallel', 0, 1) + if BD.GetChainSawBlockedAxis then + return BD.GetChainSawBlockedAxis( nInd) + else + if nInd == 1 then + return EgtIf( BD.C_SIMM, 'A=90', 'A=90') + else + return EgtIf( BD.C_SIMM, 'A=0', 'A=0') + end + end + end + + return '' end --------------------------------------------------------------------- diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 1e68048..1a33a0d 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -149,7 +149,7 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD vtTool = -Z_AX() end local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX()) - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bDownHead, b3Raw, vtTool, vtOut)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtTool, vtOut)) -- eventuali note if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end -- eseguo @@ -473,8 +473,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAllStart - dAccStart) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAllEnd - dAccEnd) -- imposto angolo 3° asse rot - local nInd = EgtIf( bMaximizeVerticalDepth, 0, 1) - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( nInd, bDownHead, b3Raw, vtN, vtOrthO)) + local sBlockedAxis = EgtIf( bMaximizeVerticalDepth, 'parallel', 'perpendicular') + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, sBlockedAxis, b3Raw, vtN, vtOrthO)) -- eventuali note if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end -- eseguo diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index a849c1a..606ebf5 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -415,7 +415,8 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN local dAccStart = 0 - local dVzLimDwnUp = -2 + 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 diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index c5563b7..dd46f43 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -2907,7 +2907,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, 0, - dSawWidth / 2)) end -- imposto angolo 3° asse rot e eventuale angolo suggerito per inizio - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'perpendicular')) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, rfFac:getVersZ(), 1)) -- imposto offset radiale local dOffs = ( i - 1) * dStep @@ -2930,7 +2930,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, return false, sErr end -- impostazione alternativa angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'parallel')) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, rfFac:getVersZ(), 2)) if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() @@ -2975,7 +2975,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, -- imposto uso del lato faccia EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) -- imposto angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'perpendicular')) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtNL, vtOrtho, 1)) -- imposto offset radiale local dOffs = ( i - 1) * dStep @@ -3004,7 +3004,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, return false, sErr end -- impostazione alternativa angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'parallel')) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtNL, vtOrtho, 2)) if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() @@ -4435,7 +4435,7 @@ local function MakeTunnelByChainSaw( Proc, sSawing, nLundIdFace, vtOrtho, dWorkD EgtSetMachiningGeometry( {{ Proc.Id, nLundIdFace}}) local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nLundIdFace, GDB_ID.ROOT) -- imposto angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'perpendicular')) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1)) -- imposto offset radiale local dOffs = ( i - 1) * dStep @@ -4451,7 +4451,7 @@ local function MakeTunnelByChainSaw( Proc, sSawing, nLundIdFace, vtOrtho, dWorkD EgtSetOperationMode( nMchFId, false) return false, sErr end - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'parallel')) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2)) if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index 55821f7..4fcb3a5 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -534,7 +534,7 @@ local function MakeSideFaceByChainSaw( nSurfId, dDepth, dOffs, dSal, dEal, bShor local nFaceUse = MCH_MILL_FU.PARAL_DOWN EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) -- imposto angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'perpendicular')) local vtN = EgtSurfTmFacetNormVersor( nSurfId, 0, GDB_ID.ROOT) local vtOrtho = BL.GetVersRef( nFaceUse) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1)) @@ -572,7 +572,7 @@ local function MakeSideFaceByChainSaw( nSurfId, dDepth, dOffs, dSal, dEal, bShor return false, sErr end -- impostazione alternativa angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'parallel')) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2)) if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() @@ -1179,9 +1179,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- imposto posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- imposto angolo 3° asse rot - local bDownHead = not bIsTopBladeCurrent local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX()) - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bDownHead, b3Raw, vtN, vtOut)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( EgtIf( bIsTopBladeCurrent, sCutting, sCuttingDn), 'perpendicular', b3Raw, vtN, vtOut)) -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index d3a36f4..f21159b 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -880,7 +880,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- imposto angolo 3° asse rot local bDownHead = not bIsTopBladeCurrent local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX()) - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bDownHead, b3Raw, vtN, vtOut)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtN, vtOut)) -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() @@ -1075,7 +1075,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]]) -- imposto angolo 3° asse rot local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX()) - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bMachDown, b3Raw, vtN, vtOut)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtN, vtOut)) -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessMortise.lua b/LuaLibs/ProcessMortise.lua index a950d23..d343107 100644 --- a/LuaLibs/ProcessMortise.lua +++ b/LuaLibs/ProcessMortise.lua @@ -126,7 +126,7 @@ end EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- imposto angolo 3° asse rot local vtOrtho = BL.GetVersRef( nFaceUse) - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sMortising, 'perpendicular')) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1)) -- calcolo la lavorazione if not ML.ApplyMachining( true, false) then @@ -136,7 +136,7 @@ end return false, sErr end -- impostazione alternativa angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sMortising, 'parallel')) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2)) if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessSawCut.lua b/LuaLibs/ProcessSawCut.lua index 8e2729a..3ee291e 100644 --- a/LuaLibs/ProcessSawCut.lua +++ b/LuaLibs/ProcessSawCut.lua @@ -231,7 +231,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) -- imposto angolo 3° asse rot local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX()) - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetSawBlockedAxis( 1, bDownHead, b3Raw, vtN, vtOut)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtN, vtOut)) -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index 762ac15..df09ffe 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -195,7 +195,7 @@ local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs) -- imposto uso del lato faccia EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) -- imposto angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'perpendicular')) local _, vtN = EgtSurfTmFacetCenter( nSurfId, 0, GDB_ID.ROOT) local vtOrtho = BL.GetVersRef( nFaceUse) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1)) @@ -225,7 +225,7 @@ local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs) return false, sErr end -- impostazione alternativa angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'parallel')) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2)) if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() @@ -425,7 +425,8 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt if not bOk then return bOk, sErr, nNewPhase end -- lama da sotto local dCutExtra = -dChainSawCutDepth + BD.CUT_EXTRA_MIN - local dVzLimDwnUp = -2 + local dVzLimDwnUp + if BD.TURN then dVzLimDwnUp = -2 end local sNotes = 'Split;' local bMaximizeVerticalDepth = true bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dOffs, 0, 0, sNotes, b3Raw, nil, bMaximizeVerticalDepth) From b8fb6816a67a34d8ae7e39bf85052e1b8f026e3a Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 16 Jan 2024 18:21:06 +0100 Subject: [PATCH 10/16] correzione minore --- LuaLibs/ProcessCut.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 4ae224f..5e2efe0 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -851,7 +851,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, if not bOk then return false, sErr end -- altrimenti taglio con testa da sotto else - local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, nLimitingSurf) + local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead) if not bOk then return false, sErr end end -- Aggiornamento ingombro (se vero taglio o richiesto) From e5bab7f1abbffd78895ac7a776e43f829b5e76af Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 18 Jan 2024 12:37:40 +0100 Subject: [PATCH 11/16] - piccola correzione a split --- LuaLibs/ProcessSplit.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index df09ffe..f64018a 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -672,7 +672,8 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN local dAccStart = 0 -- limiti da sotto - local dVzLimDwnUp = -2 + 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 From dbf0d3cf01e785cc7f58e835ce83c888b607c16c Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 18 Jan 2024 16:17:16 +0100 Subject: [PATCH 12/16] update commenti --- LuaLibs/BeamLib.lua | 3 ++- LuaLibs/FacesBySaw.lua | 2 ++ LuaLibs/MachiningLib.lua | 1 + LuaLibs/ProcessCut.lua | 1 + LuaLibs/ProcessHeadCut.lua | 1 + LuaLibs/ProcessLapJoint.lua | 1 + LuaLibs/ProcessLongCut.lua | 1 + LuaLibs/ProcessLongDoubleCut.lua | 4 +--- LuaLibs/ProcessMortise.lua | 1 + LuaLibs/ProcessSawCut.lua | 1 + LuaLibs/ProcessSplit.lua | 5 ++++- 11 files changed, 16 insertions(+), 5 deletions(-) diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 55ea999..6133984 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -28,7 +28,8 @@ -- 2023/09/26 Spostata qui funzione IsFeatureCuttingEntireSection da BeamExec. -- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation. Se l'elevazione è già calcolata la recupera da Proc, altrimenti la calcola al momento. -- 2023/12/15 Correzione a GetFaceWithMostAdj per calcoli con facce che fanno ombra. --- 2023/08/01 Correzione a Is3EdgesApprox per casi in cui nAddGroup non esista ancora. +-- 2024/01/08 Correzione a Is3EdgesApprox per casi in cui nAddGroup non esista ancora. +-- 2024/01/18 Aggiunta funzione GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. -- Tabella per definizione modulo local BeamLib = {} diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 1a33a0d..6fcca87 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -24,6 +24,8 @@ -- 2023/12/06 In CalcLeadInOutPerpGeom gestito caso in cui la geometria della feature esce dal grezzo. -- 2023/12/30 Modifiche in CalcLeadInOutPerpGeom e CalcLeadInOutTangGeom con uso di EgtCAvToolPosBox. -- 2024/01/07 Modifiche per OikosX (BD.TURN == 2). +-- 2024/01/18 Gestita lama con aggregato con asse bloccato per massimizzare capacità di taglio verticale, se da sotto. +-- Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. -- Tabella per definizione modulo local FacesBySaw = {} diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index c985f0c..43eec69 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -8,6 +8,7 @@ -- 2023/01/31 Per FindPocketing implementata la possibilità di escludere le teste H2 o H3 dalla ricerca utensile. -- 2023/07/28 Aggiunta gestione del tipo di foratura "Drill_AT". -- 2023/11/06 Migliorie e correzioni alle forature con AngularTransmission ("_AT"). +-- 2024/01/18 In FindSawing aggiunto il parametro opzionale dDepth. -- Tabella per definizione modulo local MachiningLib = {} diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 5e2efe0..f141501 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -24,6 +24,7 @@ -- 2023/09/12 In MakeFromTop abbassato a 590 mm il limite per convertire in LongCut. -- 2023/10/27 In MakeFromTop corretto massimo materiale in caso di lavorazione da sotto. -- 2023/12/07 Correzione in Classify in scelta ribaltamento trave quando si è in condizioni downUp. +-- 2024/01/18 Gestita superficie limitante opzionale da passare a diceCut. -- Tabella per definizione modulo local ProcessCut = {} diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index 606ebf5..a18538d 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -9,6 +9,7 @@ -- 2023/04/20 Per travi alte aggiunti tagli orizzontali per ridurre le dimensioni degli scarti -- 2023/08/02 Corretto calcolo allungamenti/accorciamenti pezzi alti per contemplare anche taglio singolo -- 2023/10/17 Corretto calcolo allungamenti/accorciamenti per evitare lunghezze del percorso negative +-- 2024/01/18 Gestiti tagli verticali aggiuntivi per travi larghe. -- Tabella per definizione modulo local ProcessHeadCut = {} diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index dd46f43..4978f5f 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -87,6 +87,7 @@ -- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation. -- 2023/12/01 In MakeMoreFaces, nelle OpenPocket, ammesso utensile con diametro fino a 3 volte la dimensione della tasca (era 2). -- 2023/12/06 In VerifySideMillAsSaw, se SIDEDEPTH non definita, viene calcolata. +-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. -- Tabella per definizione modulo local ProcessLapJoint = {} diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index 4fcb3a5..7a8a305 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -32,6 +32,7 @@ -- 2023/09/26 Modificata chiamata a GetFaceWithMostAdj. -- 2023/10/24 Migliorata spezzatura taglio passante con due spezzoni -- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation. +-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. -- Tabella per definizione modulo local ProcessLongCut = {} diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index f21159b..bfda135 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -22,6 +22,7 @@ -- 2023/10/25 Se effettivamente un taglio longitudinale e lama non taglia completamente, limito la lavorazione. Altrimenti esco. -- 2023/11/24 Aggiunta Q05 per utilizzo lama anche in feature cieche conme per LongCut. -- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation. +-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. -- Tabella per definizione modulo local ProcessLong2Cut = {} @@ -1020,12 +1021,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster local dLioTang = 0 local sNameF local nMchFId - local bMachDown nM = nM + 1 if bCanUseBlade then sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM) nMchFId = EgtAddMachining( sNameF, sCutting) - bMachDown = false if not nMchFId then local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCutting EgtOutLog( sErr) @@ -1037,7 +1036,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster elseif bCanUseUnderBlade then sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM) nMchFId = EgtAddMachining( sNameF, sCuttingDn) - bMachDown = true if not nMchFId then local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCuttingDn EgtOutLog( sErr) diff --git a/LuaLibs/ProcessMortise.lua b/LuaLibs/ProcessMortise.lua index d343107..fcb2478 100644 --- a/LuaLibs/ProcessMortise.lua +++ b/LuaLibs/ProcessMortise.lua @@ -13,6 +13,7 @@ -- 2023/06/27 Esclusa la ricerca lati aperti per le mortase passanti, per le quali il contorno finisce sulla faccia e il riconoscimento sbaglia. -- 2023/07/21 Correzioni per mortise passanti con curva Aux che guarda in basso. -- 2023/08/10 Modificata scelta SCC per tasche in Y+/- in coda o quasi. +-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. -- Tabella per definizione modulo local ProcessMortise = {} diff --git a/LuaLibs/ProcessSawCut.lua b/LuaLibs/ProcessSawCut.lua index 3ee291e..fcf0f32 100644 --- a/LuaLibs/ProcessSawCut.lua +++ b/LuaLibs/ProcessSawCut.lua @@ -2,6 +2,7 @@ -- Gestione calcolo taglio di lama per Travi -- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe). -- 2022/12/19 Aggiunta gestione testa da sotto. +-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. -- Tabella per definizione modulo local ProcessSawCut = {} diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index f64018a..edad1e6 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -13,7 +13,10 @@ -- 2023/05/09 Aggiunta richiesta risalita preliminare a Zmax per tagli da sopra su macchine PF e ONE. -- 2023/06/13 Corrette note Precut e Cut per tagli aggiuntivi orizzontali. -- 2023/08/02 Corretto calcolo allungamenti/accorciamenti pezzi alti per contemplare anche taglio singolo. --- 2023/10/17 Corretto calcolo allungamenti/accorciamenti per evitare lunghezze del percorso negative +-- 2023/10/17 Corretto calcolo allungamenti/accorciamenti per evitare lunghezze del percorso negative. +-- 2024/01/18 Gestita lama con aggregato con asse bloccato per massimizzare capacità di taglio verticale, se da sotto +-- Implementato split per pezzi molto alti con mix sega a catena + lama +-- Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. -- Tabella per definizione modulo local ProcessSplit = {} From 8d80f389d3eacc180a8a3dffa104698b5bb396c2 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 22 Jan 2024 16:34:39 +0100 Subject: [PATCH 13/16] - In MachiningLib -> FindSawing aggiunto parametro opzionale bConsiderCSimmEncumberance per considerare l'ingombro dell'asse C nel massimo materiale (default false). - In MachiningLib -> GetMachinings vengono ora raccolti i parametri utensile necessari per i VerifyTool, scritti direttamente nella tabella Machining.Tool. - Le lavorazioni possono essere ora ordinate per dimensioni utensile (Longest, Shortest, Biggest, Smallest) se passato l'apposito parametro SortingCriterion in FindMachining. Al momento implementato solo per FindSawing. - In HeadCut e Split, nei tagli verticali aggiuntivi, si usa ora BD.MAX_LEN_DICE come dimensione (era BD.MAX_DIM_DICE). - In LapJoint e LongCut implementata gestione seghe a catena multiple. --- LuaLibs/MachiningLib.lua | 182 +++++++++++++++++++++++++++--------- LuaLibs/ProcessHeadCut.lua | 3 +- LuaLibs/ProcessLapJoint.lua | 22 ++++- LuaLibs/ProcessLongCut.lua | 7 +- LuaLibs/ProcessSplit.lua | 31 ++---- 5 files changed, 171 insertions(+), 74 deletions(-) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 43eec69..55f2bb6 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -9,6 +9,9 @@ -- 2023/07/28 Aggiunta gestione del tipo di foratura "Drill_AT". -- 2023/11/06 Migliorie e correzioni alle forature con AngularTransmission ("_AT"). -- 2024/01/18 In FindSawing aggiunto il parametro opzionale dDepth. +-- 2024/01/19 In FindSawing aggiunto parametro opzionale bConsiderCSimmEncumberance per considerare l'ingombro dell'asse C nel massimo materiale (default false). +-- 2024/01/22 Nella GetMachinings vengono ora raccolti i parametri utensile necessari per i VerifyTool, scritti direttamente nella tabella Machining.Tool. +-- Le lavorazioni possono essere ora ordinate per dimensioni utensile (Longest, Shortest, Biggest, Smallest) se passato l'apposito parametro SortingCriterion in FindMachining. Al momento implementato solo per FindSawing. -- Tabella per definizione modulo local MachiningLib = {} @@ -114,48 +117,47 @@ local function SetCurrMachiningAndTool( sMachName) local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) local nHead = tonumber( sHead:sub( 2, #sHead)) local bH2 = ( nHead >= 21 and nHead <= 29) - local bH3 = ( nHead >= 31 and nHead <= 39) + local bH3 = ( nHead >= 31 and nHead <= 39) local bFixed = ( vFixedHeads[nHead]) return bActive, sTool, bH2, bFixed, bH3 end --------------------------------------------------------------------- -function VerifyDrill( dDiam, dDepth, bH2) - local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) - local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dDiamTh = EgtTdbGetCurrToolThDiam() +function VerifyDrill( Machining, dDiam, dDepth, bH2) + local dTDiam = Machining.Tool.Diameter + local dTMaxMat = Machining.Tool.MaxMat + local dMaxToolLength = Machining.Tool.TotalLength + local dDiamTh = Machining.Tool.ToolHolderDiameter + local dLen = Machining.Tool.Length local dLenTh = 72 if EgtTdbGetCurrToolThLength then dLenTh = EgtTdbGetCurrToolThLength() end - local dFreeLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) - dLenTh - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE) + local dFreeLen = dLen - dLenTh - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE) if dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL and ( not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL) then - return true, { TMaxMat = dTMaxMat, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2} + return true, { TMaxMat = dTMaxMat, MaxToolLength = dMaxToolLength, ToolDiam = dTDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2} end end --------------------------------------------------------------------- -function VerifyDrillPocket( dDiam, dDepth, bH2) - local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() - local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dDiamTh = EgtTdbGetCurrToolThDiam() +function VerifyDrillPocket( Machining, dDiam, dDepth, bH2) + local dTDiam = Machining.Tool.Diameter + local dTMaxDepth = Machining.Tool.MaxMat + local dMaxToolLength = Machining.Tool.TotalLength + local dDiamTh = Machining.Tool.ToolHolderDiameter local dFreeLen = dTMaxDepth if dTDiam < dDiam - 10 * GEO.EPS_SMALL and ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) then - return true, { TMaxDepth = dTMaxDepth, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2} + return true, { TMaxDepth = dTMaxDepth, MaxToolLength = dMaxToolLength, ToolDiam = dTDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2} end end --------------------------------------------------------------------- -function VerifyMill( dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2) - local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) - local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() - local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) +function VerifyMill( Machining, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2) + local sTuuid = Machining.Tool.UUID + local dTMaxDepth = Machining.Tool.MaxMat + local dTDiam = Machining.Tool.Diameter + local dTTotLen = Machining.Tool.TotalLength if ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and ( not sTuuidMstr or sTuuidMstr == sTuuid) and ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and @@ -165,10 +167,10 @@ function VerifyMill( dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2) end --------------------------------------------------------------------- -function VerifyPocket( dMaxDiam, dDepth, dMaxTotLen, bH2) - local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() - local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) +function VerifyPocket( Machining, dMaxDiam, dDepth, dMaxTotLen, bH2) + local dTDiam = Machining.Tool.Diameter + local dTMaxDepth = Machining.Tool.MaxMat + local dTTotLen = Machining.Tool.TotalLength if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and ( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then @@ -177,39 +179,127 @@ function VerifyPocket( dMaxDiam, dDepth, dMaxTotLen, bH2) end --------------------------------------------------------------------- -function VerifyTool( MachiningType, sType, Params, bH2) +function VerifyChainSaw( Machining, dDepth, CSimmEncumberance, bH2) + local dTMaxMat = Machining.Tool.MaxMat + local dTTotLen = Machining.Tool.TotalLength + -- riduco il massimo materiale dell'ingombro asse C. Se non richiesto, arriverà un valore di CSimmEncumberance nullo + dTMaxMat = min( dTMaxMat, dTTotLen - CSimmEncumberance) + if not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL then + return true, { H2 = bH2} + end +end + +--------------------------------------------------------------------- +function VerifyTool( Machining, MachiningType, Params, bH2) if MachiningType == MCH_MY.DRILLING then - if EgtStartsWith( sType, 'Drill') or EgtStartsWith( sType, 'AngleDrill') then - return VerifyDrill( Params.Diam, Params.Depth, bH2) - elseif EgtStartsWith( sType, 'Pocket') then - return VerifyDrillPocket( Params.Diam, Params.Depth, bH2) + if Machining.SubType == 'Drill' or Machining.SubType == 'AngleDrill' then + return VerifyDrill( Machining, Params.Diam, Params.Depth, bH2) + elseif Machining.SubType == 'DrillPocket' then + return VerifyDrillPocket( Machining, Params.Diam, Params.Depth, bH2) end elseif MachiningType == MCH_MY.SAWING then return true, { H2 = bH2} elseif MachiningType == MCH_MY.MILLING then - return VerifyMill( Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2) + return VerifyMill( Machining, Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2) elseif MachiningType == MCH_MY.POCKETING then - return VerifyPocket( Params.MaxDiam, Params.Depth, Params.MaxTotLen, bH2) + return VerifyPocket( Machining, Params.MaxDiam, Params.Depth, Params.MaxTotLen, bH2) elseif MachiningType == MCH_MY.MORTISING then - return true, { H2 = bH2} + return VerifyChainSaw( Machining, Params.Depth, Params.CSimmEncumberance, bH2) else return false end end --------------------------------------------------------------------- -function GetMachinings( MachiningType) +function GetMachinings( MachiningType, sType) + local Machinings if MachiningType == MCH_MY.DRILLING then - return Drillings + Machinings = Drillings elseif MachiningType == MCH_MY.SAWING then - return Cuttings + Machinings = Cuttings elseif MachiningType == MCH_MY.MILLING then - return Millings + Machinings = Millings elseif MachiningType == MCH_MY.POCKETING then - return Pocketings + Machinings = Pocketings elseif MachiningType == MCH_MY.MORTISING then - return Sawings + Machinings = Sawings end + -- scrivo i parametri utensile nella lavorazione + for i = 1, #Machinings do + local Machining = Machinings[i] + if EgtMdbSetCurrMachining( Machining.Name) then + Machining.Tool = {} + Machining.Tool.UUID = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + Machining.Tool.Name = EgtTdbGetToolFromUUID( Machining.Tool.UUID) + if Machining.Tool.Name then + if EgtTdbSetCurrTool( Machining.Tool.Name) then + if ( MachiningType == MCH_MY.MILLING) or ( MachiningType == MCH_MY.POCKETING) or ( MachiningType == MCH_MY.DRILLING and EgtStartsWith( sType, 'Pocket')) then + Machining.Tool.MaxMat = EgtTdbGetCurrToolMaxDepth() + else + Machining.Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) + end + if MachiningType == MCH_MY.DRILLING then + if EgtStartsWith( Machining.Type, 'Drill') then + Machining.SubType = 'Drill' + elseif EgtStartsWith( Machining.Type, 'AngleDrill') then + Machining.SubType = 'AngleDrill' + elseif EgtStartsWith( Machining.Type, 'Pocket') then + Machining.SubType = 'DrillPocket' + end + end + Machining.Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + Machining.Tool.TotalLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) + Machining.Tool.ToolHolderDiameter = EgtTdbGetCurrToolThDiam() + Machining.Tool.Length = EgtTdbGetCurrToolParam( MCH_TP.LEN) + end + end + end + end + return Machinings +end + +--------------------------------------------------------------------- +function ReorderMachinings( Machinings, sCriterion) + local function SortMachiningsByLongestTool( Machining1, Machining2) + if Machining1.Tool.MaxMat > Machining2.Tool.MaxMat + 10 * GEO.EPS_SMALL then + return true + else + return false + end + end + local function SortMachiningsByShortestTool( Machining1, Machining2) + if Machining1.Tool.MaxMat < Machining2.Tool.MaxMat - 10 * GEO.EPS_SMALL then + return true + else + return false + end + end + local function SortMachiningsByBiggestTool( Machining1, Machining2) + if Machining1.Tool.Diameter > Machining2.Tool.Diameter + 10 * GEO.EPS_SMALL then + return true + else + return false + end + end + local function SortMachiningsBySmallestTool( Machining1, Machining2) + if Machining1.Tool.Diameter < Machining2.Tool.Diameter - 10 * GEO.EPS_SMALL then + return true + else + return false + end + end + if not sCriterion then + return + elseif sCriterion == 'Longest' then + table.sort( Machinings, SortMachiningsByLongestTool) + elseif sCriterion == 'Shortest' then + table.sort( Machinings, SortMachiningsByShortestTool) + elseif sCriterion == 'Biggest' then + table.sort( Machinings, SortMachiningsByBiggestTool) + elseif sCriterion == 'Smallest' then + table.sort( Machinings, SortMachiningsBySmallestTool) + end + end --------------------------------------------------------------------- @@ -229,7 +319,7 @@ function ReturnParams( MachiningType, MachiningName, sType, ToolParams) end --------------------------------------------------------------------- -local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH2, bExcludeH3) +local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) if bTopHead == nil and bDownHead == nil then bTopHead = true bDownHead = false @@ -256,11 +346,12 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, local sH2Mach = '' local sH2Tool = '' local sH2Param - -- ricerca sulle forature, dal diametro maggiore al minore - local Machinings = GetMachinings( MachiningType) + local Machinings = GetMachinings( MachiningType, sType) + ReorderMachinings( Machinings, sSortingCriterion) local ForStart = 1 local ForEnd = #Machinings local ForStep = 1 + -- le forature vanno scorse dal diametro maggiore al minore if MachiningType == MCH_MY.DRILLING then ForStart = #Machinings ForEnd = 1 @@ -292,7 +383,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, -- recupero dati utensile local bToolActive, sToolName, bH2, bFixed, bH3 = SetCurrMachiningAndTool( Machining.Name) if Machining.On and sMachiningType == sType and bToolActive and ( not bH2 or bH2 == not bExcludeH2) and ( not bH3 or bH3 == not bExcludeH3) then - local bOk, ToolParams = VerifyTool( MachiningType, sType, Params, bH2) + local bOk, ToolParams = VerifyTool( Machining, MachiningType, Params, bH2) if bOk then if MachineHeadUse == ONE_HEAD then SetNextMachining( sToolName, 1, bFixed) @@ -411,8 +502,9 @@ function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHe end --------------------------------------------------------------------- -function MachiningLib.FindSawing( sType, dDepth) - return FindMachining( MCH_MY.MORTISING, sType, { Depth = dDepth}) +function MachiningLib.FindSawing( sType, dDepth, bConsiderCSimmEncumberance, sSortingCriterion) + if not BD.C_SIMM_ENC then BD.C_SIMM_ENC = EgtIf( BD.C_SIMM, 180, 90) end + return FindMachining( MCH_MY.MORTISING, sType, { Depth = dDepth, CSimmEncumberance = EgtIf( bConsiderCSimmEncumberance, BD.C_SIMM_ENC, 0)}, nil, nil, nil, nil, sSortingCriterion) end ------------------------------------------------------------------------------------------------------------- diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index a18538d..dbfbafb 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -10,6 +10,7 @@ -- 2023/08/02 Corretto calcolo allungamenti/accorciamenti pezzi alti per contemplare anche taglio singolo -- 2023/10/17 Corretto calcolo allungamenti/accorciamenti per evitare lunghezze del percorso negative -- 2024/01/18 Gestiti tagli verticali aggiuntivi per travi larghe. +-- 2024/01/22 Nei tagli verticali aggiuntivi si usa ora BD.MAX_LEN_DICE come dimensione (era BD.MAX_DIM_DICE). -- Tabella per definizione modulo local ProcessHeadCut = {} @@ -157,7 +158,7 @@ end -- tagli verticali aggiuntivi local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw ) local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) - local nVerticalCuts = ceil( dimH / ( BD.MAX_DIM_DICE)) - 1 + local nVerticalCuts = ceil( dimH / ( BD.MAX_LEN_DICE)) - 1 local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1) -- recupero il diametro dell'utensile local dSawDiam = 400 diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 4978f5f..10e5ac8 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -88,6 +88,7 @@ -- 2023/12/01 In MakeMoreFaces, nelle OpenPocket, ammesso utensile con diametro fino a 3 volte la dimensione della tasca (era 2). -- 2023/12/06 In VerifySideMillAsSaw, se SIDEDEPTH non definita, viene calcolata. -- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. +-- 2024/01/22 Implementata gestione seghe a catena multiple. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -310,10 +311,15 @@ local function TestElleShape4( Proc) end --------------------------------------------------------------------- -local function VerifyChainSaw( Proc, dMinDim, dMaxDim) +local function VerifyChainSaw( Proc, dMinDim, dMaxDim, dDepth) local bUseChainSaw = false local sMchFind = 'Sawing' - local sSawing = ML.FindSawing( sMchFind) + -- prendo la prima sega a catena lunga a sufficienza + local sSawing = ML.FindSawing( sMchFind, dDepth, true) + -- se non trovo alcuna sega a catena lunga a sufficienza, accetto di non arrivare sul fondo della tasca + if not sSawing then + sSawing = ML.FindSawing( sMchFind, nil, nil, 'Longest') + end local dMaxMat = 0 local dSawCornerRad = 0 local dSawThick = 0 @@ -2697,6 +2703,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, if nOk < 0 then return false, sErr end end end + if not dDepth then dDepth = dElev end -- Recupero le facce adiacenti alla principale local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacInd)[1] if not vAdj or #vAdj == 0 then @@ -2830,7 +2837,12 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, -- altrimenti con sega a catena else -- Recupero la lavorazione - local sSawing = ML.FindSawing( 'Sawing') + local sSawing = ML.FindSawing( 'Sawing', dDepth, true) + -- se non trovo alcuna sega a catena lunga a sufficienza, accetto di non arrivare sul fondo della tasca + if not sSawing then + sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest') + end + -- se non trova una lavorazione di sawing esco if not sSawing then local sErr = 'Error : Sawing not found in library' EgtOutLog( sErr) @@ -2948,7 +2960,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, -- altrimenti sega a catena di fianco else -- verifico se posso farlo con la sega-catena - local bMakeChainSaw, sSawing2, dMaxMat2, dSawCornerRad2, dSawThick2 = VerifyChainSaw( Proc, dDimMin, dDimMax) + local bMakeChainSaw, sSawing2, dMaxMat2, dSawCornerRad2, dSawThick2 = VerifyChainSaw( Proc, dDimMin, dDimMax, dDepth) if bMakeChainSaw then -- Calcolo normale faccia da lavorare local vtNL = EgtSurfTmFacetNormVersor( Proc.Id, nLundIdFace, GDB_ID.ROOT) @@ -4541,7 +4553,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- Se la svuotatura precedente non è stata fatta e chamfer non è mutuamente esclusivo provo con la sega-catena if bTryWithBlades and nChamfer < 2 then -- verifico se posso farlo con la sega-catena - local bMakeChainSaw, sSawing, dMaxMat, dSawCornerRad, dSawThick = VerifyChainSaw( Proc, dDimMin, dDimMax) + local bMakeChainSaw, sSawing, dMaxMat, dSawCornerRad, dSawThick = VerifyChainSaw( Proc, dDimMin, dDimMax, dDepth) if bMakeChainSaw then -- Ricalcolo l'affondamento tenendo conto di eventuale inclinazione local dSlDepth diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index 7a8a305..259e41d 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -33,6 +33,7 @@ -- 2023/10/24 Migliorata spezzatura taglio passante con due spezzoni -- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation. -- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. +-- 2024/01/22 Implementata gestione seghe a catena multiple. -- Tabella per definizione modulo local ProcessLongCut = {} @@ -500,7 +501,11 @@ end -- lavorazione faccia laterale con sega a catena local function MakeSideFaceByChainSaw( nSurfId, dDepth, dOffs, dSal, dEal, bShortenStart, bShortenEnd) -- Recupero i dati dell'utensile - local sSawing = ML.FindSawing( 'Sawing') + local sSawing = ML.FindSawing( 'Sawing', dDepth, true) + -- se non trovo alcuna sega a catena lunga a sufficienza, accetto di non arrivare sul fondo + if not sSawing then + sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest') + end local dMaxMat = 0 local dSawCornerRad = 0 local dSawThick = 0 diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index edad1e6..7c780a3 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -17,6 +17,7 @@ -- 2024/01/18 Gestita lama con aggregato con asse bloccato per massimizzare capacità di taglio verticale, se da sotto -- Implementato split per pezzi molto alti con mix sega a catena + lama -- Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. +-- 2024/01/22 Nei tagli verticali aggiuntivi si usa ora BD.MAX_LEN_DICE come dimensione (era BD.MAX_DIM_DICE). -- Tabella per definizione modulo local ProcessSplit = {} @@ -162,9 +163,8 @@ end --------------------------------------------------------------------- -- lavorazione con sega a catena per sezioni alte e larghe -local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs) +local function MakeSplitByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dOffs) -- Recupero i dati dell'utensile - local sSawing = ML.FindSawing( 'Sawing') local dMaxMat = 0 local dSawCornerRad = 0 local dSawThick = 0 @@ -249,7 +249,7 @@ end -- tagli verticali aggiuntivi local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw ) local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) - local nVerticalCuts = ceil( dimH / ( BD.MAX_DIM_DICE)) - 1 + local nVerticalCuts = ceil( dimH / ( BD.MAX_LEN_DICE)) - 1 local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1) -- recupero il diametro dell'utensile local dSawDiam = 400 @@ -355,7 +355,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt local bFinishingNeeded = false if bSplit then -- recupero dati utensile della sega a catena più lunga a disposizione - local sSawing = ML.FindSawing( 'Sawing') + local sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest') local dChainSawMaxMat = 0 local dChainSawLen = 0 if EgtMdbSetCurrMachining( sSawing or '') then @@ -365,19 +365,6 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen end end - local sSawing2 = ML.FindSawing( 'Sawing', dChainSawMaxMat + 1) - if sSawing2 then - sSawing = sSawing2 - dChainSawMaxMat = 0 - dChainSawLen = 0 - if EgtMdbSetCurrMachining( sSawing or '') then - local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) - if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then - dChainSawMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dChainSawMaxMat - dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen - end - end - end local bigSectionSplitType -- se pezzo non troppo alto, taglio singolo da sopra @@ -405,26 +392,26 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt if bigSectionSplitType == "single horizontal" then local dCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN local sNotesSplit = 'Split;' - local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, dCutDepth, sNotesSplit, dOffs) + local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_TOP, dCutDepth, sNotesSplit, dOffs) if not bOk then return bOk, sErr, nNewPhase end elseif bigSectionSplitType == "single vertical" then local dCutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN local sNotesSplit = 'Split;' - local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs) + local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs) if not bOk then return bOk, sErr, nNewPhase end elseif bigSectionSplitType == "double vertical" then local dCutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN local sNotesSplit = 'Presplit;' - local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_BACK, dCutDepth, sNotesSplit, dOffs) + local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_BACK, dCutDepth, sNotesSplit, dOffs) if not bOk then return bOk, sErr, nNewPhase end sNotesSplit = 'Split;' - bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs) + bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs) if not bOk then return bOk, sErr, nNewPhase end elseif bigSectionSplitType == "double horizontal" then -- sega a catena da sopra local dChainSawCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - dSawMaxDepth2 local sNotesSplit = 'Presplit;' - local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, dChainSawCutDepth, sNotesSplit, dOffs) + local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_TOP, dChainSawCutDepth, sNotesSplit, dOffs) if not bOk then return bOk, sErr, nNewPhase end -- lama da sotto local dCutExtra = -dChainSawCutDepth + BD.CUT_EXTRA_MIN From 337e13dbde010bb455ce19a34714853cedb95bcd Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 22 Jan 2024 18:14:18 +0100 Subject: [PATCH 14/16] In Split con sega a catena ora si cerca di preferenza una lavorazione di tipo 'SawingForSplitting'. Se non trovata si cerca il tipo 'Sawing' come in precedenza. --- LuaLibs/ProcessSplit.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index 7c780a3..ea91656 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -18,6 +18,7 @@ -- Implementato split per pezzi molto alti con mix sega a catena + lama -- Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. -- 2024/01/22 Nei tagli verticali aggiuntivi si usa ora BD.MAX_LEN_DICE come dimensione (era BD.MAX_DIM_DICE). +-- 2024/01/22 Nello split con sega a catena ora si cerca di preferenza una lavorazione di tipo 'SawingForSplitting'. Se non trovata si cerca il tipo 'Sawing' come in precedenza. -- Tabella per definizione modulo local ProcessSplit = {} @@ -355,7 +356,10 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt local bFinishingNeeded = false if bSplit then -- recupero dati utensile della sega a catena più lunga a disposizione - local sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest') + local sSawing = ML.FindSawing( 'SawingForSplitting', nil, nil, 'Longest') + if not sSawing then + sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest') + end local dChainSawMaxMat = 0 local dChainSawLen = 0 if EgtMdbSetCurrMachining( sSawing or '') then From 418fb4e284e71966476f8b90408531a754993cd4 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 23 Jan 2024 10:39:40 +0100 Subject: [PATCH 15/16] - correzione in MachiningLib per gestire il caso in cui una lavorazione sia attiva ma non ha alcun utensile collegato --- LuaLibs/MachiningLib.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 55f2bb6..f5eb317 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -255,6 +255,12 @@ function GetMachinings( MachiningType, sType) end end end + -- rimuovo le lavorazioni senza utensile + for i, machining in ipairs( Machinings) do + if not machining.Tool.Name then + table.remove( Machinings, i) + end + end return Machinings end From 0400878279d716787fc46aecce750f580431c17e Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 23 Jan 2024 10:42:17 +0100 Subject: [PATCH 16/16] update commenti --- LuaLibs/MachiningLib.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index f5eb317..01872b7 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -12,6 +12,7 @@ -- 2024/01/19 In FindSawing aggiunto parametro opzionale bConsiderCSimmEncumberance per considerare l'ingombro dell'asse C nel massimo materiale (default false). -- 2024/01/22 Nella GetMachinings vengono ora raccolti i parametri utensile necessari per i VerifyTool, scritti direttamente nella tabella Machining.Tool. -- Le lavorazioni possono essere ora ordinate per dimensioni utensile (Longest, Shortest, Biggest, Smallest) se passato l'apposito parametro SortingCriterion in FindMachining. Al momento implementato solo per FindSawing. +-- in GetMachinings ora si eliminano dalla lista le lavorazioni che non hanno un utensile collegato. -- Tabella per definizione modulo local MachiningLib = {}