From feea1340f50a23c51efb3fffb861945049ff3183 Mon Sep 17 00:00:00 2001 From: Christian Mesh Date: Sun, 26 Feb 2023 11:18:07 -0500 Subject: [PATCH] Integrate getPathWithPlacement into Dressup --- src/Mod/Path/Path/Dressup/Boundary.py | 7 ++++--- src/Mod/Path/Path/Dressup/DogboneII.py | 3 ++- src/Mod/Path/Path/Dressup/Gui/AxisMap.py | 2 +- src/Mod/Path/Path/Dressup/Gui/Dogbone.py | 2 +- src/Mod/Path/Path/Dressup/Gui/Dragknife.py | 2 +- src/Mod/Path/Path/Dressup/Gui/LeadInOut.py | 4 ++-- src/Mod/Path/Path/Dressup/Gui/RampEntry.py | 2 +- src/Mod/Path/Path/Dressup/Gui/ZCorrect.py | 7 ++++--- src/Mod/Path/Path/Dressup/Tags.py | 7 ++++--- 9 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/Mod/Path/Path/Dressup/Boundary.py b/src/Mod/Path/Path/Dressup/Boundary.py index 9194b0d6d7..08a4293fd6 100644 --- a/src/Mod/Path/Path/Dressup/Boundary.py +++ b/src/Mod/Path/Path/Dressup/Boundary.py @@ -149,7 +149,8 @@ class PathBoundary: ): return None - if len(self.baseOp.Path.Commands) == 0: + path = PathUtils.getPathWithPlacement(self.baseOp) + if len(path.Commands) == 0: Path.Log.warning("No Path Commands for %s" % self.baseOp.Label) return [] @@ -164,13 +165,13 @@ class PathBoundary: ) self.strG0ZclearanceHeight = Path.Command("G0", {"Z": self.clearanceHeight}) - cmd = self.baseOp.Path.Commands[0] + cmd = path.Commands[0] pos = cmd.Placement.Base # bogus m/c position to create first edge bogusX = True bogusY = True commands = [cmd] lastExit = None - for cmd in self.baseOp.Path.Commands[1:]: + for cmd in path.Commands[1:]: if cmd.Name in Path.Geom.CmdMoveAll: if bogusX: bogusX = "X" not in cmd.Parameters diff --git a/src/Mod/Path/Path/Dressup/DogboneII.py b/src/Mod/Path/Path/Dressup/DogboneII.py index f4fa0243f6..2e4f74bd32 100644 --- a/src/Mod/Path/Path/Dressup/DogboneII.py +++ b/src/Mod/Path/Path/Dressup/DogboneII.py @@ -25,6 +25,7 @@ import FreeCAD import Path import Path.Base.Generator.dogboneII as dogboneII import Path.Base.Language as PathLanguage +import PathScripts.PathUtils as PathUtils import math if False: @@ -294,7 +295,7 @@ class Proxy(object): dressingUpDogbone = hasattr(obj.Base, "BoneBlacklist") if obj.Base and obj.Base.Path and obj.Base.Path.Commands: for i, instr in enumerate( - PathLanguage.Maneuver.FromPath(obj.Base.Path).instr + PathLanguage.Maneuver.FromPath(PathUtils.getPathWithPlacement(obj.Base)).instr ): # Path.Log.debug(f"instr: {instr}") if instr.isMove(): diff --git a/src/Mod/Path/Path/Dressup/Gui/AxisMap.py b/src/Mod/Path/Path/Dressup/Gui/AxisMap.py index 2cd1497a06..8a980d18c6 100644 --- a/src/Mod/Path/Path/Dressup/Gui/AxisMap.py +++ b/src/Mod/Path/Path/Dressup/Gui/AxisMap.py @@ -114,7 +114,7 @@ class ObjectDressup: if obj.Base.isDerivedFrom("Path::Feature"): if obj.Base.Path: if obj.Base.Path.Commands: - pp = obj.Base.Path.Commands + pp = PathUtils.getPathWithPlacement(obj.Base).Commands if len([i for i in pp if i.Name in Path.Geom.CmdMoveArc]) == 0: pathlist = pp else: diff --git a/src/Mod/Path/Path/Dressup/Gui/Dogbone.py b/src/Mod/Path/Path/Dressup/Gui/Dogbone.py index 8dbc31bded..74e85eea41 100644 --- a/src/Mod/Path/Path/Dressup/Gui/Dogbone.py +++ b/src/Mod/Path/Path/Dressup/Gui/Dogbone.py @@ -911,7 +911,7 @@ class ObjectDressup(object): self.length = 0 # boneIserted = False - for (i, thisCommand) in enumerate(obj.Base.Path.Commands): + for (i, thisCommand) in enumerate(PathUtils.getPathWithPlacement(obj.Base).Commands): # if i > 14: # if lastCommand: # commands.append(lastCommand) diff --git a/src/Mod/Path/Path/Dressup/Gui/Dragknife.py b/src/Mod/Path/Path/Dressup/Gui/Dragknife.py index 56f36b8790..783c0a77e5 100644 --- a/src/Mod/Path/Path/Dressup/Gui/Dragknife.py +++ b/src/Mod/Path/Path/Dressup/Gui/Dragknife.py @@ -389,7 +389,7 @@ class ObjectDressup: queue = [] - for curCommand in obj.Base.Path.Commands: + for curCommand in PathUtils.getPathWithPlacement(obj.Base).Commands: replace = None # don't worry about non-move commands, just add to output if curCommand.Name not in movecommands + rapidcommands: diff --git a/src/Mod/Path/Path/Dressup/Gui/LeadInOut.py b/src/Mod/Path/Path/Dressup/Gui/LeadInOut.py index 9ce7e97fde..e965ab257d 100644 --- a/src/Mod/Path/Path/Dressup/Gui/LeadInOut.py +++ b/src/Mod/Path/Path/Dressup/Gui/LeadInOut.py @@ -189,7 +189,7 @@ class ObjectDressup: + "\n" ) obj.Length = 0.1 - self.wire, self.rapids = Path.Geom.wireForPath(obj.Base.Path) + self.wire, self.rapids = Path.Geom.wireForPath(PathUtils.getPathWithPlacement(obj.Base)) obj.Path = self.generateLeadInOutCurve(obj) def getDirectionOfPath(self, obj): @@ -557,7 +557,7 @@ class ObjectDressup: layers = [] # Read in all commands - for curCommand in obj.Base.Path.Commands: + for curCommand in PathUtils.getPathWithPlacement(obj.Base).Commands: Path.Log.debug("CurCMD: {}".format(curCommand)) if curCommand.Name not in movecommands + rapidcommands: # Don't worry about non-move commands, just add to output diff --git a/src/Mod/Path/Path/Dressup/Gui/RampEntry.py b/src/Mod/Path/Path/Dressup/Gui/RampEntry.py index 820f9516eb..697dd87501 100644 --- a/src/Mod/Path/Path/Dressup/Gui/RampEntry.py +++ b/src/Mod/Path/Path/Dressup/Gui/RampEntry.py @@ -222,7 +222,7 @@ class ObjectDressup: self.angle = obj.Angle self.method = obj.Method - self.wire, self.rapids = Path.Geom.wireForPath(obj.Base.Path) + self.wire, self.rapids = Path.Geom.wireForPath(PathUtils.getPathWithPlacement(obj.Base)) if self.method in ["RampMethod1", "RampMethod2", "RampMethod3"]: self.outedges = self.generateRamps() else: diff --git a/src/Mod/Path/Path/Dressup/Gui/ZCorrect.py b/src/Mod/Path/Path/Dressup/Gui/ZCorrect.py index c591a02867..baa9fc0ee8 100644 --- a/src/Mod/Path/Path/Dressup/Gui/ZCorrect.py +++ b/src/Mod/Path/Path/Dressup/Gui/ZCorrect.py @@ -155,7 +155,7 @@ class ObjectDressup: curveD = obj.ArcInterpolate.Value if obj.interpSurface.isNull(): # No valid probe data. return unchanged path - obj.Path = obj.Base.Path + obj.Path = PathUtils.getPathWithPlacement(obj.Base) return surface = obj.interpSurface.toNurbs().Faces[0].Surface @@ -163,8 +163,9 @@ class ObjectDressup: if obj.Base: if obj.Base.isDerivedFrom("Path::Feature"): if obj.Base.Path: - if obj.Base.Path.Commands: - pathlist = obj.Base.Path.Commands + path = PathUtils.getPathWithPlacement(obj.Base) + if path.Commands: + pathlist = path.Commands newcommandlist = [] currLocation = {"X": 0, "Y": 0, "Z": 0, "F": 0} diff --git a/src/Mod/Path/Path/Dressup/Tags.py b/src/Mod/Path/Path/Dressup/Tags.py index bc4adec927..f951724909 100644 --- a/src/Mod/Path/Path/Dressup/Tags.py +++ b/src/Mod/Path/Path/Dressup/Tags.py @@ -675,7 +675,8 @@ class PathData: def __init__(self, obj): Path.Log.track(obj.Base.Name) self.obj = obj - self.wire, rapid = Path.Geom.wireForPath(obj.Base.Path) + path = PathUtils.getPathWithPlacement(obj.Base) + self.wire, rapid = Path.Geom.wireForPath(path) self.rapid = _RapidEdges(rapid) if self.wire: self.edges = self.wire.Edges @@ -1256,7 +1257,7 @@ class ObjectTagDressup: if not self.tags: Path.Log.debug("execute - no tags") - obj.Path = obj.Base.Path + obj.Path = PathUtils.getPathWithPlacement(obj.Base) return try: @@ -1265,7 +1266,7 @@ class ObjectTagDressup: Path.Log.error( "processing tags failed clearing all tags ... '%s'" % (e.args[0]) ) - obj.Path = obj.Base.Path + obj.Path = PathUtils.getPathWithPlacement(obj.Base) # update disabled in case there are some additional ones disabled = copy.copy(self.obj.Disabled)