diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 0159541..0c3663c 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -4598,7 +4598,6 @@ function SawPlusChain.IsTopologyOk( Proc) end end - function SawPlusChain.GetBottomFace( Proc) -- la faccia di fondo ha sempre Fct - 1 adiacenze. Se si trovano più facce di fondo si sceglie quella con minor elevazione local vBottomFace = Topology.GetFacesWithGivenAdjacencyNumber( Proc, Proc.vAdj, Proc.Fct - 1) @@ -4716,6 +4715,7 @@ function SawPlusChain.GetToolFromMachining( sMachiningName) Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0 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 @@ -4754,15 +4754,31 @@ end function SawPlusChain.GetVerticalSteps( Proc, Machining) VerticalSteps = {} - VerticalSteps.Count = ceil( ( Proc.Pocket.Height - 10 * GEO.EPS_SMALL) / Machining.Tool.Thickness) VerticalSteps.StepLength = 0 + VerticalSteps.Count = ceil( ( Proc.Pocket.Height - 10 * GEO.EPS_SMALL) / Machining.Tool.Thickness) if VerticalSteps.Count > 1 then VerticalSteps.StepLength = ( Proc.Pocket.Height - Machining.Tool.Thickness) / ( VerticalSteps.Count - 1) + VerticalSteps.MaxElev = VerticalSteps.StepLength * VerticalSteps.Count - 10 * GEO.EPS_SMALL + VerticalSteps.StepType = MCH_MILL_ST.ONEWAY end return VerticalSteps end +function SawPlusChain.GetHorizontalSteps( Proc, Machining) + HorizontalSteps = {} + HorizontalSteps.StepLength = 0 + HorizontalSteps.Count = 1 + if Machining.Tool.SideStep then + HorizontalSteps.Count = ceil( ( Proc.Pocket.Depth - 10 * GEO.EPS_SMALL) / Machining.Tool.SideStep) + if HorizontalSteps.Count > 1 then + HorizontalSteps.StepLength = ( Proc.Pocket.Height - Machining.Tool.Thickness) / ( HorizontalSteps.Count - 1) + end + end + + return HorizontalSteps +end + function SawPlusChain.ApplyMachining( Machining, sOperationNamePrefix, b3Raw) local sOperationName = sOperationNamePrefix .. ( EgtGetName( Machining.ProcId) or tostring( Machining.ProcId)) .. '_' .. tostring( Machining.FaceToMachine.Id + 1) local nOperationId = EgtAddMachining( sOperationName, Machining.Name) @@ -4787,6 +4803,14 @@ function SawPlusChain.ApplyMachining( Machining, sOperationNamePrefix, b3Raw) EgtSetMachiningParam( MCH_MP.LOPERP, Machining.LeadOut.PerpDistance) EgtSetMachiningParam( MCH_MP.STARTADDLEN, Machining.LeadIn.StartAddLength) EgtSetMachiningParam( MCH_MP.ENDADDLEN, Machining.LeadOut.EndAddLength) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, Machining.LeadOut.EndAddLength) + EgtSetMachiningParam( MCH_MP.STEPTYPE, Machining.VerticalSteps.StepType) + EgtSetMachiningParam( MCH_MP.STEP, Machining.VerticalSteps.StepLength) + local sNotes + if Machining.VerticalSteps.MaxElev then + sNotes = EgtSetValInNotes( sNotes, 'MaxElev', Machining.VerticalSteps.MaxElev) + end + EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- imposto angolo 3° asse rot local sBlockedAxis = 'perpendicular' local vtOut = EgtIf( Machining.FaceToMachine.VtN:getX() > 0, X_AX(), -X_AX()) @@ -4887,12 +4911,19 @@ function SawPlusChain.Make( Proc, b3Raw) Cutting.Depth = Cutting.Tool.MaxDepth Cutting.RadialOffset = Proc.Pocket.Depth - Cutting.Depth end - -- offset longitudinale - Cutting.LongitudinalOffset = 0 -- faceuse Cutting.Faceuse = BL.GetNearestOrthoOpposite( Proc.Pocket.Direction) -- SCC Cutting.SCC = SawPlusChain.GetSCC( Proc.Pocket.Direction) + -- step verticale e offset longitudinale + Cutting.VerticalSteps = SawPlusChain.GetVerticalSteps( Proc, Cutting) + if Cutting.ToolInvert and Cutting.VerticalSteps.Count > 1 then + Cutting.LongitudinalOffset = - Proc.Pocket.Height + else + Cutting.LongitudinalOffset = 0 + end + -- step orizzontale + Cutting.HorizontalSteps = SawPlusChain.GetHorizontalSteps( Proc, Cutting) -- approccio e retrazione Cutting.LeadIn = {} Cutting.LeadOut = {} @@ -4944,17 +4975,8 @@ function SawPlusChain.Make( Proc, b3Raw) end -- lavorazione con lama - Cutting.VerticalSteps = SawPlusChain.GetVerticalSteps( Proc, Cutting) local bOk, sErr - for i = 1, Cutting.VerticalSteps.Count do - if Cutting.ToolInvert then - Cutting.LongitudinalOffset = ( ( i - 1) * -Cutting.VerticalSteps.StepLength) - Cutting.Tool.Thickness - else - Cutting.LongitudinalOffset = ( i - 1) * Cutting.VerticalSteps.StepLength - end - - bOk, sErr = SawPlusChain.ApplyMachining( Cutting, 'Cut_', b3Raw) - end + bOk, sErr = SawPlusChain.ApplyMachining( Cutting, 'Cut_', b3Raw) -- parametri della lavorazione con sega a catena