Integrate getPathWithPlacement into Dressup

This commit is contained in:
Christian Mesh
2023-02-26 11:18:07 -05:00
parent be6bd4c95d
commit feea1340f5
9 changed files with 20 additions and 16 deletions

View File

@@ -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

View File

@@ -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():

View File

@@ -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:

View File

@@ -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)

View File

@@ -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:

View File

@@ -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

View File

@@ -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:

View File

@@ -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}

View File

@@ -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)