From 4c19cc49e2934ddeeb76fbd3635f552193604801 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 10 Dec 2024 09:49:10 +0100 Subject: [PATCH] - in LapJoint modifiche per gestione fresa a disco su aggregato - in BeamLib aggiunta funzione GetToolFromMachining estrapolata da SawPlusChain --- LuaLibs/BeamLib.lua | 39 +++++++++++++++++++++++++++ LuaLibs/ProcessLapJoint.lua | 53 +++++++++++++------------------------ 2 files changed, 57 insertions(+), 35 deletions(-) diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 747a16b..100d81f 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -1335,5 +1335,44 @@ function BeamLib.IsCutNeeded( Proc, b3Raw, dOvmHead, dOvmTail) return true end +------------------------------------------------------------------------------------------------------------- +function BeamLib.GetToolFromMachining( sMachiningName) + local Tool = {} + if EgtMdbSetCurrMachining( sMachiningName) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + Tool.Name = EgtTdbGetCurrToolParam( MCH_TP.NAME) + Tool.IsCCW = ( EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0) + Tool.Type = EgtTdbGetCurrToolParam( MCH_TP.TYPE) + Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0 + -- lama + if Tool.Type == MCH_TY.SAW_STD or Tool.Type == MCH_TY.SAW_FLAT then + Tool.Thickness = EgtTdbGetCurrToolParam(MCH_TP.THICK) or 0 + Tool.MaxDepth = EgtTdbGetCurrToolMaxDepth() or 0 + Tool.SideStep = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDESTEP', 'd') + -- sega a catena + elseif Tool.Type == MCH_TY.MORTISE_STD then + Tool.Length = EgtTdbGetCurrToolParam( MCH_TP.LEN) or 0 + Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or 0 + Tool.Width = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0 + Tool.Thickness = EgtTdbGetCurrToolParam( MCH_TP.THICK) or 0 + Tool.CornerRadius = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD) or 0 + -- fresa (TODO al momento aggiunte solo le informazioni che servono) + elseif Tool.Type == MCH_TY.MILL_STD or MCH_TY.MILL_NOTIP then + if BD.GetSetupInfo then + Tool.IsOnAggregate = BD.GetSetupInfo( EgtTdbGetCurrToolParam( MCH_TP.HEAD)) + else + Tool.IsOnAggregate = false + end + -- altri utensili al momento non previsti + else + error( 'Wrong tool type') + end + end + end + + return Tool +end + ------------------------------------------------------------------------------------------------------------- return BeamLib \ No newline at end of file diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index c3820e0..ac70220 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -5038,38 +5038,6 @@ function SawPlusChain.GetLongFaceEdges( Proc, Face) end -function SawPlusChain.GetToolFromMachining( sMachiningName) - local Tool = {} - if EgtMdbSetCurrMachining( sMachiningName) then - local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) - if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then - Tool.Name = EgtTdbGetCurrToolParam( MCH_TP.NAME) - Tool.IsCCW = ( EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0) - Tool.Type = EgtTdbGetCurrToolParam( MCH_TP.TYPE) - Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0 - -- lama - if Tool.Type == MCH_TY.SAW_STD or Tool.Type == MCH_TY.SAW_FLAT then - Tool.Thickness = EgtTdbGetCurrToolParam(MCH_TP.THICK) or 0 - Tool.MaxDepth = EgtTdbGetCurrToolMaxDepth() or 0 - Tool.SideStep = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDESTEP', 'd') - -- sega a catena - elseif Tool.Type == MCH_TY.MORTISE_STD then - Tool.Length = EgtTdbGetCurrToolParam( MCH_TP.LEN) or 0 - Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or 0 - Tool.Width = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0 - Tool.Thickness = EgtTdbGetCurrToolParam( MCH_TP.THICK) or 0 - Tool.CornerRadius = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD) or 0 - -- altri utensili al momento non previsti - else - error( 'Wrong tool type') - end - end - end - - return Tool -end - - function SawPlusChain.CalculateLeadInOut( Machining, EdgeToMachine) -- TODO implementare le funzioni di Tool Collision Avoidance (vedi wiki e FacesBysaw -> CalcLeadInOutPerpGeom) @@ -5281,7 +5249,7 @@ function SawPlusChain.Saw.CalculateMachiningParameters( Proc, FaceToMachine, Edg end end Cutting.Type = MCH_OY.MILLING - Cutting.Tool = SawPlusChain.GetToolFromMachining( Cutting.Name) + Cutting.Tool = BL.GetToolFromMachining( Cutting.Name) -- verifica dimensioni tasca e direzione compatibili -- se tasca meno spessa della lama la strategia non è applicabile @@ -5479,7 +5447,7 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine EgtOutLog( Mortising.Message) end Mortising.Type = MCH_OY.MORTISING - Mortising.Tool = SawPlusChain.GetToolFromMachining( Mortising.Name) + Mortising.Tool = BL.GetToolFromMachining( Mortising.Name) -- in caso di tunnel da un lato permetto eventuale inversione lato di lavoro in caso di errori di applicazione (es: Outstroke) if Proc.Topology == 'Tunnel' and sMortisingType == 'OneSide' or sMortisingType == 'OneSideAndExtend' then @@ -5981,8 +5949,10 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa vtN, vtN2 = vtN2, vtN end end + -- informazioni utensile + local Tool = BL.GetToolFromMachining( sMilling) -- se lavorazione da sotto e lunga, va divisa in due metà - local bDouble = ( vtN:getZ() < -0.5 and dH > ( BD.MAX_LEN_BH_FROM_BOTTOM or 200) and not BD.TURN) + local bDouble = not Tool.IsOnAggregate and ( vtN:getZ() < -0.5 and dH > ( BD.MAX_LEN_BH_FROM_BOTTOM or 200) and not BD.TURN) -- inserisco la lavorazione di fresatura local sName = 'BHMill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchFId = EgtAddMachining( sName, sMilling) @@ -6050,6 +6020,19 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end end EgtSetMachiningParam( MCH_MP.SCC, nSCC) + -- impostazioni per fresa a disco su aggregato + if Tool.IsOnAggregate and AreSameVectorApprox( vtN, -Z_AX()) then + EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_RIGHT) + if bHeadDir then + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, 'B=-90') + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + else + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, 'B=90') + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) + EgtSetMachiningParam( MCH_MP.TOOLINVERT, false) + end + end -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError()