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