diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index f013fe2..ed176f6 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -356,16 +356,16 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, end if ( BEAM and BEAM.BW) or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then _, sType = EgtEndsWith( sType, '_H2') - elseif ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bDownHead then + elseif not ( BEAM and BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bDownHead then if not EgtEndsWith( sType, '_H2') then sType = sType .. '_H2' end end local MachineHeadUse = MachineHeadType - if not BEAM or not BEAM.BW then + if not ( BEAM and BEAM.BW) and MachineHeadUse == TWO_EQUAL_HEADS then MachineHeadUse = ONE_HEAD end - if BEAM and BEAM.BW and MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then + if MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then -- se posso usare entrambe le teste, la gestisco come una macchina a due teste da sopra MachineHeadUse = TWO_EQUAL_HEADS end @@ -374,7 +374,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, for i = ForStart, ForEnd, ForStep do local Machining = Machinings[i] local sMachiningType = Machining.Type - if BEAM and BEAM.BW then + if ( BEAM and BEAM.BW) or MachineHeadUse == TWO_EQUAL_HEADS then _, sMachiningType = EgtEndsWith( Machining.Type, '_H2') end -- recupero dati utensile diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index cb3faf8..46fab69 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -4617,8 +4617,6 @@ end -- TODO gestione messaggi in funzione apposita (almeno per append) --- TODO gestire topologia tunnel (anche da due lati) - local SawPlusChain = {} SawPlusChain.Saw = {} SawPlusChain.Chainsaw = {} @@ -4681,6 +4679,7 @@ function SawPlusChain.GetTunnelFaces( Proc) if TunnelAddedFaces.MiddleFaceTm.Height > TunnelAddedFaces.MiddleFaceTm.Width then TunnelAddedFaces.MiddleFaceTm.Height, TunnelAddedFaces.MiddleFaceTm.Width = TunnelAddedFaces.MiddleFaceTm.Width, TunnelAddedFaces.MiddleFaceTm.Height end + TunnelAddedFaces.MiddleFaceTm.Type = 'Tunnel' return TunnelAddedFaces end @@ -4712,6 +4711,7 @@ function SawPlusChain.GetBottomFace( Proc) end BottomFace.Id = nBottomFace + BottomFace.Type = 'Bottom' BottomFace.Width = Proc.Face[nBottomFace + 1].Width BottomFace.Height = Proc.Face[nBottomFace + 1].Height BottomFace.Elevation = Proc.Face[nBottomFace + 1].Elevation @@ -4725,6 +4725,7 @@ end function SawPlusChain.GetLongFace( Proc) + local LongFace = {} if not Proc.MainFaces.BottomFace or not Proc.MainFaces.BottomFace.Id then Proc.MainFaces.BottomFace = SawPlusChain.GetBottomFace( Proc) end @@ -4746,10 +4747,10 @@ function SawPlusChain.GetLongFace( Proc) end -- si sceglie la più grande (tunnel) o quella adiacente sul lato lungo - local LongFace = {} LongFace.Id = FacesToAnalyze[1].Id for i = 1, Proc.Fct do if LongFace.Id == Proc.Face[i].Id then + LongFace.Type = 'Long' LongFace.Width = Proc.Face[i].Width LongFace.Height = Proc.Face[i].Height LongFace.Elevation = Proc.Face[i].Elevation @@ -4760,8 +4761,6 @@ function SawPlusChain.GetLongFace( Proc) end end - LongFace.Edges = SawPlusChain.GetLongFaceEdges( Proc, LongFace) - return LongFace end @@ -4799,6 +4798,7 @@ function SawPlusChain.GetSideFaces( Proc) ( bIsLongFaceTheLargest and i > 2) then table.insert( SideFaces, FacesToAnalyze[i]) SideFaces[#SideFaces].Id = FacesToAnalyze[i].Id + SideFaces[#SideFaces].Type = 'Side' SideFaces[#SideFaces].Width = Proc.Face[FacesToAnalyze[i].Id + 1].Width SideFaces[#SideFaces].Height = Proc.Face[FacesToAnalyze[i].Id + 1].Height SideFaces[#SideFaces].Elevation = Proc.Face[FacesToAnalyze[i].Id + 1].Elevation @@ -4813,6 +4813,51 @@ function SawPlusChain.GetSideFaces( Proc) end +function SawPlusChain.GetBottomFaceEdges( Proc, Face) + local Edges = {} + Edges.SideEdges = {} + Edges.LongEdges = {} + + local nFaceType, vEdges = EgtSurfTmGetFacetOutlineInfo( Proc.Id, Face.Id, GDB_ID.ROOT) + if nFaceType < 1 then + for j = 1, #vEdges do + local nPreviousEdgeIndex = j - 1 + if j == 1 then + nPreviousEdgeIndex = #vEdges + end + local nNextEdgeIndex = j + 1 + if j == #vEdges then + nNextEdgeIndex = 1 + end + + local CurrentEdge = {} + CurrentEdge.AdjacentFaceId = vEdges[j].Adj + CurrentEdge.ToolDirection = Vector3d( vEdges[j].Norm) + CurrentEdge.Length = vEdges[j].Len + CurrentEdge.Elevation = vEdges[j].Elev + CurrentEdge.IsOpen = vEdges[j].Open + CurrentEdge.IsStartOpen = ( vEdges[nPreviousEdgeIndex].Open) + CurrentEdge.IsEndOpen = ( vEdges[nNextEdgeIndex].Open) + + if CurrentEdge.AdjacentFaceId == Proc.MainFaces.LongFace.Id then + table.insert( Edges.LongEdges, CurrentEdge) + Edges.LongEdges[#Edges.LongEdges].Type = 'Long' + elseif vEdges[nNextEdgeIndex].Adj == Proc.MainFaces.LongFace.Id or vEdges[nPreviousEdgeIndex].Adj == Proc.MainFaces.LongFace.Id then + table.insert( Edges.SideEdges, CurrentEdge) + Edges.SideEdges[#Edges.SideEdges].Type = 'Side' + else + table.insert( Edges.LongEdges, CurrentEdge) + Edges.LongEdges[#Edges.LongEdges].Type = 'Long' + end + end + else + error( 'Face with closed hole') + end + + return Edges +end + + function SawPlusChain.GetLongFaceEdges( Proc, Face) local Edges = {} Edges.SideEdges = {} @@ -4848,12 +4893,16 @@ function SawPlusChain.GetLongFaceEdges( Proc, Face) else if CurrentEdge.AdjacentFaceId == Proc.MainFaces.BottomFace.Id then Edges.BottomEdge = CurrentEdge + Edges.BottomEdge.Type = 'Bottom' elseif vEdges[nNextEdgeIndex].Adj == Proc.MainFaces.BottomFace.Id then Edges.SideEdges.StartEdge = CurrentEdge + Edges.SideEdges.StartEdge.Type = 'Side' elseif vEdges[nPreviousEdgeIndex].Adj == Proc.MainFaces.BottomFace.Id then Edges.SideEdges.EndEdge = CurrentEdge + Edges.SideEdges.EndEdge.Type = 'Side' else table.insert( Edges.OppositeEdges, CurrentEdge) + Edges.OppositeEdges[#Edges.OppositeEdges].Type = 'Opposite' end end end @@ -5081,7 +5130,11 @@ function SawPlusChain.Saw.CalculateMachiningParameters( Proc, FaceToMachine, Edg if Proc.Topology == 'Tunnel' then dPocketHeight = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Height else - dPocketHeight = Proc.MainFaces.BottomFace.Height + if FaceToMachine.Type == 'Long' then + dPocketHeight = Proc.MainFaces.BottomFace.Edges.SideEdges[1].Length + elseif FaceToMachine.Type == 'Side' then + dPocketHeight = Proc.MainFaces.BottomFace.Edges.LongEdges[1].Length + end end -- ricerca lavorazione @@ -5242,32 +5295,43 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine Mortising.CanApply = true Mortising.Message = '' Mortising.ProcId = Proc.Id + local bNeedToMachineOtherSide = false local dTestCornerRadius = 43 + -- OneSide | OneSideAndExtend | BothSides | BothSidesAndExtend local sMortisingType local dPocketHeight = 0 if Proc.Topology == 'Tunnel' then dPocketHeight = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Height else - dPocketHeight = Proc.MainFaces.BottomFace.Height + if FaceToMachine.Type == 'Long' then + dPocketHeight = Proc.MainFaces.BottomFace.Edges.SideEdges[1].Length + elseif FaceToMachine.Type == 'Side' then + dPocketHeight = Proc.MainFaces.BottomFace.Edges.LongEdges[1].Length + end end -- ricerca lavorazione if Proc.Topology == 'Tunnel' then Mortising.Name = ML.FindSawing( 'Sawing', abs( EdgeToMachine.Elevation) + dTestCornerRadius + BD.CUT_EXTRA_MIN) - sMortisingType = "OneSideAndExtend" + sMortisingType = 'OneSideAndExtend' if not Mortising.Name then Mortising.Name = ML.FindSawing( 'Sawing', abs( EdgeToMachine.Elevation) / 2 + dTestCornerRadius + BD.CUT_EXTRA_MIN) - sMortisingType = "BothSidesAndExtend" + sMortisingType = 'BothSidesAndExtend' end + elseif EdgeToMachine.Type == 'Side' and #( Proc.MainFaces.SideFaces) == 0 then + Mortising.Name = ML.FindSawing( 'Sawing', abs( EdgeToMachine.Elevation) / 2 + dTestCornerRadius + BD.CUT_EXTRA_MIN) + sMortisingType = 'BothSidesAndExtend' else Mortising.Name = ML.FindSawing( 'Sawing', abs( EdgeToMachine.Elevation)) - sMortisingType = "OneSide" + sMortisingType = 'OneSide' end if not Mortising.Name then Mortising.Name = ML.FindSawing( 'Sawing', nil, nil, 'Longest') - if Proc.Topology == 'Tunnel' then - sMortisingType = "BothSides" + if sMortisingType == 'BothSidesAndExtend' then + sMortisingType = 'BothSides' + elseif sMortisingType == 'OneSideAndExtend' then + sMortisingType = 'OneSide' end end if not Mortising.Name then @@ -5311,14 +5375,16 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine Mortising.ToolInvert = true end -- profondità e offset longitudinale - if sMortisingType == "OneSide" then + if sMortisingType == 'OneSide' then Mortising.Depth = abs( EdgeToMachine.Elevation) elseif sMortisingType == 'OneSideAndExtend' then Mortising.Depth = abs( EdgeToMachine.Elevation) + Mortising.Tool.CornerRadius + BD.CUT_EXTRA_MIN elseif sMortisingType == 'BothSides' then Mortising.Depth = abs( EdgeToMachine.Elevation) / 2 + bNeedToMachineOtherSide = true elseif sMortisingType == 'BothSidesAndExtend' then Mortising.Depth = abs( EdgeToMachine.Elevation) / 2 + Mortising.Tool.CornerRadius + BD.CUT_EXTRA_MIN + bNeedToMachineOtherSide = true end if Mortising.Tool.MaxMat > Mortising.Depth - 10 * GEO.EPS_SMALL then if EdgeToMachine.Elevation > -10 * GEO.EPS_SMALL then @@ -5379,7 +5445,7 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine EgtOutLog( sDamageNextPieceMessage) end - return Mortising + return Mortising, bNeedToMachineOtherSide end @@ -5434,7 +5500,10 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId) Proc.MainFaces.SideFaces = SawPlusChain.GetSideFaces( Proc) if Proc.Topology == 'Tunnel' then Proc.MainFaces.TunnelAddedFaces = SawPlusChain.GetTunnelFaces( Proc) + else + Proc.MainFaces.BottomFace.Edges = SawPlusChain.GetBottomFaceEdges( Proc, Proc.MainFaces.BottomFace) end + Proc.MainFaces.LongFace.Edges = SawPlusChain.GetLongFaceEdges( Proc, Proc.MainFaces.LongFace) -- lama -- lavorazione di lama - fondo della tasca o fino a massimo materiale se tunnel @@ -5452,7 +5521,6 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId) return bIsCuttingOk, Cutting.Message end local dBottomDepthToMachine = Cutting.RadialOffset - -- lato opposto del tunnel if Proc.Topology == 'Tunnel' then Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.OppositeEdges[2]) @@ -5501,8 +5569,9 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId) -- sega a catena -- parametri lavorazione con sega a catena - fondo della tasca o tunnel local Mortising = {} + local bNeedToMachineOtherSide = false if Proc.Topology == 'Tunnel' then - Mortising = SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.OppositeEdges[1]) + Mortising, bNeedToMachineOtherSide = SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.OppositeEdges[1]) else Mortising = SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.BottomEdge) -- si lavora solo quanto non lavorato dalla lama @@ -5512,9 +5581,8 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId) if Mortising.CanApply then bIsMortisingOk, Mortising.Message = SawPlusChain.Chainsaw.ApplyAllSteps( Mortising, b3Raw) end - -- lato opposto del tunnel - if Proc.Topology == 'Tunnel' then + if Proc.Topology == 'Tunnel' and bNeedToMachineOtherSide then Mortising = SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.OppositeEdges[2]) bIsMortisingOk = false if Mortising.CanApply then diff --git a/UpdateLog.txt b/UpdateLog.txt index b488a6d..4b5231d 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,5 +1,9 @@ ==== Beam Update Log ==== +Versione 2.6e4 (20/05/2024) +- Modif : in SawPlusChain le lavorazioni di sega a catena aggiuntive (side) si fermano in mezzeria se tasca passante +- Modif : in SawPlusChain il tunnel con sega a catena viene fatto da un solo lato se possibile + Versione 2.6e3 (14/05/2024) - Modif : in SawPlusChain aggiunta gestione lavorazioni aggiuntive lati aperti e tunnel - Fixed : in Cut -> MakeFromTop ricalcolo direzione di lavorazione su facce a cubetti. diff --git a/Version.lua b/Version.lua index 3dd5ccb..6dcb1ad 100644 --- a/Version.lua +++ b/Version.lua @@ -2,5 +2,5 @@ -- Gestione della versione di Beam NAME = 'Beam' -VERSION = '2.6e3' +VERSION = '2.6e4' MIN_EXE = '2.6e2'