Path: Relocate edge preprocessing and apply UseOutline feature

Working edges must be identified from Base Geometry selection features, discretized, and added to list for return value.
This commit is contained in:
Russell Johnson
2021-02-05 18:07:16 -06:00
parent db9525e7d7
commit 0ba06f3831

View File

@@ -399,14 +399,9 @@ def Execute(op,obj):
if obj.Tolerance < 0.001:
obj.Tolerance = 0.001
pathArray = []
for base, subs in obj.Base:
for sub in subs:
shape = base.Shape.getElement(sub)
for edge in shape.Edges:
pathArray.append([discretize(edge)])
# Get list of working edges for adaptive algorithm
pathArray = _get_working_edges(op, obj)
#pathArray=connectEdges(edges)
path2d = convertTo2d(pathArray)
stockPaths = []
@@ -529,6 +524,35 @@ def Execute(op,obj):
sceneClean()
def _get_working_edges(op, obj):
"""_get_working_edges(op, obj)...
Compile all working edges from the Base Geometry selection (obj.Base)
for the current operation.
Additional modifications to selected region(face), such as extensions,
should be placed within this function.
"""
pathArray = list()
for base, subs in obj.Base:
for sub in subs:
if obj.UseOutline:
face = base.Shape.getElement(sub)
zmin = face.BoundBox.ZMin
# get face outline with same method in PocketShape
wire = TechDraw.findShapeOutline(face, 1, FreeCAD.Vector(0.0, 0.0, 1.0))
shape = Part.Face(wire)
# translate to face height if necessary
if shape.BoundBox.ZMin != zmin:
shape.translate(FreeCAD.Vector(0.0, 0.0, zmin - shape.BoundBox.ZMin))
else:
shape = base.Shape.getElement(sub)
for edge in shape.Edges:
pathArray.append([discretize(edge)])
return pathArray
class PathAdaptive(PathOp.ObjectOp):
def opFeatures(self, obj):
'''opFeatures(obj) ... returns the OR'ed list of features used and supported by the operation.