本文整理汇总了Python中PathScripts.PathGeom.PathGeom.edgeConnectsTo方法的典型用法代码示例。如果您正苦于以下问题:Python PathGeom.edgeConnectsTo方法的具体用法?Python PathGeom.edgeConnectsTo怎么用?Python PathGeom.edgeConnectsTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathScripts.PathGeom.PathGeom
的用法示例。
在下文中一共展示了PathGeom.edgeConnectsTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cleanupEdges
# 需要导入模块: from PathScripts.PathGeom import PathGeom [as 别名]
# 或者: from PathScripts.PathGeom.PathGeom import edgeConnectsTo [as 别名]
def cleanupEdges(self, edges):
# want to remove all edges from the wire itself, and all internal struts
PathLog.track("+cleanupEdges")
PathLog.debug(" edges:")
if not edges:
return edges
for e in edges:
debugEdge(e, ' ')
PathLog.debug(":")
self.edgesCleanup = [copy.copy(edges)]
# remove any edge that has a point inside the tag solid
# and collect all edges that are connected to the entry and/or exit
self.entryEdges = []
self.exitEdges = []
self.edgePoints = []
for e in copy.copy(edges):
p1 = e.valueAt(e.FirstParameter)
p2 = e.valueAt(e.LastParameter)
self.edgePoints.append(p1)
self.edgePoints.append(p2)
if self.tag.solid.isInside(p1, PathGeom.Tolerance, False) or self.tag.solid.isInside(p2, PathGeom.Tolerance, False):
edges.remove(e)
debugEdge(e, '......... X0', False)
else:
if PathGeom.pointsCoincide(p1, self.entry) or PathGeom.pointsCoincide(p2, self.entry):
self.entryEdges.append(e)
if PathGeom.pointsCoincide(p1, self.exit) or PathGeom.pointsCoincide(p2, self.exit):
self.exitEdges.append(e)
self.edgesCleanup.append(copy.copy(edges))
# if there are no edges connected to entry/exit, it means the plunge in/out is vertical
# we need to add in the missing segment and collect the new entry/exit edges.
if not self.entryEdges:
print("fill entryEdges ...")
self.realEntry = sorted(self.edgePoints, key=lambda p: (p - self.entry).Length)[0]
self.entryEdges = filter(lambda e: PathGeom.edgeConnectsTo(e, self.realEntry), edges)
edges.append(Part.Edge(Part.LineSegment(self.entry, self.realEntry)))
else:
self.realEntry = None
if not self.exitEdges:
print("fill exitEdges ...")
self.realExit = sorted(self.edgePoints, key=lambda p: (p - self.exit).Length)[0]
self.exitEdges = filter(lambda e: PathGeom.edgeConnectsTo(e, self.realExit), edges)
edges.append(Part.Edge(Part.LineSegment(self.realExit, self.exit)))
else:
self.realExit = None
self.edgesCleanup.append(copy.copy(edges))
# if there are 2 edges attached to entry/exit, throw away the one that is "lower"
if len(self.entryEdges) > 1:
debugEdge(self.entryEdges[0], ' entry[0]', False)
debugEdge(self.entryEdges[1], ' entry[1]', False)
if self.entryEdges[0].BoundBox.ZMax < self.entryEdges[1].BoundBox.ZMax:
edges.remove(self.entryEdges[0])
debugEdge(e, '......... X1', False)
else:
edges.remove(self.entryEdges[1])
debugEdge(e, '......... X2', False)
if len(self.exitEdges) > 1:
debugEdge(self.exitEdges[0], ' exit[0]', False)
debugEdge(self.exitEdges[1], ' exit[1]', False)
if self.exitEdges[0].BoundBox.ZMax < self.exitEdges[1].BoundBox.ZMax:
if self.exitEdges[0] in edges:
edges.remove(self.exitEdges[0])
debugEdge(e, '......... X3', False)
else:
if self.exitEdges[1] in edges:
edges.remove(self.exitEdges[1])
debugEdge(e, '......... X4', False)
self.edgesCleanup.append(copy.copy(edges))
return edges