Skip to content

Commit

Permalink
Trying to Fix a Recursion Issue. I believe it is solved. Bumped to v0…
Browse files Browse the repository at this point in the history
….6.6
  • Loading branch information
wassimj committed May 23, 2024
1 parent db14891 commit 485a854
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/topologicpy/Wire.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,16 @@ def br(topology):
return boundingRectangle

@staticmethod
def ByEdges(edges: list, tolerance: float = 0.0001):
def ByEdges(edges: list, orient: bool = False, tolerance: float = 0.0001):
"""
Creates a wire from the input list of edges.
Parameters
----------
edges : list
The input list of edges.
orient : bool , optional
If set to True the edges are oriented head to tail. Otherwise, they are not. The default is False.
tolerance : float , optional
The desired tolerance. The default is 0.0001
Expand All @@ -285,6 +287,7 @@ def ByEdges(edges: list, tolerance: float = 0.0001):
"""
from topologicpy.Cluster import Cluster
from topologicpy.Topology import Topology

if not isinstance(edges, list):
return None
edgeList = [x for x in edges if Topology.IsInstance(x, "Edge")]
Expand All @@ -299,7 +302,8 @@ def ByEdges(edges: list, tolerance: float = 0.0001):
print("Wire.ByEdges - Error: The operation failed. Returning None.")
wire = None
if Wire.IsManifold(wire):
wire = Wire.OrientEdges(wire, Wire.StartVertex(wire), tolerance=tolerance)
if orient == True:
wire = Wire.OrientEdges(wire, Wire.StartVertex(wire), tolerance=tolerance)
return wire

@staticmethod
Expand Down Expand Up @@ -570,7 +574,7 @@ def ByVertices(vertices: list, close: bool = True, tolerance: float = 0.0001):
print("Wire.ByVertices - Error: The number of edges is less than 1. Returning None.")
return None
elif len(edges) == 1:
wire = Wire.ByEdges(edges)
wire = Wire.ByEdges(edges, orient=False)
else:
wire = Topology.SelfMerge(Cluster.ByTopologies(edges), tolerance=tolerance)
return wire
Expand Down Expand Up @@ -1937,7 +1941,6 @@ def OrientEdges(wire, vertexA, tolerance=0.0001):
return None
oriented_edges = []
remaining_edges = Topology.Edges(wire)

current_vertex = vertexA
while remaining_edges:
next_edge = None
Expand Down
2 changes: 1 addition & 1 deletion src/topologicpy/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.6.4'
__version__ = '0.6.6'

0 comments on commit 485a854

Please sign in to comment.