From 0e4aeb49b812fa4747901ecc76f546ae84a8331d Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Wed, 3 Sep 2025 09:15:02 +0200 Subject: [PATCH] =?UTF-8?q?-=20In=20STR0001=20aggiunta=20lavorazione=20ti?= =?UTF-8?q?=20riduzione=20tenone=20in=20caso=20di=20P14>0=20-=20Aggiornata?= =?UTF-8?q?=20gestione=20in=20BCS=20per=20Essetre=20-=20Aggiunta=20funzion?= =?UTF-8?q?e=20che=20verifica=20se=20un=20punto=20si=20trova=20su=20estrem?= =?UTF-8?q?it=C3=A0=20box=20del=20pezzo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/BasicCustomerStrategies.lua | 9 ++- LuaLibs/BeamLib.lua | 22 +++++--- Strategies/Standard/STR0001/STR0001.lua | 74 ++++++++++++++++++++++++- 3 files changed, 95 insertions(+), 10 deletions(-) diff --git a/LuaLibs/BasicCustomerStrategies.lua b/LuaLibs/BasicCustomerStrategies.lua index 94b1624..fe63b71 100644 --- a/LuaLibs/BasicCustomerStrategies.lua +++ b/LuaLibs/BasicCustomerStrategies.lua @@ -492,7 +492,7 @@ local function GetTools_Essetre( Proc, sMachiningCategory) -- CATEGORIE PREVISTE : -- Cutting -- Drill - -- Milling, MillingFinish, MillingAntiSplint + -- Milling, MillingFinish, MillingAntiSplint, MillingChamfer -- Pocketing -- ChainSawing @@ -521,7 +521,12 @@ local function GetTools_Essetre( Proc, sMachiningCategory) elseif ID.IsTenon( Proc) then TagList = { 'Tenon'} elseif ID.IsDovetailTenon( Proc) then - TagList = { 'DtTenon'} + -- gestione passaggio di taglio tenone superiore in caso di P14>0. Si prendono le frese per tenone standard dato che serve fresa cilindrica + if sMachiningCategory == 'MillingFinish' then + TagList = { 'Tenon'} + else + TagList = { 'DtTenon'} + end elseif ID.IsDovetailMortise( Proc) then TagList = { 'DtMortise'} elseif ID.IsHeadConcaveProfile( Proc) or ID.IsHeadConvexProfile( Proc) or ID.IsHeadCamberedProfile( Proc) or ID.IsRoundArch( Proc) or ID.IsHeadProfile( Proc) then diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 604bdd0..c7897a5 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -118,6 +118,19 @@ function BeamLib.AddPhaseWithRawParts( idRaw, OriXR, PosXR, dDeltaSucc) end end +--------------------------------------------------------------------- +function BeamLib.IsPointOnBoxLimit( ptPointToCheck, b3Solid) + local bOnBoxLimit = false + if abs( ptPointToCheck:getX() - b3Solid:getMax():getX()) < 100 * GEO.EPS_SMALL or + abs( ptPointToCheck:getX() - b3Solid:getMin():getX()) < 100 * GEO.EPS_SMALL or + abs( ptPointToCheck:getY() - b3Solid:getMax():getY()) < 100 * GEO.EPS_SMALL or + abs( ptPointToCheck:getY() - b3Solid:getMin():getY()) < 100 * GEO.EPS_SMALL or + abs( ptPointToCheck:getZ() - b3Solid:getMax():getZ()) < 100 * GEO.EPS_SMALL or + abs( ptPointToCheck:getZ() - b3Solid:getMin():getZ()) < 100 * GEO.EPS_SMALL then + bOnBoxLimit = true + end + return bOnBoxLimit +end --------------------------------------------------------------------- function BeamLib.SetOpenSide( nPathInt, b3Solid) -- fondo tra loro le curve compatibili @@ -130,14 +143,9 @@ function BeamLib.SetOpenSide( nPathInt, b3Solid) -- se segmento di retta if EgtCurveCompoRadius( nPathInt, i) == -1 then -- verifico se giace in uno dei piani limite del pezzo quindi se è un lato aperto - local ptIni = EgtUP( nPathInt, i, GDB_RT.GLOB) + local ptIni = EgtUP( nPathInt, i, GDB_RT.GLOB) local ptFin = EgtUP( nPathInt, i + 1, GDB_RT.GLOB) - if ( abs( ptIni:getX() - b3Solid:getMax():getX()) < 100 * GEO.EPS_SMALL and abs( ptFin:getX() - b3Solid:getMax():getX()) < 100 * GEO.EPS_SMALL) or - ( abs( ptIni:getX() - b3Solid:getMin():getX()) < 100 * GEO.EPS_SMALL and abs( ptFin:getX() - b3Solid:getMin():getX()) < 100 * GEO.EPS_SMALL) or - ( abs( ptIni:getY() - b3Solid:getMax():getY()) < 100 * GEO.EPS_SMALL and abs( ptFin:getY() - b3Solid:getMax():getY()) < 100 * GEO.EPS_SMALL) or - ( abs( ptIni:getY() - b3Solid:getMin():getY()) < 100 * GEO.EPS_SMALL and abs( ptFin:getY() - b3Solid:getMin():getY()) < 100 * GEO.EPS_SMALL) or - ( abs( ptIni:getZ() - b3Solid:getMax():getZ()) < 100 * GEO.EPS_SMALL and abs( ptFin:getZ() - b3Solid:getMax():getZ()) < 100 * GEO.EPS_SMALL) or - ( abs( ptIni:getZ() - b3Solid:getMin():getZ()) < 100 * GEO.EPS_SMALL and abs( ptFin:getZ() - b3Solid:getMin():getZ()) < 100 * GEO.EPS_SMALL) then + if BeamLib.IsPointOnBoxLimit( ptIni, b3Solid) and BeamLib.IsPointOnBoxLimit( ptFin, b3Solid) then -- aggiorno il vettore dei lati aperti table.insert( vOpen, i) end diff --git a/Strategies/Standard/STR0001/STR0001.lua b/Strategies/Standard/STR0001/STR0001.lua index b53da60..6574301 100644 --- a/Strategies/Standard/STR0001/STR0001.lua +++ b/Strategies/Standard/STR0001/STR0001.lua @@ -15,6 +15,20 @@ local BladeToWaste = require('BLADETOWASTE') local STR0001 = {} local Strategy = {} + +------------------------------------------------------------------------------------------------------------- +local function GetSCC( Machining) + local nSCC + + if Machining.vtToolDirection:getX() > 0 then + nSCC = MCH_SCC.ADIR_XP + else + nSCC = MCH_SCC.ADIR_XM + end + + return nSCC +end + ------------------------------------------------------------------------------------------------------------- local function GetTenonStrategy( Proc, Part) local Machining = {} @@ -149,7 +163,7 @@ local function GetTenonStrategy( Proc, Part) Machining.Milling.sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( Proc.FeatureInfo.dTenonLength, 1)) .. ';' - -- TODO calcolare SCC + Machining.Milling.nSCC = GetSCC( Machining.Milling) -- passate con sovramateriale Machining.nMillingPathsNeeded = ceil( Proc.FeatureInfo.dTenonMaxDist / TOOLS[Machining.Milling.ToolInfo.nToolIndex].dSideStep) @@ -339,6 +353,64 @@ function STR0001.Make( bAddMachining, Proc, Part, CustomParameters) -- aggiunge lavorazione bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, Strategy.Machining.Milling, Strategy.Machining.Milling.AuxiliaryData) end + + -- controllo se serve passaggio di finitura in caso il tenone non cominci dal bordo della trave (P14 > 0) + if abs( Proc.FeatureInfo.vtTenonN * EgtSurfTmFacetNormVersor( Proc.id, Proc.nFct-1, GDB_ID.ROOT)) < GEO.EPS_ANG_SMALL then + -- verifico che entrambi i punti iniziale e finale della curva no giacciano in uno dei piani limite del pezzo, quindi se è un lato aperto + local ptIni = EgtSP( Proc.FeatureInfo.idAddAuxGeom, GDB_RT.GLOB) + local ptFin = EgtEP( Proc.FeatureInfo.idAddAuxGeom, GDB_RT.GLOB) + -- se entrambi i punti non sono sul limite pezzo + if not( BeamLib.IsPointOnBoxLimit( ptIni, Part.b3Part) and BeamLib.IsPointOnBoxLimit( ptFin, Part.b3Part)) then + -- cerco utensile + local ToolSearchParameters = {} + local FinishMach = {} + ToolSearchParameters.dElevation = Proc.FeatureInfo.dTenonLength + ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtTenonN + ToolSearchParameters.sMillShape = 'STANDARD' + ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sMillingList, 'MillingFinish') + FinishMach.ToolInfo = {} + FinishMach.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters) + if FinishMach.ToolInfo.nToolIndex then + + -- aggiungo geometria e imposto tutti i dati + FinishMach.Geometry = {{ Proc.id, Proc.nFct-1}} + FinishMach.nToolIndex = FinishMach.ToolInfo.nToolIndex + FinishMach.nType = MCH_MY.MILLING + FinishMach.vtToolDirection = Proc.FeatureInfo.vtTenonN + FinishMach.sDepth = 'TH' + + -- LeadIn / LeadOut + FinishMach.LeadIn = {} + FinishMach.LeadOut = {} + FinishMach.LeadIn.nType = MCH_MILL_LI.TANGENT + FinishMach.LeadOut.nType = MCH_MILL_LI.TANGENT + FinishMach.LeadIn.dTangentDistance = TOOLS[FinishMach.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC + FinishMach.LeadIn.dPerpDistance = TOOLS[FinishMach.ToolInfo.nToolIndex].dSideStep + FinishMach.LeadOut.dTangentDistance = TOOLS[FinishMach.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC + FinishMach.LeadOut.dPerpDistance = TOOLS[FinishMach.ToolInfo.nToolIndex].dSideStep + + if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then + FinishMach.sStage = 'AfterTail' + end + + -- sistemo il lato e la direzione di lavoro + FinishMach.bInvert = EgtIf( TOOLS[FinishMach.ToolInfo.nToolIndex].bIsCCW, false, true) + FinishMach.nWorkside = EgtIf( TOOLS[FinishMach.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT) + + FinishMach.sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( Proc.FeatureInfo.dTenonLength, 1)) .. ';' + + FinishMach.nSCC = GetSCC( FinishMach) + + -- imposto utilizzo faccia (--TODO verificare se serve riconoscere il lato specifico) + local nOrthoOpposite = BeamLib.GetNearestParalOpposite( Proc.FeatureInfo.vtTenonN, Proc.FeatureInfo.vtTenonN) + FinishMach.nFaceuse = nOrthoOpposite + + -- aggiunge lavorazione + bAreAllMachiningsAdded = bAreAllMachiningsAdded and MachiningLib.AddMachinings( Proc, FinishMach) + end + end + end + end end return bAreAllMachiningsAdded, Strategy.Result