From b7fdf8531a8085216befe3a6c004c1df419759e4 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Thu, 27 Feb 2025 16:18:08 +0100 Subject: [PATCH] - Unificato calcolo parametri aggiuntivi per tenone e tenone coda di rondine - In AddOperation si setta su nota geometria Taskid e Cutid - In FeatureLib parametri feature aggiuntivi si trovano ora nella tabella "FeatureInfo" - Piccole modifiche STR0006 per gestione nuova struttura dati - In FeatureLib cancellato doppione GetAdditionalInfo --- LuaLibs/FeatureLib.lua | 108 +++++------------------- LuaLibs/MachiningLib.lua | 8 +- Strategies/Standard/STR0006/STR0006.lua | 18 ++-- 3 files changed, 37 insertions(+), 97 deletions(-) diff --git a/LuaLibs/FeatureLib.lua b/LuaLibs/FeatureLib.lua index 2209caa..479ca54 100644 --- a/LuaLibs/FeatureLib.lua +++ b/LuaLibs/FeatureLib.lua @@ -211,14 +211,13 @@ end ------------------------------------------------------------------------------------------------------------- function FeatureLib.GetAdditionalInfo( Proc, Part) - -- se foro calcolo altri dati + Proc.FeatureInfo = {} + -- se foro 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, Proc.idAddAuxGeom = FeatureLib.GetDoveTailTenonData( Proc) - elseif ID.IsTenon( Proc) then - Proc.dTLength, Proc.dTMaxDist, Proc.vtTNormal, Proc.ptTCenter, Proc.idAddAuxGeom = FeatureLib.GetTenonData( Proc) + Proc.FeatureInfo = FeatureLib.GetDrillingData( Proc) + -- se tenone o tenone a coda di rondine + elseif ID.IsTenon( Proc) or ID.IsDovetailTenon( Proc) then + Proc.FeatureInfo = FeatureLib.GetTenonData( Proc) end return Proc @@ -228,6 +227,7 @@ end -- Recupero dati foro e adattamento se speciale function FeatureLib.GetDrillingData( Proc) local AuxId = EgtGetInfo( Proc.id, 'AUXID', 'i') + local FeatureExtraInfo = {} -- verifico se foro da adattare if EgtExistsInfo( Proc.id, 'DiamUser') then @@ -237,17 +237,19 @@ function FeatureLib.GetDrillingData( Proc) end end - local dDiam = EgtGetInfo( Proc.id, 'P12', 'd') or 0 - local dLen = abs( EgtCurveThickness( Proc.id + AuxId)) or 0 - local nFcs = EgtGetInfo( Proc.id, 'FCS', 'i') or 0 - local nFce = EgtGetInfo( Proc.id, 'FCE', 'i') or 0 + FeatureExtraInfo.dDrillDiam = EgtGetInfo( Proc.id, 'P12', 'd') or 0 + FeatureExtraInfo.dDrillLen = abs( EgtCurveThickness( Proc.id + AuxId)) or 0 + FeatureExtraInfo.nDrillFcs = EgtGetInfo( Proc.id, 'FCS', 'i') or 0 + FeatureExtraInfo.nDrillFce = EgtGetInfo( Proc.id, 'FCE', 'i') or 0 - return dDiam, dLen, nFcs, nFce + return FeatureExtraInfo end + ------------------------------------------------------------------------------------------------------------- --- Recupero dati tenone +-- Recupero dati tenone e tenone a coda di rondine function FeatureLib.GetTenonData( Proc) + local FeatureExtraInfo = {} -- recupero e verifico l'entità curva local idAux = EgtGetInfo( Proc.id, 'AUXID', 'i') if idAux then idAux = idAux + Proc.id end @@ -285,71 +287,17 @@ function FeatureLib.GetTenonData( Proc) end end if not dMaxDist then - local b3TenAux = EgtGetBBoxRef( idAux, GDB_BB.STANDARD, frTen) - dMaxDist = 2 * ( b3Ten:getRadius() - b3TenAux:getRadius()) + local b3TenonAux = EgtGetBBoxRef( idAux, GDB_BB.STANDARD, frTen) + dMaxDist = 2 * ( b3Ten:getRadius() - b3TenonAux:getRadius()) end - Proc.dTLength = dTenH - Proc.dTMaxDist = dMaxDist - Proc.vtTNormal = vtExtr - Proc.ptTCenter = ptC - Proc.idAddAuxGeom = idAux + FeatureExtraInfo.dTenonLength = dTenH + FeatureExtraInfo.dTenonMaxDist = dMaxDist + FeatureExtraInfo.vtTenonN = vtExtr + FeatureExtraInfo.ptTenonCenter = ptC + FeatureExtraInfo.idAddAuxGeom = idAux - return Proc.dTLength, Proc.dTMaxDist, Proc.vtTNormal, Proc.ptTCenter, Proc.idAddAuxGeom - -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 - Proc.idAddAuxGeom = idAux - - return Proc.dDTLength, Proc.dDTMaxDist, Proc.vtDTNormal, Proc.ptDTCenter, Proc.idAddAuxGeom + return FeatureExtraInfo end @@ -518,16 +466,6 @@ 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 - ------------------------------------------------------------------------------------------------------------- function FeatureLib.GetFeatureVolume( Proc, Part) local dProcVolume = 0 diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 2fb09bd..6d43de1 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -242,7 +242,7 @@ function MachiningLib.FindMill( Proc, ToolSearchParameters) -- calcolo riduzione del massimo materiale utilizzabile local ToolEntryAngle = GetToolEntryAngle( Proc, ToolSearchParameters.vtToolDirection) -- se ToolHolder più grande dell'utensile, il primo oggetto in collisione è il ToolHolder. Altrimenti il motore. - local dDimObjToCheck = EgtIf( TOOLS[i].ToolHolder.dDiameter > TOOLS[i].dDiameter, TOOLS[i].ToolHolder.dDiameter, BeamData.C_SIMM_ENC) + local dDimObjToCheck = EgtIf( TOOLS[i].ToolHolder.dDiameter > TOOLS[i].dDiameter, TOOLS[i].ToolHolder.dDiameter, TOOLS[i].SetupInfo.dCAxisEncumbrance) local dCurrentMaxMatReduction = BeamData.COLL_SIC or 5 -- TODO implementare le funzioni di Tool Collision Avoidance (vedi wiki e FacesBysaw -> CalcLeadInOutPerpGeom) @@ -603,6 +603,12 @@ function MachiningLib.AddOperations( vProc, Part, sRotation) end EgtSetMachiningGeometry( Geometry) + -- si scrive info pezzo e feature su geometria lavorazione + if Geometry then + EgtSetInfo( Geometry, 'CUTID', MACHININGS[i].Proc.idCut) + EgtSetInfo( Geometry, 'TASKID', MACHININGS[i].Proc.idTask) + end + -- impostazione parametri lavorazione -- TODO scrivere sempre Steps, LeadIn, LeadOut nelle tabelle in modo da non dover controllare ogni volta che ci siano for k = 1, #MachiningParameters do diff --git a/Strategies/Standard/STR0006/STR0006.lua b/Strategies/Standard/STR0006/STR0006.lua index ebcc5e3..9bd22c9 100644 --- a/Strategies/Standard/STR0006/STR0006.lua +++ b/Strategies/Standard/STR0006/STR0006.lua @@ -66,15 +66,15 @@ function STR0006.Make( bAddMachining, Proc, Part, CustomParameters) Milling.bIsApplicable = false -- se tenone in testa oppure se di coda ma è possibile lavorare dopo separazione if not( Proc.AffectedFaces.bLeft) or bCanMoveAfterSplit then - ToolSearchParameters.dElevation = Proc.dTLength - ToolSearchParameters.vtToolDirection = Proc.vtTNormal + ToolSearchParameters.dElevation = Proc.FeatureInfo.dTenonLength + ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtTenonN Milling.ToolInfo = {} Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters) Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill') if Milling.ToolInfo.nToolIndex then Milling.bIsApplicable = true -- calcolo passate necessarie - nMillingPathsNeeded = ceil( Proc.dTMaxDist / TOOLS[Milling.ToolInfo.nToolIndex].dSideStep) + nMillingPathsNeeded = ceil( Proc.FeatureInfo.dTenonMaxDist / TOOLS[Milling.ToolInfo.nToolIndex].dSideStep) local ParametersMRR = {} ParametersMRR.nToolIndex = Milling.ToolInfo.nToolIndex Milling.dMRR = MachiningLib.GetToolMRR( ParametersMRR) @@ -115,11 +115,7 @@ function STR0006.Make( bAddMachining, Proc, Part, CustomParameters) 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.ptTCenter, Proc.vtTNormal, Part.b3Part, GDB_RT.GLOB) - if idTenonCutPlane then - EgtSetName( idTenonCutPlane, 'AddCut_' .. tostring( Proc.id)) - EgtSetInfo( idTenonCutPlane, 'TASKID', Proc.idTask) - end + local idTenonCutPlane = EgtSurfTmPlaneInBBox( nAddGrpId, Proc.FeatureInfo.ptTenonCenter, Proc.FeatureInfo.vtTenonN, Part.b3Part, GDB_RT.GLOB) -- taglio in lunghezza sul tenone if Cutting.bIsApplicable then @@ -177,7 +173,7 @@ function STR0006.Make( bAddMachining, Proc, Part, CustomParameters) if nMillingPathsNeeded <= Strategy.Parameters.nMaxMillingPaths then else -- aggiungo geometria - Milling.Geometry = {{ Proc.idAddAuxGeom, -1}} + Milling.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, -1}} Milling.nToolIndex = Milling.ToolInfo.nToolIndex Milling.nType = MCH_MY.MILLING Milling.vtToolDirection = Proc.vtTNormal @@ -201,7 +197,7 @@ function STR0006.Make( bAddMachining, Proc, Part, CustomParameters) 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.dTLength, 1)) .. ';' + Milling.sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( Proc.FeatureInfo.dTenonLength, 1)) .. ';' -- TODO calcolare SCC @@ -211,7 +207,7 @@ function STR0006.Make( bAddMachining, Proc, Part, CustomParameters) -- il primo è il passaggio più esterno local nIndexClones = nMillingPathsNeeded - i + 1 -- suddivido step in base al numero passate da fare - local dRealSideStep = floor( Proc.dTMaxDist / nMillingPathsNeeded) + local dRealSideStep = floor( Proc.FeatureInfo.dTenonMaxDist / nMillingPathsNeeded) -- cambia solo sovrmateriale radiale AuxiliaryData.Clones[nIndexClones] = {} AuxiliaryData.Clones[nIndexClones].dRadialOffset = ( i - 1) * dRealSideStep