[Path] Fix Path generation for forking wires
This commit is contained in:
@@ -63,15 +63,23 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
"""buildpathocc(obj, wires, zValues, relZ=False) ... internal helper function to generate engraving commands."""
|
||||
PathLog.track(obj.Label, len(wires), zValues)
|
||||
|
||||
decomposewires = []
|
||||
for wire in wires:
|
||||
offset = wire
|
||||
decomposewires.extend(PathOpTools.makeWires(wire.Edges))
|
||||
|
||||
wires = decomposewires
|
||||
for wire in wires:
|
||||
# offset = wire
|
||||
|
||||
# reorder the wire
|
||||
if hasattr(obj, "StartVertex"):
|
||||
start_idx = obj.StartVertex
|
||||
edges = wire.Edges
|
||||
|
||||
edges = copy.copy(PathOpTools.orientWire(offset, forward).Edges)
|
||||
edges = Part.sortEdges(edges)[0]
|
||||
# edges = copy.copy(PathOpTools.orientWire(offset, forward).Edges)
|
||||
# PathLog.track("wire: {} offset: {}".format(len(wire.Edges), len(edges)))
|
||||
# edges = Part.sortEdges(edges)[0]
|
||||
# PathLog.track("edges: {}".format(len(edges)))
|
||||
|
||||
last = None
|
||||
|
||||
|
||||
@@ -82,6 +82,13 @@ def debugEdge(label, e):
|
||||
)
|
||||
|
||||
|
||||
def makeWires(inEdges):
|
||||
"""makeWires ... function to make non-forking wires from a collection of edges"""
|
||||
edgelists = Part.sortEdges(inEdges)
|
||||
result = [Part.Wire(e) for e in edgelists]
|
||||
return result
|
||||
|
||||
|
||||
def debugWire(label, w):
|
||||
"""debugWire(label, w) ... prints python statements for all edges of w to be added to the object tree in a group."""
|
||||
if not PrintWireDebug:
|
||||
@@ -160,7 +167,7 @@ def orientWire(w, forward=True):
|
||||
If forward = True (the default) the wire is oriented clockwise, looking down the negative Z axis.
|
||||
If forward = False the wire is oriented counter clockwise.
|
||||
If forward = None the orientation is determined by the order in which the edges appear in the wire."""
|
||||
PathLog.debug("orienting forward: {}".format(forward))
|
||||
PathLog.debug("orienting forward: {}: {} edges".format(forward, len(w.Edges)))
|
||||
wire = Part.Wire(_orientEdges(w.Edges))
|
||||
if forward is not None:
|
||||
if forward != _isWireClockwise(wire):
|
||||
|
||||
Reference in New Issue
Block a user