From a0d79c4d0f6ae145a3ffe17f07ee82b0c616c4a4 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 14 Apr 2025 13:13:51 +0200 Subject: [PATCH] - in FACEBYCHAINSAW bStopAtHalfElevation sostituito con dDepthToMachine (ora analoga a FACEBYBLADE) - STR0003 e STR0004 modificate di conseguenza --- Strategies/Standard/STR0003/STR0003.lua | 48 +++++++++++-------------- Strategies/Standard/STR0004/STR0004.lua | 14 +++++--- StrategyLibs/FACEBYCHAINSAW.lua | 29 ++++----------- 3 files changed, 37 insertions(+), 54 deletions(-) diff --git a/Strategies/Standard/STR0003/STR0003.lua b/Strategies/Standard/STR0003/STR0003.lua index a9d2d55..d259c09 100644 --- a/Strategies/Standard/STR0003/STR0003.lua +++ b/Strategies/Standard/STR0003/STR0003.lua @@ -275,12 +275,14 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) -- eventuale lavorazione di lama - lato della tasca da cui inizia la lavorazione if BottomEdge.bIsStartOpen then OptionalParameters.bOppositeToolDirection = true + Cutting = FaceByBlade.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters) Blade.AddResult( Cutting) end -- eventuale lavorazione di lama - lato della tasca in cui finisce la lavorazione if BottomEdge.bIsEndOpen then OptionalParameters.bOppositeToolDirection = true + Cutting = FaceByBlade.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters) Blade.AddResult( Cutting) end @@ -387,7 +389,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters) elseif ( BottomEdge.bIsEndOpen and SideEdge2.dLength > 3 * Blade.Result.Side[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) then OptionalParameters.sSideToMachine = 'Start' - OptionalParameters.dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength + OptionalParameters.dLengthToMachine = Blade.Result.Side[2].dBladeMarkLength OptionalParameters.bOppositeToolDirection = true Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters) @@ -425,6 +427,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) OptionalParameters.dMaxElev = nil -- ancora materiale residuo - si lavorano i lati if Chainsaw.Result.Bottom[1].dResidualDepth > 10 * GEO.EPS_SMALL then + OptionalParameters.bExtendWithCornerRadius = true -- si lavora solamente l'impronta lama sul fondo if ( Blade.Result.Side[1].dResidualDepth < 10 * GEO.EPS_SMALL and SideEdge1.dLength > 3 * Blade.Result.Side[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) and ( Blade.Result.Side[2].dResidualDepth < 10 * GEO.EPS_SMALL and SideEdge2.dLength > 3 * Blade.Result.Side[2].dBladeMarkLength - 10 * GEO.EPS_SMALL) then @@ -437,18 +440,16 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) Chainsaw.AddResult( Mortising) -- ancora materiale residuo - si lavora da entrambi i lati if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then - OptionalParameters.bStopAtHalfElevation = true + OptionalParameters.dDepthToMachine = SideEdge1.dElevation / 2 + BeamData.CUT_EXTRA_MIN OptionalParameters.sSideToMachine = 'End' OptionalParameters.dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength - OptionalParameters.bOppositeToolDirection = true Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters) Chainsaw.AddResult( Mortising) - OptionalParameters.bStopAtHalfElevation = true + OptionalParameters.dDepthToMachine = SideEdge2.dElevation / 2 + BeamData.CUT_EXTRA_MIN OptionalParameters.sSideToMachine = 'Start' OptionalParameters.dLengthToMachine = Blade.Result.Side[2].dBladeMarkLength - OptionalParameters.bOppositeToolDirection = true Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters) Chainsaw.AddResult( Mortising) @@ -468,16 +469,14 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then Chainsaw.Result.Side[1].bIsApplicable = false - OptionalParameters.bStopAtHalfElevation = true + OptionalParameters.dDepthToMachine = SideEdge1.dElevation / 2 + BeamData.CUT_EXTRA_MIN OptionalParameters.dMaxElev = Blade.Result.Side[1].dResidualDepth + BeamData.CUT_EXTRA - OptionalParameters.bOppositeToolDirection = true Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters) Chainsaw.AddResult( Mortising) - OptionalParameters.bStopAtHalfElevation = true + OptionalParameters.dDepthToMachine = SideEdge2.dElevation / 2 + BeamData.CUT_EXTRA_MIN OptionalParameters.dMaxElev = Blade.Result.Side[2].dResidualDepth + BeamData.CUT_EXTRA - OptionalParameters.bOppositeToolDirection = true Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters) Chainsaw.AddResult( Mortising) @@ -490,20 +489,22 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) end end elseif Proc.Topology.sName == 'Tunnel-4-Through' then + OptionalParameters.bOppositeToolDirection = true + OptionalParameters.bExtendWithCornerRadius = true -- si lavora solamente l'impronta lama sul lato opposto if ( Blade.Result.Opposite[1].dResidualDepth < 10 * GEO.EPS_SMALL and OppositeEdge1.dLength > 3 * Blade.Result.Opposite[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) and ( Blade.Result.Opposite[2].dResidualDepth < 10 * GEO.EPS_SMALL and OppositeEdge2.dLength > 3 * Blade.Result.Opposite[2].dBladeMarkLength - 10 * GEO.EPS_SMALL) then - - OptionalParameters.sSideToMachine = 'Start' - OptionalParameters.dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength - OptionalParameters.bOppositeToolDirection = true + + OptionalParameters.dLengthToMachine = max( + Blade.Result.Opposite[1].dBladeMarkLength, + Blade.Result.Opposite[2].dBladeMarkLength + ) + OptionalParameters.sSideToMachine = 'Start' Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters) Chainsaw.AddResult( Mortising) OptionalParameters.sSideToMachine = 'End' - OptionalParameters.dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength - OptionalParameters.bOppositeToolDirection = true Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters) Chainsaw.AddResult( Mortising) @@ -512,57 +513,48 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) Chainsaw.Result.Opposite[1].bIsApplicable = false Chainsaw.Result.Opposite[2].bIsApplicable = false - OptionalParameters.bStopAtHalfElevation = true + OptionalParameters.dDepthToMachine = OppositeEdge1.dElevation / 2 + BeamData.CUT_EXTRA_MIN OptionalParameters.sSideToMachine = 'Start' OptionalParameters.dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength - OptionalParameters.bOppositeToolDirection = true Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters) Chainsaw.AddResult( Mortising) - OptionalParameters.bStopAtHalfElevation = true OptionalParameters.sSideToMachine = 'End' OptionalParameters.dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength - OptionalParameters.bOppositeToolDirection = true Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters) Chainsaw.AddResult( Mortising) - OptionalParameters.bStopAtHalfElevation = true + OptionalParameters.dDepthToMachine = OppositeEdge2.dElevation / 2 + BeamData.CUT_EXTRA_MIN OptionalParameters.sSideToMachine = 'Start' OptionalParameters.dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength - OptionalParameters.bOppositeToolDirection = true Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge2, OptionalParameters) Chainsaw.AddResult( Mortising) - OptionalParameters.bStopAtHalfElevation = true OptionalParameters.sSideToMachine = 'End' OptionalParameters.dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength - OptionalParameters.bOppositeToolDirection = true Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge2, OptionalParameters) Chainsaw.AddResult( Mortising) end else OptionalParameters.dMaxElev = Blade.Result.Opposite[1].dResidualDepth + BeamData.CUT_EXTRA - OptionalParameters.bOppositeToolDirection = true Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters) Chainsaw.AddResult( Mortising) if Chainsaw.Result.Opposite[1].dResidualDepth > 10 * GEO.EPS_SMALL then Chainsaw.Result.Opposite[1].bIsApplicable = false - OptionalParameters.bStopAtHalfElevation = true + OptionalParameters.dDepthToMachine = OppositeEdge1.dElevation / 2 + BeamData.CUT_EXTRA_MIN OptionalParameters.dMaxElev = Blade.Result.Opposite[1].dResidualDepth + BeamData.CUT_EXTRA - OptionalParameters.bOppositeToolDirection = true Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters) Chainsaw.AddResult( Mortising) - OptionalParameters.bStopAtHalfElevation = true + OptionalParameters.dDepthToMachine = OppositeEdge2.dElevation / 2 + BeamData.CUT_EXTRA_MIN OptionalParameters.dMaxElev = Blade.Result.Opposite[2].dResidualDepth + BeamData.CUT_EXTRA - OptionalParameters.bOppositeToolDirection = true Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge2, OptionalParameters) Chainsaw.AddResult( Mortising) diff --git a/Strategies/Standard/STR0004/STR0004.lua b/Strategies/Standard/STR0004/STR0004.lua index afaf9d6..1990480 100644 --- a/Strategies/Standard/STR0004/STR0004.lua +++ b/Strategies/Standard/STR0004/STR0004.lua @@ -205,11 +205,14 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters) -- ancora materiale residuo - si lavora da entrambi i lati if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then Chainsaw.Result.Side[1].bIsApplicable = false - OptionalParameters.bOppositeToolDirection = true - OptionalParameters.bStopAtHalfElevation = true + OptionalParameters.bExtendWithCornerRadius = true + OptionalParameters.dDepthToMachine = SideEdge1.dElevation / 2 + BeamData.CUT_EXTRA_MIN Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters) Chainsaw.AddResult( Mortising) + + OptionalParameters.dDepthToMachine = SideEdge2.dElevation / 2 + BeamData.CUT_EXTRA_MIN + Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters) Chainsaw.AddResult( Mortising) -- lavorando dai due lati non c'è materiale residuo - si può disabilitare la lavorazione del fondo @@ -226,11 +229,14 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters) -- se lavorando solo da un lato rimane materiale residuo, si lavora da entrambi if Chainsaw.Result.Opposite[1].dResidualDepth > 10 * GEO.EPS_SMALL then Chainsaw.Result.Opposite[1].bIsApplicable = false - OptionalParameters.bOppositeToolDirection = true - OptionalParameters.bStopAtHalfElevation = true + OptionalParameters.bExtendWithCornerRadius = true + OptionalParameters.dDepthToMachine = OppositeEdge1.dElevation / 2 + BeamData.CUT_EXTRA_MIN FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters) Chainsaw.AddResult( Mortising) + + OptionalParameters.dDepthToMachine = OppositeEdge2.dElevation / 2 + BeamData.CUT_EXTRA_MIN + FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge2, OptionalParameters) Chainsaw.AddResult( Mortising) end diff --git a/StrategyLibs/FACEBYCHAINSAW.lua b/StrategyLibs/FACEBYCHAINSAW.lua index 9d3a64c..9de327d 100644 --- a/StrategyLibs/FACEBYCHAINSAW.lua +++ b/StrategyLibs/FACEBYCHAINSAW.lua @@ -65,10 +65,8 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional local sSideToMachine = OptionalParameters.sSideToMachine or '' local dLengthToMachine = OptionalParameters.dLengthToMachine or EdgeToMachine.dLength local dCustomMaxElev = OptionalParameters.dMaxElev or EdgeToMachine.dElevation - - local bStopAtHalfElevation = OptionalParameters.bStopAtHalfElevation or false local dDepthToMachine = OptionalParameters.dDepthToMachine or EdgeToMachine.dElevation - + local bExtendWithCornerRadius = OptionalParameters.bExtendWithCornerRadius local dExtendAfterTail = OptionalParameters.dExtendAfterTail or 10000 local dPocketHeight = OptionalParameters.dPocketHeight or 0 local bIsSplitFeature = OptionalParameters.bIsSplitFeature or false @@ -87,26 +85,12 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional Mortising.ptEdge1, _, Mortising.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -Mortising.vtToolDirection, GDB_ID.ROOT) -- ricerca utensile - local bExtendWithCornerRadius = false - if not bStopAtHalfElevation then - if ( EdgeToMachine.sType == 'Side' and Proc.Topology.sName == 'Groove-3-Through') or - ( EdgeToMachine.sType == 'Opposite' and Proc.Topology.sFamily == 'Tunnel') then - - bExtendWithCornerRadius = true - Mortising.dDepthToMachine = EdgeToMachine.dElevation + BeamData.CUT_EXTRA - else - Mortising.dDepthToMachine = EdgeToMachine.dElevation - end - else - bExtendWithCornerRadius = true - Mortising.dDepthToMachine = EdgeToMachine.dElevation / 2 + BeamData.CUT_EXTRA_MIN - end local ToolSearchParameters = {} local ToolInfo = {} ToolSearchParameters.vtToolDirection = Mortising.vtToolDirection ToolSearchParameters.bAllowTopHead = true ToolSearchParameters.bAllowBottomHead = true - ToolSearchParameters.dElevation = Mortising.dDepthToMachine + ToolSearchParameters.dElevation = dDepthToMachine ToolSearchParameters.bExtendWithCornerRadius = bExtendWithCornerRadius ToolInfo = MachiningLib.FindChainSaw( Proc, ToolSearchParameters) Mortising.nToolIndex = ToolInfo.nToolIndex @@ -153,18 +137,19 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional end -- profondità e offset longitudinale if bExtendWithCornerRadius then - Mortising.dDepthToMachine = Mortising.dDepthToMachine + TOOLS[Mortising.nToolIndex].dCornerRadius + dDepthToMachine = dDepthToMachine + TOOLS[Mortising.nToolIndex].dCornerRadius end - if TOOLS[Mortising.nToolIndex].dMaxMaterial > Mortising.dDepthToMachine - 10 * GEO.EPS_SMALL then + if TOOLS[Mortising.nToolIndex].dMaxMaterial > dDepthToMachine - 10 * GEO.EPS_SMALL then + Mortising.dDepthToMachine = dDepthToMachine Mortising.dResidualDepth = 0 if bOppositeToolDirection then - Mortising.dLongitudinalOffset = EdgeToMachine.dElevation - Mortising.dDepthToMachine + Mortising.dLongitudinalOffset = EdgeToMachine.dElevation - dDepthToMachine else Mortising.dLongitudinalOffset = 0 end else Mortising.dDepthToMachine = TOOLS[Mortising.nToolIndex].dMaxMaterial - 1 - Mortising.dResidualDepth = EdgeToMachine.dElevation - Mortising.dDepthToMachine + Mortising.dResidualDepth = dDepthToMachine - Mortising.dDepthToMachine if bOppositeToolDirection then Mortising.dLongitudinalOffset = 0 else