From e9d71ab75e82e7534187c91834aa509f5dbda462 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Thu, 2 Jan 2025 16:41:36 +0100 Subject: [PATCH 1/3] - Aggiunta chiamata strategia in BasicCustomerStrategies - Calcolo parametri aggiuntivi - Prima bozza (non funzionante) della strategia --- LuaLibs/BasicCustomerStrategies.lua | 2 + LuaLibs/FeatureLib.lua | 76 ++++++++++++++++++++--- Strategies/Standard/STR0001/STR0001.lua | 82 +++++++++++++++++++++++-- 3 files changed, 144 insertions(+), 16 deletions(-) diff --git a/LuaLibs/BasicCustomerStrategies.lua b/LuaLibs/BasicCustomerStrategies.lua index f0a2a80..495546d 100644 --- a/LuaLibs/BasicCustomerStrategies.lua +++ b/LuaLibs/BasicCustomerStrategies.lua @@ -215,6 +215,7 @@ local function GetStrategies_Egalware( Proc) --------------------------------------------------------------------- -- Feature : Dovetail Tenon elseif ID.IsDovetailTenon( Proc) then + Strategies = { { sStrategyId = 'STR0001'}} --------------------------------------------------------------------- -- Feature : Dovetail Mortise elseif ID.IsDovetailMortise( Proc) then @@ -473,6 +474,7 @@ local function GetStrategies_Essetre( Proc) --------------------------------------------------------------------- -- Feature : Dovetail Tenon elseif ID.IsDovetailTenon( Proc) then + Strategies = { { sStrategyId = 'STR0001'}} --------------------------------------------------------------------- -- Feature : Dovetail Mortise elseif ID.IsDovetailMortise( Proc) then diff --git a/LuaLibs/FeatureLib.lua b/LuaLibs/FeatureLib.lua index 0ae6034..18e7155 100644 --- a/LuaLibs/FeatureLib.lua +++ b/LuaLibs/FeatureLib.lua @@ -209,6 +209,19 @@ function FeatureLib.ClassifyTopology( Proc, Part) return FeatureTopology end +------------------------------------------------------------------------------------------------------------- +function FeatureLib.GetAdditionalInfo( Proc, Part) + -- se foro calcolo altri dati + if ID.IsDrilling( Proc) then + -- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento) + Proc.dDiam, Proc.dLen, Proc.nFcs, Proc.nFce = FeatureLib.GetDrillingData( Proc) + elseif ID.IsDovetailTenon( Proc) then + Proc.dDTLength, Proc.dDTMaxDist, Proc.vtDTNormal, Proc.ptDTCenter = FeatureLib.GetDoveTailTenonData( Proc) + end + + return Proc +end + ------------------------------------------------------------------------------------------------------------- -- Recupero dati foro e adattamento se speciale function FeatureLib.GetDrillingData( Proc) @@ -230,6 +243,59 @@ function FeatureLib.GetDrillingData( Proc) return dDiam, dLen, nFcs, nFce end +------------------------------------------------------------------------------------------------------------- +-- Recupero dati tenone a coda di rondine +function FeatureLib.GetDoveTailTenonData( Proc) + -- recupero e verifico l'entità curva + local idAux = EgtGetInfo( Proc.id, 'AUXID', 'i') + if idAux then idAux = idAux + Proc.id end + -- recupero i dati della curva + local vtExtr = EgtCurveExtrusion( idAux, GDB_RT.GLOB) + local ptBC = EgtGP( idAux, GDB_RT.GLOB) + -- determino altezza del tenone + local frDtTen = Frame3d( ptBC, vtExtr) + local b3DtTen = EgtGetBBoxRef( Proc.id, GDB_BB.STANDARD, frDtTen) + local dDtTenH = b3DtTen:getDimZ() + -- assegno centro e normale della faccia top + local vtN = vtExtr + local ptC = ptBC + vtN * dDtTenH + -- calcolo distanza massima della curva dal punto più lontano della base tenone Dt (facet 0) + local dMaxDist + for i = 0, Proc.nFct - 1 do + local ptFC, vtFN = EgtSurfTmFacetCenter( Proc.id, i, GDB_ID.ROOT) + if not AreSameVectorApprox( vtFN, vtN) or abs( ( ptFC - ptBC) * vtN) > 100 * GEO.EPS_SMALL then + break + end + local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( Proc.id, i, EgtGetParent( Proc.id)) + if nLoopId then + local dUmin, dUmax = EgtCurveDomain( nLoopId) + for dU = dUmin, dUmax do + local ptP = EgtUP( nLoopId, dU, GDB_ID.ROOT) + local ptNear = EgtNP( idAux, ptP, GDB_ID.ROOT) + local dDist = dist( ptP, ptNear) + if not dMaxDist or dDist > dMaxDist then + dMaxDist = dDist + end + end + for j = 1, nLoopCnt do + EgtErase( nLoopId + j - 1) + end + end + end + if not dMaxDist then + local b3DtAux = EgtGetBBoxRef( idAux, GDB_BB.STANDARD, frDtTen) + dMaxDist = 2 * ( b3DtTen:getRadius() - b3DtAux:getRadius()) + end + + Proc.dDTLength = dDtTenH + Proc.dDTMaxDist = dMaxDist + Proc.vtDTNormal = vtExtr + Proc.ptDTCenter = ptC + + return Proc.dDTLength, Proc.dDTMaxDist, Proc.vtDTNormal, Proc.ptDTCenter + +end + ------------------------------------------------------------------------------------------------------------- -- funzione che restituisce indice di completamento in base alla percentuale di volume lavorato function FeatureLib.GetFeatureCompletionIndex( dCompletionPercentage) @@ -395,15 +461,5 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters) return FeatureSplittingPoints end -------------------------------------------------------------------------------------------------------------- -function FeatureLib.GetAdditionalInfo( Proc, Part) - -- se foro calcolo altri dati - if ID.IsDrilling( Proc) then - -- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento) - Proc.dDiam, Proc.dLen, Proc.nFcs, Proc.nFce = FeatureLib.GetDrillingData( Proc) - end - return Proc -end - ------------------------------------------------------------------------------------------------------------- return FeatureLib \ No newline at end of file diff --git a/Strategies/Standard/STR0001/STR0001.lua b/Strategies/Standard/STR0001/STR0001.lua index a0ee662..54c024f 100644 --- a/Strategies/Standard/STR0001/STR0001.lua +++ b/Strategies/Standard/STR0001/STR0001.lua @@ -5,18 +5,88 @@ -- carico librerie local BeamLib = require( 'BeamLib') +local BeamData = require( 'BeamData') +local MachiningLib = require( 'MachiningLib') +local FeatureLib = require( 'FeatureLib') -- Tabella per definizione modulo local STR0001 = {} +local Strategy = {} ------------------------------------------------------------------------------------------------------------- -function STR0001.Make( AddMachining, Proc, Part, CustomParameters) - -- carico parametri de default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti) - local StrategyLib = {} - StrategyLib.Config = require( 'STR0001\\STR0001Config') - CustomParameters = BeamLib.GetUpdateCustomParameters( CustomParameters, StrategyLib.Config.Parameters) - StrategyParameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters) +function STR0001.Make( bAddMachining, Proc, Part, CustomParameters) + -- carico parametri de default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti) + local StrategyLib = {} + StrategyLib.Config = require( 'STR0001\\STR0001Config') + Strategy.sName = StrategyLib.Config.sStrategyId + CustomParameters = BeamLib.GetUpdateCustomParameters( CustomParameters, StrategyLib.Config.Parameters) + Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters) + Strategy.Machining = {} + Strategy.Result = {} + + local bAreAllMachiningsAdded = true + local ToolSearchParameters = {} + local Milling = {} + local Cutting = {} + local Pocketing = {} + + -- ===== RICERCA UTENSILE ===== + -- ricerca utensile per lavorare tenone coda di rondine + -- ricerca utensile per taglio del tenone in lunghezza + -- ricerca utensile di svuotatura (se richiesto) + ToolSearchParameters.dElevation = Proc.MainFaces.BottomFaces[1].dElevation + ToolSearchParameters.vtToolDirection = Proc.MainFaces.BottomFaces[1].vtN + ToolSearchParameters.sMillShape = 'DOVETAIL' + Milling.idFaceToMachine = Proc.MainFaces.BottomFaces[1].id + Milling.idProc = Proc.id + Milling.vtFaceNormal = Proc.MainFaces.BottomFaces[1].vtN + Milling.dElevation = Proc.MainFaces.BottomFaces[1].dElevation + Milling.ToolInfo = {} + Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters) + Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill') + if Milling.ToolInfo.nToolIndex then + -- se utensile scelto è su aggregato, ricalcolo la qualità + if TOOLS[Milling.ToolInfo.nToolIndex].SetupInfo.bToolOnAggregate then + Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'MillOnAggregate') + end + local ParametersMRR = {} + ParametersMRR.nToolIndex = Milling.ToolInfo.nToolIndex + Milling.dMRR = MachiningLib.GetToolMRR( ParametersMRR) + end + + -- setto il risultato in base agli utensili trovati + -- lavorazione completa + if Milling.bIsApplicable and Cutting.bIsApplicable and ( Pocketing.bIsApplicable or Pocketing.bNotNeeded) then + Strategy.Result.sStatus = 'Completed' + Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 100) + Strategy.Result.dMRR = ( Milling.dMRR + Cutting.dMRR + Pocketing.dMRR) / 3 + Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill') + -- lavorazione incompleta + elseif Cutting.bIsApplicable then + Strategy.Result.sStatus = 'Not-Completed' + Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 50) + Strategy.Result.dMRR = ( Milling.dMRR + Cutting.dMRR + Pocketing.dMRR) / 3 + Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill') + if not Milling.bIsApplicable then + Strategy.Result.sInfo = 'DoveTail-Mill not found' + else + Strategy.Result.sInfo = 'DoveTail tenon not completed' + end + -- strategia non applicabile, manca il taglio di lama sulla lunghezza del tenone + else + Strategy.Result.sStatus = 'Not-Applicable' + Strategy.Result.nCompletionIndex = 0 + Strategy.Result.dMRR = 0 + Strategy.Result.nQuality = 0 + Strategy.Result.sInfo = 'Mill not found' + end + + -- applicazione delle lavorazioni + if bAddMachining and Strategy.Result.sStatus ~= 'Not-Applicable' then + end + + return bAreAllMachiningsAdded, Strategy.Result end ------------------------------------------------------------------------------------------------------------- From 512b907aae5181e4ca8cc26ba9c5543efa4710e8 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Fri, 3 Jan 2025 17:19:15 +0100 Subject: [PATCH 2/3] - Aggiunto passaggio di contornatura su profilo - Prima bozza struttura lavorazioni - Piccole modifiche in altre librerie --- LuaLibs/BeamExec.lua | 2 +- LuaLibs/FeatureLib.lua | 5 +- LuaLibs/MachiningLib.lua | 6 +- Strategies/Standard/STR0001/STR0001.lua | 128 +++++++++++++++++++++--- 4 files changed, 121 insertions(+), 20 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 91efe82..ca0d2f8 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -139,7 +139,7 @@ function BeamExec.GetToolsFromDB() Tool.dStemDiameter = EgtTdbGetCurrToolParam( MCH_TP.STEMDIAM) or Tool.ToolHolder.dDiameter -- se non settato, considero diametro come ToolHolder Tool.dSideAngle = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or 0 -- verifico che parametri siano compatibili con una fresa a coda di rondine ( angolo di fianco standard Coda di rondine -> 15°) - Tool.bIsDoveTail = Tool.Type == 'MILL_NOTIP' and abs( abs( Tool.dSideAngle) - SIDEANGLE_DOVETAIL) < 1 + Tool.bIsDoveTail = Tool.sType == 'MILL_NOTIP' and abs( abs( Tool.dSideAngle) - SIDEANGLE_DOVETAIL) < 1 -- verifico che sia una fresa tipo T-Mill o BlockHaus Tool.dSideDepth = EgtGetValInNotes( Tool.sUserNotes, 'SIDEDEPTH', 'd') or 0 -- se non settato nell'utensile, dico che non ha massimo affondamento laterale Tool.bIsTMill = Tool.dSideDepth > 0 diff --git a/LuaLibs/FeatureLib.lua b/LuaLibs/FeatureLib.lua index 18e7155..fbe6981 100644 --- a/LuaLibs/FeatureLib.lua +++ b/LuaLibs/FeatureLib.lua @@ -216,7 +216,7 @@ function FeatureLib.GetAdditionalInfo( Proc, Part) -- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento) Proc.dDiam, Proc.dLen, Proc.nFcs, Proc.nFce = FeatureLib.GetDrillingData( Proc) elseif ID.IsDovetailTenon( Proc) then - Proc.dDTLength, Proc.dDTMaxDist, Proc.vtDTNormal, Proc.ptDTCenter = FeatureLib.GetDoveTailTenonData( Proc) + Proc.dDTLength, Proc.dDTMaxDist, Proc.vtDTNormal, Proc.ptDTCenter, Proc.idAddAuxGeom = FeatureLib.GetDoveTailTenonData( Proc) end return Proc @@ -291,8 +291,9 @@ function FeatureLib.GetDoveTailTenonData( Proc) Proc.dDTMaxDist = dMaxDist Proc.vtDTNormal = vtExtr Proc.ptDTCenter = ptC + Proc.idAddAuxGeom = idAux - return Proc.dDTLength, Proc.dDTMaxDist, Proc.vtDTNormal, Proc.ptDTCenter + return Proc.dDTLength, Proc.dDTMaxDist, Proc.vtDTNormal, Proc.ptDTCenter, Proc.idAddAuxGeom end diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index b1b92ee..3d92190 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -203,7 +203,7 @@ function MachiningLib.FindMill( Proc, ToolSearchParameters) elseif TOOLS[i].bIsProfiledTool then bIsToolCompatible = false -- controlli standard - elseif TOOLS[i].dDiameter > ToolSearchParameters.dMaxToolDiameter then + elseif ToolSearchParameters.dMaxToolDiameter and TOOLS[i].dDiameter > ToolSearchParameters.dMaxToolDiameter then bIsToolCompatible = false elseif TOOLS[i].SetupInfo.bIsTopHead and ToolSearchParameters.vtToolDirection:getZ() < TOOLS[i].SetupInfo.dMaxNegativeAngle then bIsToolCompatible = false @@ -217,7 +217,7 @@ function MachiningLib.FindMill( Proc, ToolSearchParameters) bIsToolCompatible = false elseif ToolSearchParameters.sMillShape == 'PEN' and not TOOLS[i].bIsPen then bIsToolCompatible = false - elseif TOOLS[i].sType ~= ToolSearchParameters.sType then + elseif ToolSearchParameters.sType and TOOLS[i].sType ~= ToolSearchParameters.sType then -- se sto cercando una fresa che non può lavorare di testa, quelle che lavorano di testa sono comunque ammesse if TOOLS[i].sType == 'MILL_STD' and ToolSearchParameters.sType == 'MILL_NOTIP' then bIsToolCompatible = true @@ -241,7 +241,7 @@ function MachiningLib.FindMill( Proc, ToolSearchParameters) if ToolEntryAngle.dValue > 0 and ToolEntryAngle.dValue < 90 then dCurrentMaxMatReduction = dCurrentMaxMatReduction / ToolEntryAngle.dSin + ( ( dDimObjToCheck - TOOLS[i].dDiameter) / 2) / ToolEntryAngle.dTan end - -- dCurrMachReduction = negativo -> limitare, positivo -> mm extra disponibili + -- dCurrentResidualDepth = negativo -> mm extra disponibili, positivo -> limitare local dCurrentResidualDepth = ToolSearchParameters.dElevation + dCurrentMaxMatReduction - TOOLS[i].dMaxDepth -- se non ancora trovato, oppure se completo e il migliore fino ad ora non è completo: corrente è il migliore diff --git a/Strategies/Standard/STR0001/STR0001.lua b/Strategies/Standard/STR0001/STR0001.lua index 54c024f..43033ca 100644 --- a/Strategies/Standard/STR0001/STR0001.lua +++ b/Strategies/Standard/STR0001/STR0001.lua @@ -8,11 +8,14 @@ local BeamLib = require( 'BeamLib') local BeamData = require( 'BeamData') local MachiningLib = require( 'MachiningLib') local FeatureLib = require( 'FeatureLib') +-- strategie di base +local FaceByBlade = require('FACEBYBLADE') -- Tabella per definizione modulo local STR0001 = {} local Strategy = {} + ------------------------------------------------------------------------------------------------------------- function STR0001.Make( bAddMachining, Proc, Part, CustomParameters) -- carico parametri de default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti) @@ -32,36 +35,69 @@ function STR0001.Make( bAddMachining, Proc, Part, CustomParameters) local Pocketing = {} -- ===== RICERCA UTENSILE ===== - -- ricerca utensile per lavorare tenone coda di rondine - -- ricerca utensile per taglio del tenone in lunghezza - -- ricerca utensile di svuotatura (se richiesto) - ToolSearchParameters.dElevation = Proc.MainFaces.BottomFaces[1].dElevation - ToolSearchParameters.vtToolDirection = Proc.MainFaces.BottomFaces[1].vtN + -- === ricerca utensile per taglio del tenone in lunghezza === + -- TODO fare funzione generale per trovare lama data una faccia? + Cutting.bIsApplicable = false + ToolSearchParameters.bAllowTopHead = true + ToolSearchParameters.bAllowBottomHead = false + ToolSearchParameters.vtToolDirection = Proc.vtDTNormal + Cutting.ToolInfo = {} + Cutting.ToolInfo = MachiningLib.FindBlade( Proc, ToolSearchParameters) + if Cutting.ToolInfo.nToolIndex then + Cutting.bIsApplicable = true + local ParametersMRR = {} + ParametersMRR.nToolIndex = Cutting.ToolInfo.nToolIndex + Cutting.dMRR = MachiningLib.GetToolMRR( ParametersMRR) + end + + -- === ricerca utensile per lavorare tenone coda di rondine === + Milling.bIsApplicable = false + ToolSearchParameters.dElevation = Proc.dDTLength + ToolSearchParameters.vtToolDirection = Proc.vtDTNormal ToolSearchParameters.sMillShape = 'DOVETAIL' - Milling.idFaceToMachine = Proc.MainFaces.BottomFaces[1].id - Milling.idProc = Proc.id - Milling.vtFaceNormal = Proc.MainFaces.BottomFaces[1].vtN - Milling.dElevation = Proc.MainFaces.BottomFaces[1].dElevation Milling.ToolInfo = {} Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters) Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill') if Milling.ToolInfo.nToolIndex then - -- se utensile scelto è su aggregato, ricalcolo la qualità - if TOOLS[Milling.ToolInfo.nToolIndex].SetupInfo.bToolOnAggregate then - Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'MillOnAggregate') - end + Milling.bIsApplicable = true local ParametersMRR = {} ParametersMRR.nToolIndex = Milling.ToolInfo.nToolIndex Milling.dMRR = MachiningLib.GetToolMRR( ParametersMRR) end + -- === ricerca utensile di svuotatura (se richiesto) === + -- se bastano passate con sovramateriale + local nMillingPathsNeeded = ceil( Proc.dDTMaxDist / TOOLS[Milling.ToolInfo.nToolIndex].dSideStep) + if nMillingPathsNeeded <= Strategy.Parameters.nMaxMillingPaths then + Pocketing.bNotNeeded = true + Pocketing.dMRR = Milling.dMRR + -- serve svuotatura + else + Pocketing.ToolInfo = {} + -- se ammessa svuotatura con utensile DoveTail, copio i dati + if Strategy.Parameters.bUseDTToolOnPocketing then + Pocketing.ToolInfo = Milling.ToolInfo + Pocketing.dMRR = Milling.dMRR + -- altrimenti serve cercarne un altro + else + ToolSearchParameters = {} + ToolSearchParameters.dElevation = Proc.dDTLength + ToolSearchParameters.vtToolDirection = Proc.vtDTNormal + Pocketing.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters) + end + -- se trovato utensile di svuotatura + if Pocketing.ToolInfo.nToolIndex then + Pocketing.bIsApplicable = true + end + end + -- setto il risultato in base agli utensili trovati -- lavorazione completa if Milling.bIsApplicable and Cutting.bIsApplicable and ( Pocketing.bIsApplicable or Pocketing.bNotNeeded) then Strategy.Result.sStatus = 'Completed' Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 100) Strategy.Result.dMRR = ( Milling.dMRR + Cutting.dMRR + Pocketing.dMRR) / 3 - Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill') + Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill,Blade,Mill') -- lavorazione incompleta elseif Cutting.bIsApplicable then Strategy.Result.sStatus = 'Not-Completed' @@ -84,6 +120,70 @@ function STR0001.Make( bAddMachining, Proc, Part, CustomParameters) -- applicazione delle lavorazioni if bAddMachining and Strategy.Result.sStatus ~= 'Not-Applicable' then + -- creo piano di taglio sulla testa del tenone + local nAddGrpId = BeamLib.GetAddGroup( Part.id) + local idTenonCutPlane = EgtSurfTmPlaneInBBox( nAddGrpId, Proc.ptDTCenter, Proc.vtDTNormal, Part.b3Part, GDB_RT.GLOB) + if idTenonCutPlane then + EgtSetName( idTenonCutPlane, 'AddCut_' .. tostring( Proc.id)) + EgtSetInfo( idTenonCutPlane, 'TASKID', Proc.idTask) + end + + -- taglio in lunghezza sul tenone + if Cutting.bIsApplicable then + OptionalParameters = {} + local AuxiliaryData = {} + OptionalParameters.nToolIndex = Cutting.ToolInfo.nToolIndex + OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_BACK + OptionalParameters.sDepth = 0 + + -- TODO gestire lavorazione a cubetti + + -- TODO + -- Su faccia appena creata NON sono stati calcolati gli edges. + -- La FaceByBlade si aspetta di lavorare 1 faccia di una trimesh. Fare altra funzione? + + --local nFaceType, vEdges = EgtSurfTmGetFacetOutlineInfo( AddId, 0, GDB_ID.ROOT) + --local EdgeToMachine = GetEdgeToMachine( vEdges, -Y_AX()) + -- approccio e retrazione + --OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Cutting, EdgeToMachine) + --Cutting = FaceByBlade.Make( Proc, Part, AddId, EdgeToMachine, OptionalParameters) + if Proc.AffectedFaces.bLeft then + Cutting.sStage = 'AfterTail' + end + MachiningLib.AddNewMachining( Proc, Cutting, AuxiliaryData) + end + + -- svuotatura + if Pocketing.bIsApplicable then + -- azzero eventuale contatore passaggi con sovramateriale + nMillingPathsNeeded = 1 + end + -- passaggio sul profilo + if Milling.bIsApplicable then + -- aggiungo geometria + Milling.Geometry = {{ Proc.idAddAuxGeom, -1}} + Milling.nToolIndex = Milling.ToolInfo.nToolIndex + Milling.nType = MCH_MY.MILLING + Milling.vtToolDirection = Proc.vtDTNormal + Milling.sDepth = 0 + Milling.sStage = 'AfterTail' + + -- TODO : fare i cloni, gestire attacco/uscita + for i = nMillingPathsNeeded, 1, -1 do + -- sistemo i parametri + Milling.dRadialOffset = ( i - 1) * TOOLS[Milling.ToolInfo.nToolIndex].dSideStep + Milling.sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( Proc.dDTLength, 1)) .. ';' + -- sistemo il lato e la direzione di lavoro + + Milling.bInvert = EgtIf( TOOLS[Milling.ToolInfo.nToolIndex].bIsCCW, false, true) + Milling.nWorkside = EgtIf( TOOLS[Milling.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT) + + -- TODO calcolare SCC + + -- aggiunge lavorazione + bAreAllMachiningsAdded = MachiningLib.AddNewMachining( Proc, Milling) + end + end end return bAreAllMachiningsAdded, Strategy.Result From 37f85bccec46ebd74de8cf25f3e29d26b2bb6303 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Tue, 7 Jan 2025 09:16:06 +0100 Subject: [PATCH 3/3] - Gestione cloni - Aggiunta attacco lineare --- Strategies/Standard/STR0001/STR0001.lua | 50 ++++++++++++++++++------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/Strategies/Standard/STR0001/STR0001.lua b/Strategies/Standard/STR0001/STR0001.lua index 43033ca..1ba2546 100644 --- a/Strategies/Standard/STR0001/STR0001.lua +++ b/Strategies/Standard/STR0001/STR0001.lua @@ -158,31 +158,53 @@ function STR0001.Make( bAddMachining, Proc, Part, CustomParameters) -- azzero eventuale contatore passaggi con sovramateriale nMillingPathsNeeded = 1 end + -- passaggio sul profilo if Milling.bIsApplicable then + local AuxiliaryData = {} -- aggiungo geometria Milling.Geometry = {{ Proc.idAddAuxGeom, -1}} Milling.nToolIndex = Milling.ToolInfo.nToolIndex Milling.nType = MCH_MY.MILLING Milling.vtToolDirection = Proc.vtDTNormal Milling.sDepth = 0 - Milling.sStage = 'AfterTail' - - -- TODO : fare i cloni, gestire attacco/uscita - for i = nMillingPathsNeeded, 1, -1 do - -- sistemo i parametri - Milling.dRadialOffset = ( i - 1) * TOOLS[Milling.ToolInfo.nToolIndex].dSideStep - Milling.sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( Proc.dDTLength, 1)) .. ';' - -- sistemo il lato e la direzione di lavoro - Milling.bInvert = EgtIf( TOOLS[Milling.ToolInfo.nToolIndex].bIsCCW, false, true) - Milling.nWorkside = EgtIf( TOOLS[Milling.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT) + -- LeadIn / LeadOut + Milling.LeadIn = {} + Milling.LeadOut = {} + Milling.LeadIn.nType = MCH_MILL_LI.LINEAR + Milling.LeadOut.nType = MCH_MILL_LI.LINEAR + Milling.LeadIn.dTangentDistance = TOOLS[Milling.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC + Milling.LeadIn.dPerpDistance = 0 + Milling.LeadOut.dTangentDistance = TOOLS[Milling.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC + Milling.LeadOut.dPerpDistance = 0 - -- TODO calcolare SCC - - -- aggiunge lavorazione - bAreAllMachiningsAdded = MachiningLib.AddNewMachining( Proc, Milling) + if Proc.AffectedFaces.bLeft then + Milling.sStage = 'AfterTail' end + + -- sistemo il lato e la direzione di lavoro + Milling.bInvert = EgtIf( TOOLS[Milling.ToolInfo.nToolIndex].bIsCCW, false, true) + Milling.nWorkside = EgtIf( TOOLS[Milling.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT) + + Milling.sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( Proc.dDTLength, 1)) .. ';' + + -- TODO calcolare SCC + + -- passate con sovramateriale + AuxiliaryData.Clones = {} + for i = nMillingPathsNeeded, 1, -1 do + -- il primo è il passaggio più esterno + local nIndexClones = nMillingPathsNeeded - i + 1 + -- suddivido step in base al numero passate da fare + local dRealSideStep = floor( Proc.dDTMaxDist / nMillingPathsNeeded) + -- cambia solo sovrmateriale radiale + AuxiliaryData.Clones[nIndexClones] = {} + AuxiliaryData.Clones[nIndexClones].dRadialOffset = ( i - 1) * dRealSideStep + end + + -- aggiunge lavorazione + bAreAllMachiningsAdded = MachiningLib.AddNewMachining( Proc, Milling, AuxiliaryData) end end