diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 53a4253..6cd5836 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -395,6 +395,8 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) Proc2.TaskId = Proc.TaskId Proc2.AdjId = Proc.AdjId Proc2.MainId = Proc.MainId + -- recupero l'elenco delle facce della parte interessate dalla feature + Proc2.AffectedFaces = BL.GetProcessAffectedFaces( Proc2) table.insert( vProc, Proc2) -- verifico se devo inserire i prefori if Drill.IsPredrillNeeded( Proc2) then @@ -2026,9 +2028,12 @@ function GetFeatureInfoAndDependency( vProc, b3Raw) local ProcB = vProc[j] -- verifico se feature tipo LapJoint è attraversata da almeno un foro if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove' or Mortise.Identify( Proc)) and Drill.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then - Proc.PassedByHole = true - ProcB.Dependency = {} - ProcB.Dependency.ExecBefore = Proc + -- se foro in coda non setto la dipendenza + if not ProcB.AffectedFaces.Left then + Proc.PassedByHole = true + ProcB.Dependency = {} + ProcB.Dependency.ExecBefore = Proc + end end -- verifico se feature tipo LapJoint è attraversata da almeno una mortasa a coda di rondine if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove') and DtMortise.SideIdentify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 747a16b..0d7e533 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)).bToolOnAggregate + 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/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index bada866..ef952a6 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -246,6 +246,12 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw return false end local bIsSawCCW = ( EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0) + -- se settato nelle note lavorazione si lavora in discordanza + EgtMdbSetCurrMachining( sCutting) + local sMachiningNotes = EgtMdbGetCurrMachiningParam( MCH_MP.USERNOTES) or '' + if ( EgtGetValInNotes( sMachiningNotes, 'PATHINVERT', 'd') or 0) == 1 then + bIsSawCCW = not bIsSawCCW + end local bInvert = bForceInvert -- l'inversione può essere comandata da rotazione lama (direzione concorde, legata anche a DownUp) oppure da direzione Z del percorso (si preferisce lavorare dal basso verso l'alto per limitare le corse) -- se c'è disaccordo tra rotazione e direzione si cambia il lato di lavoro, se possibile. Se ciò non è possbile comanda la direzione. Se percorso orizzontale comanda la rotazione. diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index c3820e0..ec931bf 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -418,7 +418,7 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill) -- se non feature BlockHausHalfLap e non abilitato parametro Q per lavorarlo di fianco e non macchina BH esco local nUseSideTool = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0 - if Proc.Prc ~= 37 and nUseSideTool == 0 and not BD.BH_MACHINE then + if Proc.Prc ~= 37 and not BD.BH_MACHINE and ( nUseSideTool == 0 or ( nUseSideTool == 4 and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right))) then return false end @@ -873,12 +873,25 @@ function ProcessLapJoint.Classify( Proc, b3Raw) end -- se è presente il rinvio angolare con lavorazioni di tasca ed è una tasca perfettamente verticale da sotto, non ruoto if BD.ANG_TRASM and Proc.Fct >= 4 and not bClosedOrthoFaces then - local vtNBottomFace = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) - if AreOppositeVectorApprox( vtNBottomFace, Z_AX()) and + if AreOppositeVectorApprox( Proc.Face[nFacInd + 1].VtN, Z_AX()) and ( Proc.Fct >= 5 and ML.FindPocketing( 'Pocket_AT') or ( Proc.Fct < 5 and ML.FindPocketing( 'OpenPocket_AT'))) then return true, false end end + -- se groove da sotto e possibile fresatura tipo SideMillAsBlade non ruoto + if Proc.AllRightAngles and ( Proc.Topology == 'Groove' or Proc.Topology == 'Pocket') and not( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back) and AreOppositeVectorApprox( Proc.Face[nFacInd + 1].VtN, Z_AX()) then + -- recupero gruppo per geometria addizionale + local nAddGrpId = BL.GetAddGroup( nPartId) + if not nAddGrpId then + local sErr = 'Error : missing AddGroup' + EgtOutLog( sErr) + return false, sErr + end + if VerifySideMillAsSaw( Proc, nAddGrpId, Proc.Face[nFacInd + 1].VtN, min( Proc.Face[nFacInd + 1].Height, Proc.Face[nFacInd + 1].Width) , Proc.Face[nFacInd + 1].Elevation) then + Proc.OkFromBottom = true + return true, false + end + end -- se scanalatura chiusa lavoro la faccia di fondo if Proc.Topology == 'Pocket' and ( Proc.IsParallel or Proc.AllRightAngles) and not bClosedOrthoFaces then nFacInd = Topology.GetFacesWithGivenAdjacencyNumber( Proc, nil, 4)[1] @@ -922,7 +935,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw) local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc)) -- se forzata la lavorazione con fresa di lato da parametro Q03=2/3 non devo ruotare local nSideRoughTool = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'd') - local bForceSideMill = ( ( nSideRoughTool == 2 or nSideRoughTool == 3) and ( Proc.Fct == 3 or Proc.Fct == 4)) + local bForceSideMill = ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back) and ( nSideRoughTool == 2 or nSideRoughTool == 3) and ( Proc.Fct == 3 or Proc.Fct == 4) if bForceSideMill then bDown = false elseif nFacInd2 and dElev2 < 160 and dElev2 < 2 * dElev then @@ -5038,38 +5051,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 +5262,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 +5460,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 @@ -5963,7 +5944,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local bIsL = ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2) -- se parametro Q03=2 forzo la fresatura di lato; con Q03=3 forzo solo se la faccia di lavoro non è rivolta verso l'alto +/-10°; per rabbet che guardano in giù sempre fresatura di lato local bIsRabbetAlongXTowardsBottom = ( Proc.TopologyLongName == 'Rabbet-Through-RightAngles-Parallel-2' and ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back) and Proc.AffectedFaces.Bottom and Proc.AffectedFaces.Left and Proc.AffectedFaces.Right) - local bForceSideMill = bIsRabbetAlongXTowardsBottom or ( ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 2 or ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 3 and vtN:getZ() < 0.985)) and ( ( Proc.Fct == 4 and ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back)) or Proc.Fct == 3 or Proc.Fct == 2)) + local bForceSideMill = ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back) and ( bIsRabbetAlongXTowardsBottom or ( ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 2 or ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 3 and vtN:getZ() < 0.985)) and ( ( Proc.Fct == 4 and ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back)) or Proc.Fct == 3 or Proc.Fct == 2))) -- se fattibile con fresa BH di fianco e spessore utensile inferiore alla larghezza faccia local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill) if bPrevBhSideMill == nil then @@ -5981,8 +5962,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 +6033,22 @@ 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 then + if AreSameVectorApprox( vtN, -Z_AX()) then + EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_RIGHT) + EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) + if bHeadDir then + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + else + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) + EgtSetMachiningParam( MCH_MP.TOOLINVERT, false) + end + else + EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) + end + end -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() @@ -6209,7 +6208,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa if BD.ANG_TRASM and Proc.Fct >= 4 and AreOppositeVectorApprox( vtN, Z_AX()) then bLapJointAngTrasm = true -- se orientata verso il basso e non c'è testa da sotto, verifico l'alternativa - elseif vtN:getZ() < BD.NZ_MINA and not BD.DOWN_HEAD and nFacInd2 then + elseif vtN:getZ() < BD.NZ_MINA and not BD.DOWN_HEAD and nFacInd2 and not Proc.OkFromBottom then ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT) nFacInd, nFacInd2 = nFacInd2, nFacInd dFacElev, dFacElev2 = dFacElev2, dFacElev @@ -6217,7 +6216,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end -- verifico non sia orientata verso il basso o ci sia una testa dal basso o la lavorazione sia dal lato. local bFaceDown = ( vtN:getZ() < BD.NZ_MINA) - if bFaceDown and not BD.DOWN_HEAD and not BD.TURN and not bForceSideMill and not bLapJointAngTrasm then + if bFaceDown and not BD.DOWN_HEAD and not BD.TURN and not bForceSideMill and not bLapJointAngTrasm and not Proc.OkFromBottom then local sErr = 'Error : LapJoint from bottom impossible' EgtOutLog( sErr) return false, sErr @@ -7027,7 +7026,7 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) for i = 1, #vAddId do local b3Box = EgtGetBBoxGlob( vAddId[i], GDB_BB.STANDARD) local nFct = EgtSurfTmFacetCount( vAddId[i]) - local AddProc = { Id = vAddId[i], Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Box, TotBox = Proc.Box, Fct = nFct, Flg = Proc.Flg, PartId = Proc.PartId, TaskId = Proc.TaskId, FeatureId = Proc.FeatureId, IsSplittedLapJoint = true, AffectedFaces = Proc.AffectedFaces} + local AddProc = { Id = vAddId[i], Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Box, TotBox = Proc.Box, Fct = nFct, Flg = Proc.Flg, PartId = Proc.PartId, TaskId = Proc.TaskId, FeatureId = Proc.FeatureId, IsSplittedLapJoint = true, AffectedFaces = Proc.AffectedFaces, OkFromBottom = Proc.OkFromBottom} Topology.Classify( AddProc, b3Raw) -- lasciare il false nel sesto parametro (perchè internamente viene verificato se diverso da nil) local bOk, sMyWarn @@ -7308,6 +7307,9 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) if Proc.Prc == 30 or Proc.Prc == 20 then local nBladeAntisplint = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') or 0 local nUseRoughToolOnSide = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0 + if nUseRoughToolOnSide == 4 and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right) then + nUseRoughToolOnSide = 0 + end nForceUseBladeOnNotContinueFace = EgtGetInfo( Proc.Id, Q_BLADE_ON_ALONG_FACE, 'i') or 0 -- se antischeggia di fresa o abilitato sgrossatore di fianco if nBladeAntisplint == 2 or nUseRoughToolOnSide > 0 then diff --git a/UpdateLog.txt b/UpdateLog.txt index eb617d3..634329d 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,5 +1,13 @@ ==== Beam Update Log ==== +Versione 2.7a1 (01/07/2025) +- Added : in LapJoint abiitata SideMillAsBlade anche da sotto e varie migliorie +- Modif : in LapJoint aggiunta Q_SIDE_ROUGH_TOOL=4 per lavorare con fresa evitando tasche aperte testa/coda +- Modif : in LapJoint modifiche per gestione fresa a disco su aggregato +- Modif : in fresature con lama o simili aggiunta la possibilità di invertire il senso di percorrenza calcolato in automatico +- Modif : migliorie all'ordinamento +- Fixed : in LapJoint la Q per forzare lavorazione di lato funziona solo se la feature è aperta davnti o dietro + Versione 2.6l1 (11/12/2024) - Added : aggiunta gestione slot e tagli di lama con lame molto grandi - Modif : in lama + motosega aggiunta gestione slot aperte con lato obliquo diff --git a/Version.lua b/Version.lua index db5bd2d..65f3ac2 100644 --- a/Version.lua +++ b/Version.lua @@ -2,5 +2,5 @@ -- Gestione della versione di Beam NAME = 'Beam' -VERSION = '2.6l1' +VERSION = '2.7a1' MIN_EXE = '2.6e5'