If an edge cannot be flipped, issue a warning and approximate it through straight line segments.

This commit is contained in:
Markus Lampert
2018-08-21 20:37:09 -07:00
committed by Yorik van Havre
parent 999332e633
commit f06306794c
2 changed files with 14 additions and 1 deletions

View File

@@ -380,7 +380,18 @@ class MapWireToTag:
debugEdge(e, ">>>>> no flip")
break
elif PathGeom.pointsCoincide(p2, p0):
outputEdges.append((PathGeom.flipEdge(e), True))
flipped = PathGeom.flipEdge(e)
if not flipped is None:
outputEdges.append((flipped, True))
else:
p0 = None
cnt = 0
for p in reversed(e.discretize(Deflection=0.01)):
if not p0 is None:
outputEdges.append((Part.Edge(Part.LineSegment(p0, p)), True))
cnt = cnt + 1
p0 = p
PathLog.info("replaced edge with %d straight segments" % cnt)
edges.remove(e)
lastP = None
p0 = p1

View File

@@ -507,6 +507,8 @@ def flipEdge(edge):
return Part.Edge(flipped)
PathLog.warning(translate('PathGeom', "%s not support for flipping") % type(edge.Curve))
def flipWire(wire):
'''Flip the entire wire and all its edges so it is being processed the other way around.'''
edges = [flipEdge(e) for e in wire.Edges]