From 5f7f98855213e6501361c8ee3a35b01fc48d4bd4 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 4 Jan 2024 11:44:44 +0100 Subject: [PATCH] - 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