From 6286ff3c6c09bbfdfca6ef35a20df98d65085d9f Mon Sep 17 00:00:00 2001 From: David Kaufman Date: Fri, 29 Aug 2025 13:22:08 -0400 Subject: [PATCH] [CAM] update/fix adaptive UI panel and parameter limits --- src/Mod/CAM/CAMTests/TestPathAdaptive.py | 11 -- .../Resources/panels/PageOpAdaptiveEdit.ui | 154 ++++++++++++------ src/Mod/CAM/Path/Op/Adaptive.py | 6 + src/Mod/CAM/Path/Op/Gui/Adaptive.py | 16 +- 4 files changed, 122 insertions(+), 65 deletions(-) diff --git a/src/Mod/CAM/CAMTests/TestPathAdaptive.py b/src/Mod/CAM/CAMTests/TestPathAdaptive.py index ab3b498e34..bbef17870a 100644 --- a/src/Mod/CAM/CAMTests/TestPathAdaptive.py +++ b/src/Mod/CAM/CAMTests/TestPathAdaptive.py @@ -115,7 +115,6 @@ class TestPathAdaptive(PathTestBase): # setDepthsAndHeights(adaptive) adaptive.FinishingProfile = False adaptive.HelixAngle = 75.0 - adaptive.HelixDiameterLimit.Value = 1.0 adaptive.LiftDistance.Value = 1.0 adaptive.StepOver = 75 adaptive.UseOutline = False @@ -149,7 +148,6 @@ class TestPathAdaptive(PathTestBase): # setDepthsAndHeights(adaptive) adaptive.FinishingProfile = False adaptive.HelixAngle = 75.0 - adaptive.HelixDiameterLimit.Value = 1.0 adaptive.LiftDistance.Value = 1.0 adaptive.StepOver = 75 adaptive.UseOutline = False @@ -177,7 +175,6 @@ class TestPathAdaptive(PathTestBase): # setDepthsAndHeights(adaptive) adaptive.FinishingProfile = False adaptive.HelixAngle = 75.0 - adaptive.HelixDiameterLimit.Value = 1.0 adaptive.LiftDistance.Value = 1.0 adaptive.StepOver = 75 adaptive.UseOutline = True @@ -218,7 +215,6 @@ class TestPathAdaptive(PathTestBase): # setDepthsAndHeights(adaptive) adaptive.FinishingProfile = False adaptive.HelixAngle = 75.0 - adaptive.HelixDiameterLimit.Value = 1.0 adaptive.LiftDistance.Value = 1.0 adaptive.StepOver = 75 adaptive.UseOutline = False @@ -261,7 +257,6 @@ class TestPathAdaptive(PathTestBase): # setDepthsAndHeights(adaptive) adaptive.FinishingProfile = False adaptive.HelixAngle = 75.0 - adaptive.HelixDiameterLimit.Value = 1.0 adaptive.LiftDistance.Value = 1.0 adaptive.StepOver = 75 adaptive.UseOutline = False @@ -304,7 +299,6 @@ class TestPathAdaptive(PathTestBase): # setDepthsAndHeights(adaptive) adaptive.FinishingProfile = False adaptive.HelixAngle = 75.0 - adaptive.HelixDiameterLimit.Value = 1.0 adaptive.LiftDistance.Value = 1.0 adaptive.StepOver = 75 adaptive.UseOutline = False @@ -347,7 +341,6 @@ class TestPathAdaptive(PathTestBase): # setDepthsAndHeights(adaptive) adaptive.FinishingProfile = False adaptive.HelixAngle = 75.0 - adaptive.HelixDiameterLimit.Value = 1.0 adaptive.LiftDistance.Value = 1.0 adaptive.StepOver = 75 adaptive.UseOutline = False @@ -408,7 +401,6 @@ class TestPathAdaptive(PathTestBase): setDepthsAndHeights(adaptive, 15, 0) adaptive.FinishingProfile = False adaptive.HelixAngle = 75.0 - adaptive.HelixDiameterLimit.Value = 1.0 adaptive.LiftDistance.Value = 1.0 adaptive.StepOver = 75 adaptive.UseOutline = False @@ -478,7 +470,6 @@ class TestPathAdaptive(PathTestBase): setDepthsAndHeights(adaptive, 15, 10) adaptive.FinishingProfile = False adaptive.HelixAngle = 75.0 - adaptive.HelixDiameterLimit.Value = 1.0 adaptive.LiftDistance.Value = 1.0 adaptive.StepOver = 75 adaptive.UseOutline = False @@ -540,7 +531,6 @@ class TestPathAdaptive(PathTestBase): setDepthsAndHeights(adaptive, 15, 0) adaptive.FinishingProfile = False adaptive.HelixAngle = 75.0 - adaptive.HelixDiameterLimit.Value = 1.0 adaptive.LiftDistance.Value = 1.0 adaptive.StepOver = 75 adaptive.UseOutline = False @@ -622,7 +612,6 @@ class TestPathAdaptive(PathTestBase): setDepthsAndHeights(adaptive, 15, 5) adaptive.FinishingProfile = False adaptive.HelixAngle = 75.0 - adaptive.HelixDiameterLimit.Value = 1.0 adaptive.LiftDistance.Value = 1.0 adaptive.StepOver = 75 adaptive.UseOutline = False diff --git a/src/Mod/CAM/Gui/Resources/panels/PageOpAdaptiveEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpAdaptiveEdit.ui index d2b1d43549..aa829329c6 100644 --- a/src/Mod/CAM/Gui/Resources/panels/PageOpAdaptiveEdit.ui +++ b/src/Mod/CAM/Gui/Resources/panels/PageOpAdaptiveEdit.ui @@ -66,7 +66,7 @@ - + Accuracy vs performance @@ -173,21 +173,113 @@ Larger values (further to the right) will calculate faster; smaller values (furt - - - - Angle of the helix entry cone + + + + QFrame::Shape::StyledPanel - - - - - - - - - Helix ramp angle + + QFrame::Shadow::Raised + + + + + Helix max stepdown + + + + + + + The maximum allowable descent in a single revolution of the helix. + + + + + + + + + + Helix ramp angle + + + + + + + Angle of the helix ramp entry + + + + + + + + + + Helix cone angle + + + + + + + Angle of the helix entry cone + + + + + + + + + + Helix ideal diameter + + + + + + + Ideal helix entry diameter, as a percentage of the tool diameter. + + + 10 + + + 100 + + + 5 + + + + + + + Helix min diameter + + + + + + + Minimum acceptable entry diameter, as a percentage of the tool diameter. + + + 10 + + + 100 + + + 5 + + + + @@ -221,33 +313,6 @@ Larger values (further to the right) will calculate faster; smaller values (furt - - - - If greater than zero it limits the helix ramp diameter, otherwise 75 percent of tool diameter is used - - - - - - - - - - Helix cone angle - - - - - - - Angle of the helix ramp entry - - - - - - @@ -272,13 +337,6 @@ Larger values (further to the right) will calculate faster; smaller values (furt - - - - Helix max diameter - - - diff --git a/src/Mod/CAM/Path/Op/Adaptive.py b/src/Mod/CAM/Path/Op/Adaptive.py index 3e310d1e62..7fd9688a01 100644 --- a/src/Mod/CAM/Path/Op/Adaptive.py +++ b/src/Mod/CAM/Path/Op/Adaptive.py @@ -699,6 +699,12 @@ def ExecuteModelAware(op, obj): FreeCADGui.updateGui() try: + obj.HelixMinDiameterPercent = max(obj.HelixMinDiameterPercent, 10) + obj.HelixIdealDiameterPercent = max( + obj.HelixIdealDiameterPercent, obj.HelixMinDiameterPercent + ) + obj.StepOver = max(obj.StepOver, 1) + helixDiameter = obj.HelixIdealDiameterPercent / 100 * op.tool.Diameter.Value helixMinDiameter = obj.HelixMinDiameterPercent / 100 * op.tool.Diameter.Value topZ = op.stock.Shape.BoundBox.ZMax diff --git a/src/Mod/CAM/Path/Op/Gui/Adaptive.py b/src/Mod/CAM/Path/Op/Gui/Adaptive.py index 3e94602ca0..07c4752785 100644 --- a/src/Mod/CAM/Path/Op/Gui/Adaptive.py +++ b/src/Mod/CAM/Path/Op/Gui/Adaptive.py @@ -46,9 +46,6 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): def initPage(self, obj): self.form.LiftDistance.setProperty("unit", obj.LiftDistance.getUserPreferred()[2]) - self.form.HelixDiameterLimit.setProperty( - "unit", obj.HelixDiameterLimit.getUserPreferred()[2] - ) self.form.KeepToolDownRatio.setProperty("unit", obj.KeepToolDownRatio.getUserPreferred()[2]) self.form.StockToLeave.setProperty("unit", obj.StockToLeave.getUserPreferred()[2]) @@ -62,7 +59,8 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): signals.append(self.form.Tolerance.valueChanged) signals.append(self.form.HelixAngle.valueChanged) signals.append(self.form.HelixConeAngle.valueChanged) - signals.append(self.form.HelixDiameterLimit.valueChanged) + signals.append(self.form.HelixIdealDiameterPercent.valueChanged) + signals.append(self.form.HelixMinDiameterPercent.valueChanged) signals.append(self.form.LiftDistance.valueChanged) signals.append(self.form.KeepToolDownRatio.valueChanged) signals.append(self.form.StockToLeave.valueChanged) @@ -92,7 +90,8 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): FreeCAD.Units.Quantity(obj.HelixConeAngle, FreeCAD.Units.Angle).UserString ) - self.form.HelixDiameterLimit.setProperty("rawValue", obj.HelixDiameterLimit.Value) + self.form.HelixIdealDiameterPercent.setValue(obj.HelixIdealDiameterPercent) + self.form.HelixMinDiameterPercent.setValue(obj.HelixMinDiameterPercent) self.form.LiftDistance.setProperty("rawValue", obj.LiftDistance.Value) @@ -124,10 +123,15 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): if obj.StepOver != self.form.stepOverPercent.value(): obj.StepOver = self.form.stepOverPercent.value() + if obj.HelixIdealDiameterPercent != self.form.HelixIdealDiameterPercent.value(): + obj.HelixIdealDiameterPercent = self.form.HelixIdealDiameterPercent.value() + + if obj.HelixMinDiameterPercent != self.form.HelixMinDiameterPercent.value(): + obj.HelixMinDiameterPercent = self.form.HelixMinDiameterPercent.value() + obj.Tolerance = 1.0 * self.form.Tolerance.value() / 100.0 PathGuiUtil.updateInputField(obj, "HelixAngle", self.form.HelixAngle) PathGuiUtil.updateInputField(obj, "HelixConeAngle", self.form.HelixConeAngle) - PathGuiUtil.updateInputField(obj, "HelixDiameterLimit", self.form.HelixDiameterLimit) PathGuiUtil.updateInputField(obj, "LiftDistance", self.form.LiftDistance) if hasattr(obj, "KeepToolDownRatio"):