topologicpy 0.4.88__py3-none-any.whl → 0.4.89__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
topologicpy/Graph.py CHANGED
@@ -5046,12 +5046,14 @@ class Graph:
5046
5046
  for edge in Topology.Edges(temp_path):
5047
5047
  new_edges.append(g_edges[Edge.Index(edge, g_edges)])
5048
5048
  longest_path = Topology.SelfMerge(Cluster.ByTopologies(new_edges), tolerance=tolerance)
5049
+
5049
5050
  sv = Topology.Vertices(longest_path)[0]
5050
5051
  if Vertex.Distance(sv, vertexB) < tolerance: # Wire is reversed. Re-reverse it
5051
5052
  if isinstance(longest_path, topologic.Edges):
5052
5053
  longest_path = Edge.Reverse(longest_path)
5053
5054
  if isinstance(longest_path, topologic.Wire):
5054
5055
  longest_path = Wire.Reverse(longest_path)
5056
+ longest_path = Wire.OrientEdges(longest_path, Wire.StartVertex(longest_path), tolerance=tolerance)
5055
5057
  if not costKey == None:
5056
5058
  lengths.sort()
5057
5059
  d = Dictionary.ByKeysValues([costKey], [cost])
@@ -5702,7 +5704,7 @@ class Graph:
5702
5704
  return scores
5703
5705
 
5704
5706
  @staticmethod
5705
- def Path(graph, vertexA, vertexB):
5707
+ def Path(graph, vertexA, vertexB, tolerance=0.0001):
5706
5708
  """
5707
5709
  Returns a path (wire) in the input graph that connects the input vertices.
5708
5710
 
@@ -5714,6 +5716,8 @@ class Graph:
5714
5716
  The first input vertex.
5715
5717
  vertexB : topologic.Vertex
5716
5718
  The second input vertex.
5719
+ tolerance : float, optional
5720
+ The desired tolerance. The default is 0.0001.
5717
5721
 
5718
5722
  Returns
5719
5723
  -------
@@ -5721,6 +5725,8 @@ class Graph:
5721
5725
  The path (wire) in the input graph that connects the input vertices.
5722
5726
 
5723
5727
  """
5728
+ from topologicpy.Wire import Wire
5729
+
5724
5730
  if not isinstance(graph, topologic.Graph):
5725
5731
  print("Graph.Path - Error: The input graph is not a valid graph. Returning None.")
5726
5732
  return None
@@ -5730,7 +5736,11 @@ class Graph:
5730
5736
  if not isinstance(vertexB, topologic.Vertex):
5731
5737
  print("Graph.Path - Error: The input vertexB is not a valid vertex. Returning None.")
5732
5738
  return None
5733
- return graph.Path(vertexA, vertexB)
5739
+ path = graph.Path(vertexA, vertexB)
5740
+ if isinstance(path, topologic.Wire):
5741
+ path = Wire.OrientEdges(path, Wire.StartVertex(path), tolerance=tolerance)
5742
+ return path
5743
+
5734
5744
 
5735
5745
  @staticmethod
