topologicpy 0.8.90__py3-none-any.whl → 0.8.91__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
@@ -22,6 +22,7 @@ import warnings
22
22
 
23
23
  from collections import namedtuple
24
24
  from multiprocessing import Process, Queue
25
+ from typing import Any
25
26
 
26
27
  try:
27
28
  import numpy as np
@@ -15540,7 +15541,16 @@ class Graph:
15540
15541
  return graph
15541
15542
 
15542
15543
  @staticmethod
15543
- def ShortestPath(graph, vertexA, vertexB, vertexKey="", edgeKey="Length", tolerance=0.0001):
15544
+ def ShortestPath(graph,
15545
+ vertexA,
15546
+ vertexB,
15547
+ vertexKey: str = "",
15548
+ edgeKey: str = "Length",
15549
+ transferDictionaries: bool = False,
15550
+ straighten: bool = False,
15551
+ face: Any = None,
15552
+ tolerance: float = 0.0001,
15553
+ silent: bool = False):
15544
15554
  """
15545
15555
  Returns the shortest path that connects the input vertices. The shortest path will take into consideration both the vertexKey and the edgeKey if both are specified and will minimize the total "cost" of the path. Otherwise, it will take into consideration only whatever key is specified.
15546
15556
 
@@ -15556,8 +15566,19 @@ class Graph:
15556
15566
  The vertex key to minimise. If set the vertices dictionaries will be searched for this key and the associated value will be used to compute the shortest path that minimized the total value. The value must be numeric. Default is None.
15557
15567
  edgeKey : string , optional
15558
15568
  The edge key to minimise. If set the edges dictionaries will be searched for this key and the associated value will be used to compute the shortest path that minimized the total value. The value of the key must be numeric. If set to "length" (case insensitive), the shortest path by length is computed. Default is "length".
15569
+ transferDictionaries : bool , optional
15570
+ If set to True, the dictionaries from the graph vertices will be transferred to the vertices of the shortest path. Otherwise, they won't. Default is False.
15571
+ Note: Edge dictionaries are not transferred (In straightened paths, the path edges are no longer the same as
15572
+ the original graph edges. Thus, you must implement your own logic to transfer edge dictionaries if needed).
15573
+ straighten : bool , optional
15574
+ If set to True, the path will be straightened as much as possible while remaining inside the specified face.
15575
+ Thus, the face input must be a valid topologic Face that is planar and residing on the XY plane. Default is False.
15576
+ face : topologic_core.Face , optional
15577
+ The face on which the path resides. This is used for straightening the path. Default is None.
15559
15578
  tolerance : float , optional
15560
15579
  The desired tolerance. Default is 0.0001.
15580
+ silent : bool , optional
15581
+ If set to True, error and warning messages are suppressed. Default is False.
15561
15582
 
15562
15583
  Returns
15563
15584
  -------
@@ -15570,14 +15591,22 @@ class Graph:
15570
15591
  from topologicpy.Topology import Topology
15571
15592
 
15572
15593
  if not Topology.IsInstance(graph, "Graph"):
15573
- print("Graph.ShortestPath - Error: The input graph is not a valid graph. Returning None.")
15594
+ if not silent:
15595
+ print("Graph.ShortestPath - Error: The input graph is not a valid graph. Returning None.")
15574
15596
  return None
15575
15597
  if not Topology.IsInstance(vertexA, "Vertex"):
15576
- print("Graph.ShortestPath - Error: The input vertexA is not a valid vertex. Returning None.")
15598
+ if not silent:
15599
+ print("Graph.ShortestPath - Error: The input vertexA is not a valid vertex. Returning None.")
15577
15600
  return None
15578
15601
  if not Topology.IsInstance(vertexB, "Vertex"):
15579
- print("Graph.ShortestPath - Error: The input vertexB is not a valid vertex. Returning None.")
15602
+ if not silent:
15603
+ print("Graph.ShortestPath - Error: The input vertexB is not a valid vertex. Returning None.")
15580
15604
  return None
15605
+ if straighten == True:
15606
+ if not Topology.IsInstance(face, "face"):
15607
+ if not silent:
15608
+ print("Graph.ShortestPath - Error: Straighten is set to True, but the face parameter is not a valid toopologic face. Returning None.")
15609
+ return None
15581
15610
  if edgeKey:
15582
15611
  if edgeKey.lower() == "length":
15583
15612
  edgeKey = "Length"
@@ -15593,74 +15622,18 @@ class Graph:
15593
15622
  if Topology.IsInstance(shortest_path, "Wire"):
15594
15623
  shortest_path = Wire.Reverse(shortest_path)
15595
15624
  shortest_path = Wire.OrientEdges(shortest_path, Wire.StartVertex(shortest_path), tolerance=tolerance)
15625
+ if Topology.IsInstance(shortest_path, "wire"):
15626
+ if straighten == True and Topology.IsInstance(face, "face"):
15627
+ shortest_path = Wire.StraightenInFace(shortest_path, face)
15628
+ if transferDictionaries == True:
15629
+ path_verts = Topology.Vertices(shortest_path)
15630
+ for p_v in path_verts:
15631
+ g_v = Graph.NearestVertex(graph, p_v)
15632
+ p_v = Topology.SetDictionary(p_v, Topology.Dictionary(g_v))
15596
15633
  return shortest_path
15597
15634
  except:
15598
15635
  return None
15599
15636
 
15600
- @staticmethod
15601
- def shortestPathInFace(graph, face, vertexA, vertexB, mode: int = 0, meshSize: float = None, tolerance: float = 0.0001, silent: bool = False):
15602
- """
15603
- Returns the shortest path that connects the input vertices.
15604
-
15605
- Parameters
15606
- ----------
15607
- face : topologic_core.Face
15608
- The input face. This is assumed to be planar and resting on the XY plane (z = 0)
15609
- vertexA : topologic_core.Vertex
15610
- The first input vertex.
15611
- vertexB : topologic_core.Vertex
15612
- The second input vertex.
15613
- mode : int , optional
15614
- The desired mode of meshing algorithm. Several options are available:
15615
- 0: Classic
15616
- 1: MeshAdapt
15617
- 3: Initial Mesh Only
15618
- 5: Delaunay
15619
- 6: Frontal-Delaunay
15620
- 7: BAMG
15621
- 8: Fontal-Delaunay for Quads
15622
- 9: Packing of Parallelograms
15623
- All options other than 0 (Classic) use the gmsh library. See https://gmsh.info/doc/texinfo/gmsh.html#Mesh-options
15624
- WARNING: The options that use gmsh can be very time consuming and can create very heavy geometry.
15625
- meshSize : float , optional
15626
- The desired size of the mesh when using the "mesh" option. If set to None, it will be
15627
- calculated automatically and set to 10% of the overall size of the face.
15628
- tolerance : float , optional
15629
- The desired tolerance. Default is 0.0001.
15630
- silent : bool , optional
15631
- If set to True, error and warning messages are suppressed. Default is False.
15632
-
15633
- Returns
15634
- -------
15635
- topologic_core.Wire
15636
- The shortest path between the input vertices.
15637
-
15638
- """
15639
- from topologicpy.Wire import Wire
15640
- from topologicpy.Topology import Topology
15641
-
15642
- if not Topology.IsInstance(face, "face"):
15643
- if not silent:
15644
- print("Face.ShortestPath - Error: The input face parameter is not a topologic face. Returning None.")
15645
- return None
15646
- if not Topology.IsInstance(vertexA, "vertex"):
15647
- if not silent:
15648
- print("Face.ShortestPath - Error: The input vertexA parameter is not a topologic vertex. Returning None.")
15649
- return None
15650
- if not Topology.IsInstance(vertexB, "vertex"):
15651
- if not silent:
15652
- print("Face.ShortestPath - Error: The input vertexB parameter is not a topologic vertex. Returning None.")
15653
- return None
15654
-
15655
- sp = Graph.ShortestPath(graph, vertexA, vertexB)
15656
- if sp == None:
15657
- if not silent:
15658
- print("Face.ShortestPath - Error: Could not find the shortest path. Returning None.")
15659
- return None
15660
-
15661
- new_path = Wire.StraightenInFace(sp, face, tolerance = tolerance)
15662
- return new_path
15663
-
15664
15637
  @staticmethod
15665
15638
  def ShortestPaths(graph, vertexA, vertexB, vertexKey="", edgeKey="length", timeLimit=10,
15666
15639
  pathLimit=10, tolerance=0.0001):
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.8.90'
1
+ __version__ = '0.8.91'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: topologicpy
3
- Version: 0.8.90
3
+ Version: 0.8.91
4
4
  Summary: An AI-Powered Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
5
5
  Author-email: Wassim Jabi <wassim.jabi@gmail.com>
6
6
  License: AGPL v3 License
@@ -12,7 +12,7 @@ topologicpy/Dictionary.py,sha256=goODXIM6AoC5Qn_d8LGc5pRoxZKgIWbkn3IOEbsQ4c4,449
12
12
  topologicpy/Edge.py,sha256=aiRd1xZgG2GGYHxva0bM-kDy3AVmwGA_S2pMur8EeMg,74911
13
13
  topologicpy/EnergyModel.py,sha256=MEai1GF1hINeH5bhclJj_lpMU3asFTvW2RlPm40GNj4,57794
14
14
  topologicpy/Face.py,sha256=qAl36LcwiyRclMM2pI9NyWHzmgNlaykXiJx1wu10RmA,201317
15
- topologicpy/Graph.py,sha256=c-n_9xKXizbyGGWBw62fECsqMo-UoqvQJz6nw82DWgA,811337
15
+ topologicpy/Graph.py,sha256=Tokxg55wHmx5hd9eai7EMRUdptADLt7HmJNrhq00UZk,810723
16
16
  topologicpy/Grid.py,sha256=3OsBMyHh4w8gpFOTMKHMNTpo62V0CwRNu5cwm87yDUA,18421
17
17
  topologicpy/Helper.py,sha256=NsmMlbbKFPRX6jfoko-ZQVQ7MBsfVp9FD0ZvC2U7q-8,32002
18
18
  topologicpy/Honeybee.py,sha256=dBk01jIvxjQMGHqSarM1Cukv16ot4Op7Dwlitn2OMoc,48990
@@ -31,9 +31,9 @@ topologicpy/Vector.py,sha256=pEC8YY3TeHGfGdeNgvdHjgMDwxGabp5aWjwYC1HSvMk,42236
31
31
  topologicpy/Vertex.py,sha256=26TrlX9OCZUN-lMlZG3g4RHTWBqw69NW4AOEgRz_YMo,91269
32
32
  topologicpy/Wire.py,sha256=Rhqw0CGEWIMVL1ICQqkCp9G-VnhhHLhEiDDR00fAn_s,248919
33
33
  topologicpy/__init__.py,sha256=RMftibjgAnHB1vdL-muo71RwMS4972JCxHuRHOlU428,928
34
- topologicpy/version.py,sha256=Vg4EZKvQvJEbHjPwL_FRDJq1bK9YEoQB3n1ijcuv9Dk,23
35
- topologicpy-0.8.90.dist-info/licenses/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
36
- topologicpy-0.8.90.dist-info/METADATA,sha256=Zk31JGzXHHQe7HU4kLuQ6SvCj6EnOW3PolmmmV1EepE,10535
37
- topologicpy-0.8.90.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
- topologicpy-0.8.90.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
39
- topologicpy-0.8.90.dist-info/RECORD,,
34
+ topologicpy/version.py,sha256=Pd3D7UyrHnkE76qM_AOq2A2ifXXq1OxDwEg8Q1gGwk8,23
35
+ topologicpy-0.8.91.dist-info/licenses/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
36
+ topologicpy-0.8.91.dist-info/METADATA,sha256=S_NaUxOVkvDCJJ4xVVdtRSLZnkW0tzPwic19V2FLkuw,10535
37
+ topologicpy-0.8.91.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
+ topologicpy-0.8.91.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
39
+ topologicpy-0.8.91.dist-info/RECORD,,