From 465edb71471d12fc944e0c76b4e607ab8f5e928b Mon Sep 17 00:00:00 2001 From: Brad Collette Date: Wed, 28 Feb 2024 11:07:04 -0700 Subject: [PATCH] deprecate Hop --- src/Mod/Path/CMakeLists.txt | 1 - src/Mod/Path/Gui/Resources/Path.qrc | 1 - src/Mod/Path/Gui/Resources/icons/Path_Hop.svg | 165 ------------------ src/Mod/Path/Path/GuiInit.py | 1 - src/Mod/Path/Path/Op/Gui/Hop.py | 147 ---------------- 5 files changed, 315 deletions(-) delete mode 100644 src/Mod/Path/Gui/Resources/icons/Path_Hop.svg delete mode 100644 src/Mod/Path/Path/Op/Gui/Hop.py diff --git a/src/Mod/Path/CMakeLists.txt b/src/Mod/Path/CMakeLists.txt index 89c3e736de..897eda3355 100644 --- a/src/Mod/Path/CMakeLists.txt +++ b/src/Mod/Path/CMakeLists.txt @@ -206,7 +206,6 @@ SET(PathPythonOpGui_SRCS Path/Op/Gui/Engrave.py Path/Op/Gui/FeatureExtension.py Path/Op/Gui/Helix.py - Path/Op/Gui/Hop.py Path/Op/Gui/MillFace.py Path/Op/Gui/Pocket.py Path/Op/Gui/PocketBase.py diff --git a/src/Mod/Path/Gui/Resources/Path.qrc b/src/Mod/Path/Gui/Resources/Path.qrc index b42e80563e..9df08eafa8 100644 --- a/src/Mod/Path/Gui/Resources/Path.qrc +++ b/src/Mod/Path/Gui/Resources/Path.qrc @@ -32,7 +32,6 @@ icons/Path_FaceProfile.svg icons/Path_Heights.svg icons/CAM_Helix.svg - icons/Path_Hop.svg icons/CAM_Inspect.svg icons/CAM_Job.svg icons/Path_Kurve.svg diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Hop.svg b/src/Mod/Path/Gui/Resources/icons/Path_Hop.svg deleted file mode 100644 index 738c4b7df5..0000000000 --- a/src/Mod/Path/Gui/Resources/icons/Path_Hop.svg +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - Path_Hop - 2015-07-04 - https://www.freecad.org/wiki/index.php?title=Artwork - - - FreeCAD - - - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Hop.svg - - - FreeCAD LGPL2+ - - - https://www.gnu.org/copyleft/lesser.html - - - [agryson] Alexander Gryson - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Mod/Path/Path/GuiInit.py b/src/Mod/Path/Path/GuiInit.py index 65819c6edb..545bcf8ece 100644 --- a/src/Mod/Path/Path/GuiInit.py +++ b/src/Mod/Path/Path/GuiInit.py @@ -63,7 +63,6 @@ def Startup(): from Path.Op.Gui import Drilling from Path.Op.Gui import Engrave from Path.Op.Gui import Helix - from Path.Op.Gui import Hop from Path.Op.Gui import MillFace from Path.Op.Gui import Pocket from Path.Op.Gui import PocketShape diff --git a/src/Mod/Path/Path/Op/Gui/Hop.py b/src/Mod/Path/Path/Op/Gui/Hop.py deleted file mode 100644 index 789e728cb1..0000000000 --- a/src/Mod/Path/Path/Op/Gui/Hop.py +++ /dev/null @@ -1,147 +0,0 @@ -# -*- coding: utf-8 -*- -# *************************************************************************** -# * Copyright (c) 2014 Yorik van Havre * -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU Lesser General Public License (LGPL) * -# * as published by the Free Software Foundation; either version 2 of * -# * the License, or (at your option) any later version. * -# * for detail see the LICENCE text file. * -# * * -# * This program is distributed in the hope that it will be useful, * -# * but WITHOUT ANY WARRANTY; without even the implied warranty of * -# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -# * GNU Library General Public License for more details. * -# * * -# * You should have received a copy of the GNU Library General Public * -# * License along with this program; if not, write to the Free Software * -# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -# * USA * -# * * -# *************************************************************************** - -import FreeCAD -import FreeCADGui -import Path -from PySide.QtCore import QT_TRANSLATE_NOOP - -__doc__ = """Path Hop object and FreeCAD command""" - -translate = FreeCAD.Qt.translate - - -class ObjectHop: - def __init__(self, obj): - obj.addProperty( - "App::PropertyLink", - "NextObject", - "Path", - QT_TRANSLATE_NOOP("App::Property", "The object to be reached by this hop"), - ) - obj.addProperty( - "App::PropertyDistance", - "HopHeight", - "Path", - QT_TRANSLATE_NOOP("App::Property", "The Z height of the hop"), - ) - obj.Proxy = self - - def dumps(self): - return None - - def loads(self, state): - return None - - def execute(self, obj): - nextpoint = FreeCAD.Vector() - if obj.NextObject: - if obj.NextObject.isDerivedFrom("Path::Feature"): - # look for the first position of the next path - for c in obj.NextObject.Path.Commands: - if c.Name in ["G0", "G00", "G1", "G01", "G2", "G02", "G3", "G03"]: - nextpoint = c.Placement.Base - break - - # absolute coords, millimeters, cancel offsets - output = "G90\nG21\nG40\n" - - # go up to the given height - output += "G0 Z" + str(obj.HopHeight.Value) + "\n" - - # go horizontally to the position of nextpoint - output += "G0 X" + str(nextpoint.x) + " Y" + str(nextpoint.y) + "\n" - - # print output - path = Path.Path(output) - obj.Path = path - - -class ViewProviderPathHop: - def __init__(self, vobj): - self.Object = vobj.Object - vobj.Proxy = self - - def attach(self, vobj): - self.Object = vobj.Object - - def getIcon(self): - return ":/icons/Path_Hop.svg" - - def dumps(self): - return None - - def loads(self, state): - return None - - -class CommandPathHop: - def GetResources(self): - return { - "Pixmap": "Path_Hop", - "MenuText": QT_TRANSLATE_NOOP("Path_Hop", "Hop"), - "ToolTip": QT_TRANSLATE_NOOP("Path_Hop", "Creates a Path Hop object"), - } - - def IsActive(self): - if FreeCAD.ActiveDocument is not None: - for o in FreeCAD.ActiveDocument.Objects: - if o.Name[:3] == "Job": - return True - return False - - def Activated(self): - - # check that the selection contains exactly what we want - selection = FreeCADGui.Selection.getSelection() - if len(selection) != 1: - FreeCAD.Console.PrintError( - translate("Path_Hop", "Please select one path object") + "\n" - ) - return - if not selection[0].isDerivedFrom("Path::Feature"): - FreeCAD.Console.PrintError( - translate("Path_Hop", "The selected object is not a path") + "\n" - ) - return - - FreeCAD.ActiveDocument.openTransaction("Create Hop") - FreeCADGui.addModule("Path.Op.Gui.Hop") - FreeCADGui.addModule("PathScripts.PathUtils") - FreeCADGui.doCommand( - 'obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Hop")' - ) - FreeCADGui.doCommand("Path.Op.Gui.Hop.ObjectHop(obj)") - FreeCADGui.doCommand("Path.Op.Gui.Hop.ViewProviderPathHop(obj.ViewObject)") - FreeCADGui.doCommand( - "obj.NextObject = FreeCAD.ActiveDocument." + selection[0].Name - ) - FreeCADGui.doCommand("PathScripts.PathUtils.addToJob(obj)") - FreeCAD.ActiveDocument.commitTransaction() - FreeCAD.ActiveDocument.recompute() - - -if FreeCAD.GuiUp: - # register the FreeCAD command - FreeCADGui.addCommand("Path_Hop", CommandPathHop()) - -FreeCAD.Console.PrintLog("Loading PathHop... done\n")