From 1648ee6cdcabb842b9f7ef993af49c008e819f84 Mon Sep 17 00:00:00 2001 From: tarman3 Date: Wed, 7 May 2025 08:17:58 +0300 Subject: [PATCH] CAM: PickStartPoint fixes --- src/Mod/CAM/Gui/Resources/Path.qrc | 1 + .../Gui/Resources/icons/CAM_StartPoint.svg | 189 ++++++++++++++++++ src/Mod/CAM/InitGui.py | 2 + src/Mod/CAM/Path/Op/Gui/Base.py | 8 +- 4 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 src/Mod/CAM/Gui/Resources/icons/CAM_StartPoint.svg diff --git a/src/Mod/CAM/Gui/Resources/Path.qrc b/src/Mod/CAM/Gui/Resources/Path.qrc index b8462b1868..b683dbd567 100644 --- a/src/Mod/CAM/Gui/Resources/Path.qrc +++ b/src/Mod/CAM/Gui/Resources/Path.qrc @@ -51,6 +51,7 @@ icons/CAM_Simulator.svg icons/CAM_SimulatorGL.svg icons/CAM_Slot.svg + icons/CAM_StartPoint.svg icons/CAM_Stop.svg icons/CAM_Tapping.svg icons/CAM_ThreadMilling.svg diff --git a/src/Mod/CAM/Gui/Resources/icons/CAM_StartPoint.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_StartPoint.svg new file mode 100644 index 0000000000..b65295a12d --- /dev/null +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_StartPoint.svg @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/CAM/InitGui.py b/src/Mod/CAM/InitGui.py index 570df75b36..7b93f8767e 100644 --- a/src/Mod/CAM/InitGui.py +++ b/src/Mod/CAM/InitGui.py @@ -320,6 +320,8 @@ class CAMWorkbench(Workbench): menuAppended = True if isinstance(obj.Proxy, Path.Op.Base.ObjectOp): self.appendContextMenu("", ["CAM_OperationCopy", "CAM_OpActiveToggle"]) + if hasattr(obj, "StartPoint"): + self.appendContextMenu("", ["CAM_SetStartPoint"]) menuAppended = True if obj.isDerivedFrom("Path::Feature"): if ( diff --git a/src/Mod/CAM/Path/Op/Gui/Base.py b/src/Mod/CAM/Path/Op/Gui/Base.py index bbd76cf8d9..ce2586cc0f 100644 --- a/src/Mod/CAM/Path/Op/Gui/Base.py +++ b/src/Mod/CAM/Path/Op/Gui/Base.py @@ -1306,12 +1306,18 @@ class CommandSetStartPoint: return obj and hasattr(obj, "StartPoint") def setpoint(self, point, o): - obj = FreeCADGui.Selection.getSelection()[0] + FreeCADGui.Snapper.grid.off() + obj = self.obj obj.StartPoint.x = point.x obj.StartPoint.y = point.y obj.StartPoint.z = obj.ClearanceHeight.Value + obj.UseStartPoint = True + obj.recompute() + textPoint = f"{obj.StartPoint.x:.2f}, {obj.StartPoint.y:.2f}, {obj.StartPoint.z:.2f}" + print(f"Set start point for operation {obj.Label} >>> {textPoint}") def Activated(self): + self.obj = FreeCADGui.Selection.getSelection()[0] if not hasattr(FreeCADGui, "Snapper"): import DraftTools FreeCADGui.Snapper.getPoint(callback=self.setpoint)