5736
5746
  def PyvisGraph(graph, path, overwrite=True, height=900, backgroundColor="white", fontColor="black", notebook=False,
@@ -6056,6 +6066,7 @@ class Graph:
6056
6066
  if Vertex.Distance(sv, gev) < tolerance: # Path is reversed. Correct it.
6057
6067
  if isinstance(shortest_path, topologic.Wire):
6058
6068
  shortest_path = Wire.Reverse(shortest_path)
6069
+ shortest_path = Wire.OrientEdges(shortest_path, Wire.StartVertex(shortest_path), tolerance=tolerance)
6059
6070
  return shortest_path
6060
6071
  except:
6061
6072
  return None
topologicpy/Wire.py CHANGED
@@ -281,6 +281,8 @@ class Wire(Topology):
281
281
  if not isinstance(wire, topologic.Wire):
282
282
  print("Wire.ByEdges - Error: The operation failed. Returning None.")
283
283
  wire = None
284
+ if Wire.IsManifold(wire):
285
+ wire = Wire.OrientEdges(wire, Wire.StartVertex(wire), tolerance=tolerance)
284
286
  return wire
285
287
 
286
288
  @staticmethod
@@ -567,7 +569,10 @@ class Wire(Topology):
567
569
  if len(edges) < 1:
568
570
  print("Wire.ByVertices - Error: The number of edges is less than 1. Returning None.")
569
571
  return None
570
- wire = Topology.SelfMerge(Cluster.ByTopologies(edges), tolerance=tolerance)
572
+ elif len(edges) == 1:
573
+ wire = topologic.Wire.ByEdges(edges)
574
+ else:
575
+ wire = Topology.SelfMerge(Cluster.ByTopologies(edges), tolerance=tolerance)
571
576
  return wire
572
577
 
573
578
  @staticmethod
@@ -1953,6 +1958,65 @@ class Wire(Topology):
1953
1958
  vertices.append(Edge.EndVertex(edge))
1954
1959
  return Wire.ByVertices(vertices)
1955
1960
 
1961
+ @staticmethod
1962
+ def OrientEdges(wire, vertexA, tolerance=0.0001):
1963
+ """
1964
+ Returns a correctly oriented head-to-tail version of the input wire. The input wire must be manifold.
1965
+
1966
+ Parameters
1967
+ ----------
1968
+ wire : topologic.Wire
1969
+ The input wire.
1970
+ vertexA : topologic.Vertex
1971
+ The desired start vertex of the wire.
1972
+ tolerance : float, optional
1973
+ The desired tolerance. The default is 0.0001.
1974
+
1975
+ Returns
1976
+ -------
1977
+ topologic.Wire
1978
+ The oriented wire.
1979
+
1980
+ """
1981
+ from topologicpy.Vertex import Vertex
1982
+ from topologicpy.Edge import Edge
1983
+
1984
+ if not isinstance(wire, topologic.Wire):
1985
+ print("Wire.OrientEdges - Error: The input wire parameter is not a valid wire. Returning None.")
1986
+ return None
1987
+ if not isinstance(vertexA, topologic.Vertex):
1988
+ print("Wire.OrientEdges - Error: The input vertexA parameter is not a valid vertex. Returning None.")
1989
+ return None
1990
+ if not Wire.IsManifold(wire):
1991
+ print("Wire.OrientEdges - Error: The input wire parameter is not a manifold wire. Returning None.")
1992
+ return None
1993
+ oriented_edges = []
1994
+ remaining_edges = Topology.Edges(wire)
1995
+
1996
+ current_vertex = vertexA
1997
+ while remaining_edges:
1998
+ next_edge = None
1999
+ for edge in remaining_edges:
2000
+ if Vertex.Distance(Edge.StartVertex(edge), current_vertex) < tolerance:
2001
+ next_edge = edge
2002
+ break
2003
+ elif Vertex.Distance(Edge.EndVertex(edge), current_vertex) < tolerance:
2004
+ next_edge = Edge.Reverse(edge)
2005
+ break
2006
+
2007
+ if next_edge:
2008
+ oriented_edges.append(next_edge)
2009
+ remaining_edges.remove(next_edge)
2010
+ current_vertex = Edge.EndVertex(next_edge)
2011
+ else:
2012
+ # Unable to find a next edge connected to the current vertex
2013
+ break
2014
+ vertices = [Edge.StartVertex(oriented_edges[0])]
2015
+ for i, edge in enumerate(oriented_edges):
2016
+ vertices.append(Edge.EndVertex(edge))
2017
+
2018
+ return Wire.ByVertices(vertices, close=Wire.IsClosed(wire))
2019
+
1956
2020
  @staticmethod
1957
2021
  def Planarize(wire: topologic.Wire, origin: topologic.Vertex = None, mantissa: int = 6, tolerance: float = 0.0001) -> topologic.Wire:
1958
2022
  """
topologicpy/__init__.py CHANGED
@@ -18,7 +18,7 @@ import sys
18
18
  import os, re
19
19
  from sys import platform
20
20
 
21
- __version__ = '0.4.88'
21
+ __version__ = '0.4.89'
22
22
  __version_info__ = tuple([ int(num) for num in __version__.split('.')])
23
23
 
24
24
  if platform == 'win32':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.4.88
3
+ Version: 0.4.89
4
4
  Summary: An Advanced Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
5
5
  Author-email: Wassim Jabi <wassim.jabi@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/wassimj/TopologicPy
@@ -9,7 +9,7 @@ topologicpy/Dictionary.py,sha256=vGhiXPu7e7GsgQyTsX6rZBncnnrDlcYfM9xRb9h-l3U,247
9
9
  topologicpy/Edge.py,sha256=425HQJyERHdaCnr7mi5Nbdk8jSuupKyGXE9td01MN7k,45693
10
10
  topologicpy/EnergyModel.py,sha256=kl8N-6NsKwKeSUt6vWm0B-MBacw9vMymE6lbvymJdVM,51758
11
11
  topologicpy/Face.py,sha256=uQyrXVtFQYlYZxiywl1S4cCHIAfQMbgeJ40Af34-CmI,93617
12
- topologicpy/Graph.py,sha256=YSEftTd3TrXJ5dd94Po0MU_IlM39KQ8h8SksfXE-2iM,314844
12
+ topologicpy/Graph.py,sha256=rq0ZStL-1xGOUFGeOsFuUOUP8dSlurWtY-uuLx2C_5c,315393
13
13
  topologicpy/Grid.py,sha256=q6uAs8MGbdteYNbjqRjqlhFMquYAvSngwzxsFl9-338,17371
14
14
  topologicpy/Helper.py,sha256=vqBZE-CcHBeTCnzC9OzbRaCTx4XT4SZpPF__Vi19nDQ,16049
15
15
  topologicpy/Honeybee.py,sha256=ygiGMS7u-YQJWpK2CmkBuJu1DBABVUmpMdg9HewOhN4,20349
@@ -22,8 +22,8 @@ topologicpy/Speckle.py,sha256=zKqiHYuw7498W_9UWvDn2xsdBskhahNjJejxegMpbJA,14773
22
22
  topologicpy/Topology.py,sha256=6Pga5O3_awhRUMxF8_JiNOPgSWmCmqTVDfnJygnTtZk,287822
23
23
  topologicpy/Vector.py,sha256=57ZoYLd3chEQhjN8Sf1Wv_UR3klltLoaT8TQN0kP-f8,22166
24
24
  topologicpy/Vertex.py,sha256=A7hCI-WpHaemow4eDiaqVhZ0ekgifXcWFpa-82txwYM,55187
25
- topologicpy/Wire.py,sha256=l7EfmBuwl6qMsklkIMj24Mvgb2342YRHPSEdooHYFsw,134108
26
- topologicpy/__init__.py,sha256=bcuuRYHtXml9W3cu6-4pDBc4RjFj7tWY3HkM5Ur2ejI,1445
25
+ topologicpy/Wire.py,sha256=pM63N7c0YoNRNvMtt05CPY8bzP62BG5rFTerA0eELIc,136664
26
+ topologicpy/__init__.py,sha256=Y_R-8dvvLH7g2os2OWB_Swtrqf1jK5lFBmVvLWw5caA,1445
27
27
  topologicpy/bin/linux/topologic/__init__.py,sha256=XlFReDf3FWlYdM9uXtanYPIafgPb6GVTQczS_xJAXD0,60
28
28
  topologicpy/bin/linux/topologic/libTKBO-6bdf205d.so.7.7.0,sha256=ANok9DQKcnWcLd9T_LAt-i-X4nsYYy16q9kQlcTre1E,2996488
29
29
  topologicpy/bin/linux/topologic/libTKBRep-2960a069.so.7.7.0,sha256=OJ3XesL79du8LeBHrsleGPXub6OpJdOilxha0mwjqQo,1378768
@@ -84,8 +84,8 @@ topologicpy/bin/windows/topologic/topologic.cp310-win_amd64.pyd,sha256=F0sPLuMpD
84
84
  topologicpy/bin/windows/topologic/topologic.cp311-win_amd64.pyd,sha256=aBAJQj3OmJ58MOAF1ZIFybL_5fFK7FNR9hrIps6b6pc,1551872
85
85
  topologicpy/bin/windows/topologic/topologic.cp38-win_amd64.pyd,sha256=aLgNf54nbJmGc7Tdmkuy-V0m6B9zLxabIbpRwAy7cBA,1551360
86
86
  topologicpy/bin/windows/topologic/topologic.cp39-win_amd64.pyd,sha256=_8cp205hiRxkFHtzQQOweA4DhCPk8caH4kTVLWGQeVw,1411584
87
- topologicpy-0.4.88.dist-info/LICENSE,sha256=RUmXeeqj63bBySLJjEfhwb9OE7M8h9K6HuOBF3ASVyI,35697
88
- topologicpy-0.4.88.dist-info/METADATA,sha256=sG41klx83222pQaDnTv93Z_MX89sgVRs4FzoGErED2k,7278
89
- topologicpy-0.4.88.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
90
- topologicpy-0.4.88.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
91
- topologicpy-0.4.88.dist-info/RECORD,,
87
+ topologicpy-0.4.89.dist-info/LICENSE,sha256=RUmXeeqj63bBySLJjEfhwb9OE7M8h9K6HuOBF3ASVyI,35697
88
+ topologicpy-0.4.89.dist-info/METADATA,sha256=ZZRlJuY_SBnyqOUJAqYHr89-yPq-neQwL-Sx8XTbOBQ,7278
89
+ topologicpy-0.4.89.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
90
+ topologicpy-0.4.89.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
91
+ topologicpy-0.4.89.dist-info/RECORD,,