From b77f63c7c6b48e82385d04c3d675a47f95ee0862 Mon Sep 17 00:00:00 2001 From: jffmichi <> Date: Fri, 23 May 2025 04:09:44 +0200 Subject: [PATCH] CAM: sort locations for all drilling operations --- src/Mod/CAM/Path/Op/CircularHoleBase.py | 4 +++- src/Mod/CAM/Path/Op/Drilling.py | 2 -- src/Mod/CAM/Path/Op/Helix.py | 3 --- src/Mod/CAM/Path/Op/Tapping.py | 2 -- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Mod/CAM/Path/Op/CircularHoleBase.py b/src/Mod/CAM/Path/Op/CircularHoleBase.py index 2cdce169c5..65c4dfc2c7 100644 --- a/src/Mod/CAM/Path/Op/CircularHoleBase.py +++ b/src/Mod/CAM/Path/Op/CircularHoleBase.py @@ -24,7 +24,8 @@ from PySide.QtCore import QT_TRANSLATE_NOOP import FreeCAD import Path import Path.Op.Base as PathOp -import Path.Base.Drillable as Drillable +from Path.Base import Drillable +from PathScripts import PathUtils # lazily loaded modules from lazy_loader.lazy_loader import LazyLoader @@ -187,6 +188,7 @@ class ObjectOp(PathOp.ObjectOp): holes.append({"x": location.x, "y": location.y, "r": 0}) if len(holes) > 0: + holes = PathUtils.sort_locations(holes, ["x", "y"]) self.circularHoleExecute(obj, holes) def circularHoleExecute(self, obj, holes): diff --git a/src/Mod/CAM/Path/Op/Drilling.py b/src/Mod/CAM/Path/Op/Drilling.py index 4df30f675d..8dec080d5a 100644 --- a/src/Mod/CAM/Path/Op/Drilling.py +++ b/src/Mod/CAM/Path/Op/Drilling.py @@ -250,8 +250,6 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp): obj.RetractMode = "G98" self.commandlist.append(Path.Command(obj.RetractMode)) - holes = PathUtils.sort_locations(holes, ["x", "y"]) - # This section is technical debt. The computation of the # target shapes should be factored out for reuse. # This will likely mean refactoring upstream CircularHoleBase to pass diff --git a/src/Mod/CAM/Path/Op/Helix.py b/src/Mod/CAM/Path/Op/Helix.py index 3d0e3378dd..e3b8d7d08a 100644 --- a/src/Mod/CAM/Path/Op/Helix.py +++ b/src/Mod/CAM/Path/Op/Helix.py @@ -22,7 +22,6 @@ import Path.Base.Generator.helix as helix from PathScripts.PathUtils import fmt -from PathScripts.PathUtils import sort_locations from PySide.QtCore import QT_TRANSLATE_NOOP import FreeCAD import Part @@ -242,8 +241,6 @@ class ObjectHelix(PathCircularHoleBase.ObjectOp): self.commandlist.append(Path.Command("G0", {"Z": obj.ClearanceHeight.Value})) - holes = sort_locations(holes, ["x", "y"]) - tool = obj.ToolController.Tool tooldiamter = tool.Diameter.Value if hasattr(tool.Diameter, "Value") else tool.Diameter diff --git a/src/Mod/CAM/Path/Op/Tapping.py b/src/Mod/CAM/Path/Op/Tapping.py index 0e8a6b875c..e0b888368c 100644 --- a/src/Mod/CAM/Path/Op/Tapping.py +++ b/src/Mod/CAM/Path/Op/Tapping.py @@ -177,8 +177,6 @@ class ObjectTapping(PathCircularHoleBase.ObjectOp): # http://linuxcnc.org/docs/html/gcode/g-code.html#gcode:g98-g99 self.commandlist.append(Path.Command(obj.ReturnLevel)) - holes = PathUtils.sort_locations(holes, ["x", "y"]) - # This section is technical debt. The computation of the # target shapes should be factored out for reuse. # This will likely mean refactoring upstream CircularHoleBase to pass