From b620aef7b82855570e7922fe7700fa6c1791157f Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Wed, 13 Mar 2024 17:23:40 +0100 Subject: [PATCH] Aggiunta gestione prefori --- LuaLibs/MachiningLib.lua | 19 ++++++++++++------- LuaLibs/ProcessDrill.lua | 6 +++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 87e053f..f013fe2 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -13,7 +13,7 @@ -- 2024/01/23 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. -- 2024/03/01 In VerifyPocketing implementato l'ordinamento per dimensioni utensile. --- 2024/03/13 In FindDrilling se Predrill si cerca solo tra le svuotature +-- 2024/03/13 Aggiunta gestione Predrill -- Tabella per definizione modulo local MachiningLib = {} @@ -170,7 +170,7 @@ end --------------------------------------------------------------------- function VerifyTool( Machining, MachiningType, Params, bH2) if MachiningType == MCH_MY.DRILLING then - if Machining.SubType == 'Drill' or Machining.SubType == 'AngleDrill' then + if Machining.SubType == 'Drill' or Machining.SubType == 'AngleDrill' or Machining.SubType == 'Predrill' then return VerifyDrill( Machining, Params.Diam, Params.Depth, bH2) elseif Machining.SubType == 'DrillPocket' then return VerifyDrillPocket( Machining, Params.Diam, Params.Depth, bH2) @@ -226,6 +226,8 @@ function GetMachinings( MachiningType, sType) Machining.SubType = 'AngleDrill' elseif EgtStartsWith( Machining.Type, 'Pocket') then Machining.SubType = 'DrillPocket' + elseif EgtStartsWith( Machining.Type, 'Predrill') then + Machining.SubType = 'Predrill' end end Machining.Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) @@ -301,7 +303,7 @@ end function ReturnParams( MachiningType, MachiningName, sType, ToolParams) if MachiningType == MCH_MY.DRILLING then local _, sOrigType = EgtEndsWith( sType, '_H2') - return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen + return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' or sOrigType == 'Predrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen elseif MachiningType == MCH_MY.SAWING then return MachiningName, ToolParams.H2 elseif MachiningType == MCH_MY.MILLING then @@ -469,11 +471,14 @@ end --------------------------------------------------------------------- function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission, bIsPredrill) - local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 - -- se il foro è un predrill, non devo cercare tra le punte - if not bIsPredrill then - MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Drill_AT', 'Drill'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2) + local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5, sTypeMach + -- se il foro è un predrill, cerco solo punte abilitate al Predrill + if bIsPredrill then + sTypeMach = 'Predrill' + else + sTypeMach = EgtIf( bAngleTransmission, 'Drill_AT', 'Drill') end + MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, sTypeMach, { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2) if ( not MachiningName or MachiningName == '') then MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Pocket_AT', 'Pocket'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead) end diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index b944499..2a58800 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -20,7 +20,7 @@ -- 2023/07/28 Aggiunta gestione rinvio 90deg solo per forature da sotto esattamente verticali. -- 2023/09/26 Se errore in applicazione lavorazione si inverte e riprova solo se foratura singola su foro aperto. -- 2023/11/06 Migliorata gestione dei fori con AngularTransmission. --- 2024/03/13 Prima versione gestione Predrill +-- 2024/03/13 Aggiunta gestione Predrill -- Tabella per definizione modulo local ProcessDrill = {} @@ -527,7 +527,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) dMaxElev = dMaxDepth end -- inserisco la lavorazione - local sName = 'Drill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local sName = EgtIf( sType == 'Predrill', 'Predrill_', 'Drill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchId = EgtAddMachining( sName, sDrilling) if not nMchId then local sErr = 'Error adding machining ' .. sName .. '-' .. sDrilling @@ -537,7 +537,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) -- eventuale inversione - if sType == 'Drill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' then + if sType == 'Drill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' or sType == 'Predrill' then EgtSetMachiningParam( MCH_MP.INVERT, bToInvert) else EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)