topologicpy 0.7.86__py3-none-any.whl → 0.7.90__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/Cell.py CHANGED
@@ -1471,7 +1471,7 @@ class Cell():
1471
1471
  return shells
1472
1472
 
1473
1473
  @staticmethod
1474
- def InternalVertex(cell, tolerance: float = 0.0001):
1474
+ def InternalVertex(cell, tolerance: float = 0.0001, silent: bool = False):
1475
1475
  """
1476
1476
  Creates a vertex that is guaranteed to be inside the input cell.
1477
1477
 
@@ -1481,6 +1481,8 @@ class Cell():
1481
1481
  The input cell.
1482
1482
  tolerance : float , optional
1483
1483
  The desired tolerance. The default is 0.0001.
1484
+ silent : bool , optional
1485
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
1484
1486
 
1485
1487
  Returns
1486
1488
  -------
@@ -1491,12 +1493,14 @@ class Cell():
1491
1493
  from topologicpy.Topology import Topology
1492
1494
 
1493
1495
  if not Topology.IsInstance(cell, "Cell"):
1494
- print("Cell.InternalVertex - Error: The input cell parameter is not a valid topologic cell. Returning None.")
1496
+ if not silent:
1497
+ print("Cell.InternalVertex - Error: The input cell parameter is not a valid topologic cell. Returning None.")
1495
1498
  return None
1496
1499
  try:
1497
1500
  return topologic.CellUtility.InternalVertex(cell, tolerance) # Hook to Core
1498
1501
  except:
1499
- print("Cell.InternalVertex - Error: Could not create an internal vertex. Returning None.")
1502
+ if not silent:
1503
+ print("Cell.InternalVertex - Error: Could not create an internal vertex. Returning None.")
1500
1504
  return None
1501
1505
 
1502
1506
  @staticmethod
topologicpy/Face.py CHANGED
@@ -1518,7 +1518,7 @@ class Face():
1518
1518
  return list(wires)
1519
1519
 
1520
1520
  @staticmethod
1521
- def InternalVertex(face, tolerance: float = 0.0001):
1521
+ def InternalVertex(face, tolerance: float = 0.0001, silent: bool = False):
1522
1522
  """
1523
1523
  Creates a vertex guaranteed to be inside the input face.
1524
1524
 
@@ -1528,6 +1528,8 @@ class Face():
1528
1528
  The input face.
1529
1529
  tolerance : float , optional
1530
1530
  The desired tolerance. The default is 0.0001.
1531
+ silent : bool , optional
1532
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
1531
1533
 
1532
1534
  Returns
1533
1535
  -------
@@ -1535,22 +1537,53 @@ class Face():
1535
1537
  The created vertex.
1536
1538
 
1537
1539
  """
1540
+ def get_uv_radially():
1541
+ """
1542
+ Generate the points of a grid with a given size n, sorted radially from the center to the periphery.
1543
+ n should be an odd number, ensuring that there's a center point (0, 0).
1544
+
1545
+ Args:
1546
+ n (int): The size of the grid. It should be odd for a clear center point.
1547
+
1548
+ Returns:
1549
+ list: A list of tuples (x, y) sorted by radial distance from the center (0, 0).
1550
+ """
1551
+ import math
1552
+
1553
+ points = []
1554
+ n = 100
1555
+ # Iterate over the grid, ranging from -n//2 to n//2
1556
+ for x in range(-n//2, n//2 + 1):
1557
+ for y in range(-n//2, n//2 + 1):
1558
+ points.append((x, y))
1559
+
1560
+ # Sort points by their Euclidean distance from the center (0, 0)
1561
+ points.sort(key=lambda point: math.sqrt(point[0]**2 + point[1]**2))
1562
+ return_points = []
1563
+ for p in points:
1564
+ new_p = ((p[0]+50)*0.01, (p[1]+50)*0.01)
1565
+ return_points.append(new_p)
1566
+ return return_points
1567
+
1538
1568
  from topologicpy.Vertex import Vertex
1539
1569
  from topologicpy.Topology import Topology
1540
1570
 
1541
1571
  if not Topology.IsInstance(face, "Face"):
1542
1572
  return None
1543
- v = Topology.Centroid(face)
1544
- if Vertex.IsInternal(v, face, tolerance=tolerance):
1545
- return v
1546
- l = [0.4,0.6,0.3,0.7,0.2,0.8,0.1,0.9]
1547
- for u in l:
1548
- for v in l:
1549
- v = Face.VertexByParameters(face, u, v)
1550
- if Vertex.IsInternal(v, face, tolerance=tolerance):
1551
- return v
1552
- v = topologic.FaceUtility.InternalVertex(face, tolerance) # Hook to Core
1553
- return v
1573
+ vert = Topology.Centroid(face)
1574
+ if Vertex.IsInternal(vert, face, tolerance=tolerance):
1575
+ return vert
1576
+ uv_list = get_uv_radially()
1577
+ for uv in uv_list:
1578
+ u, v = uv
1579
+ vert = Face.VertexByParameters(face, u, v)
1580
+ if Vertex.IsInternal(vert, face, tolerance=tolerance):
1581
+ return vert
1582
+ if not silent:
1583
+ print("Face.InternalVertex - Warning: Could not find an internal vertex. Returning the first vertex of the face.")
1584
+ vert = Topology.Vertices(face)[0]
1585
+ #v = topologic.FaceUtility.InternalVertex(face, tolerance) # Hook to Core
1586
+ return vert
1554
1587
 
1555
1588
  @staticmethod
1556
1589
  def Invert(face, tolerance: float = 0.0001):
@@ -2365,6 +2398,8 @@ class Face():
2365
2398
  The desired length of the normal edge. The default is 1.
2366
2399
  tolerance : float , optional
2367
2400
  The desired tolerance. The default is 0.0001.
2401
+ silent : bool , optional
2402
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
2368
2403
 
2369
2404
  Returns
2370
2405
  -------
topologicpy/Graph.py CHANGED
@@ -2160,9 +2160,14 @@ class Graph:
2160
2160
  return {'graphs':graphs, 'labels':labels}
2161
2161
 
2162
2162
  @staticmethod
2163
- def ByIFCFile(file, includeTypes: list = [], excludeTypes: list = [],
2164
- includeRels: list = [], excludeRels: list = [],
2165
- transferDictionaries: bool = False, storeBREP: bool = False,
2163
+ def ByIFCFile(file,
2164
+ includeTypes: list = [],
2165
+ excludeTypes: list = [],
2166
+ includeRels: list = [],
2167
+ excludeRels: list = [],
2168
+ transferDictionaries: bool = False,
2169
+ useInternalVertex: bool = False,
2170
+ storeBREP: bool = False,
2166
2171
  removeCoplanarFaces: bool = False,
2167
2172
  xMin: float = -0.5, yMin: float = -0.5, zMin: float = -0.5,
2168
2173
  xMax: float = 0.5, yMax: float = 0.5, zMax: float = 0.5,
@@ -2184,6 +2189,8 @@ class Graph:
2184
2189
  A list of IFC relationship types to exclude from the graph. The default is [] which mean no relationship type is excluded.
2185
2190
  transferDictionaries : bool , optional
2186
2191
  If set to True, the dictionaries from the IFC file will be transferred to the topology. Otherwise, they won't. The default is False.
2192
+ useInternalVertex : bool , optional
2193
+ If set to True, use an internal vertex to represent the subtopology. Otherwise, use its centroid. The default is False.
2187
2194
  storeBREP : bool , optional
2188
2195
  If set to True, store the BRep of the subtopology in its representative vertex. The default is False.
2189
2196
  removeCoplanarFaces : bool , optional
@@ -2466,7 +2473,7 @@ class Graph:
2466
2473
  pset_python_dict = get_psets(ifc_object)
2467
2474
  pset_dict = Dictionary.ByPythonDictionary(pset_python_dict)
2468
2475
  topology_dict = Dictionary.ByMergedDictionaries([topology_dict, pset_dict])
2469
- if storeBREP == True:
2476
+ if storeBREP == True or useInternalVertex == True:
2470
2477
  shape_topology = None
2471
2478
  if hasattr(ifc_object, "Representation") and ifc_object.Representation:
2472
2479
  for rep in ifc_object.Representation.Representations:
@@ -2484,8 +2491,10 @@ class Graph:
2484
2491
  if not shape_topology == None:
2485
2492
  if removeCoplanarFaces == True:
2486
2493
  shape_topology = Topology.RemoveCoplanarFaces(shape_topology, epsilon=0.0001)
2487
- if not shape_topology == None:
2494
+ if not shape_topology == None and storeBREP:
2488
2495
  topology_dict = Dictionary.SetValuesAtKeys(topology_dict, ["brep", "brepType", "brepTypeString"], [Topology.BREPString(shape_topology), Topology.Type(shape_topology), Topology.TypeAsString(shape_topology)])
2496
+ if not shape_topology == None and useInternalVertex == True:
2497
+ centroid = Topology.InternalVertex(shape_topology)
2489
2498
  centroid = Topology.SetDictionary(centroid, topology_dict)
2490
2499
  return centroid
2491
2500
  return None
@@ -2571,7 +2580,16 @@ class Graph:
2571
2580
  return g
2572
2581
 
2573
2582
  @staticmethod
2574
- def ByIFCPath(path, includeTypes=[], excludeTypes=[], includeRels=[], excludeRels=[], transferDictionaries=False, storeBREP=False, removeCoplanarFaces=False, xMin=-0.5, yMin=-0.5, zMin=-0.5, xMax=0.5, yMax=0.5, zMax=0.5):
2583
+ def ByIFCPath(path,
2584
+ includeTypes=[],
2585
+ excludeTypes=[],
2586
+ includeRels=[],
2587
+ excludeRels=[],
2588
+ transferDictionaries=False,
2589
+ useInternalVertex=False,
2590
+ storeBREP=False,
2591
+ removeCoplanarFaces=False,
2592
+ xMin=-0.5, yMin=-0.5, zMin=-0.5, xMax=0.5, yMax=0.5, zMax=0.5):
2575
2593
  """
2576
2594
  Create a Graph from an IFC path. This code is partially based on code from Bruno Postle.
2577
2595
 
@@ -2589,6 +2607,8 @@ class Graph:
2589
2607
  A list of IFC relationship types to exclude from the graph. The default is [] which mean no relationship type is excluded.
2590
2608
  transferDictionaries : bool , optional
2591
2609
  If set to True, the dictionaries from the IFC file will be transferred to the topology. Otherwise, they won't. The default is False.
2610
+ useInternalVertex : bool , optional
2611
+ If set to True, use an internal vertex to represent the subtopology. Otherwise, use its centroid. The default is False.
2592
2612
  storeBREP : bool , optional
2593
2613
  If set to True, store the BRep of the subtopology in its representative vertex. The default is False.
2594
2614
  removeCoplanarFaces : bool , optional
@@ -2647,6 +2667,7 @@ class Graph:
2647
2667
  includeRels=includeRels,
2648
2668
  excludeRels=excludeRels,
2649
2669
  transferDictionaries=transferDictionaries,
2670
+ useInternalVertex=useInternalVertex,
2650
2671
  storeBREP=storeBREP,
2651
2672
  removeCoplanarFaces=removeCoplanarFaces,
2652
2673
  xMin=xMin, yMin=yMin, zMin=zMin, xMax=xMax, yMax=yMax, zMax=zMax)
@@ -4081,6 +4102,79 @@ class Graph:
4081
4102
  v = Topology.SetDictionary(v, d)
4082
4103
  return graph
4083
4104
 
4105
+ @staticmethod
4106
+ def ConnectedComponents(graph, tolerance: float = 0.0001, silent: bool = False):
4107
+ """
4108
+ Returns the connected components (islands) of the input graph.
4109
+
4110
+ Parameters
4111
+ ----------
4112
+ graph : topologic_core.Graph
4113
+ The input graph.
4114
+ tolerance : float , optional
4115
+ The desired tolerance. The default is 0.0001.
4116
+ silent : bool , optional
4117
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
4118
+
4119
+ Returns
4120
+ -------
4121
+ list
4122
+ The list of connected components (island graphs).
4123
+ The list is sorted by the number of vertices in each component (from highest to lowest).
4124
+
4125
+ """
4126
+ def find_connected_components(adjacency_dict):
4127
+ visited = set()
4128
+ components = []
4129
+
4130
+ for vertex_id in adjacency_dict:
4131
+ if vertex_id not in visited:
4132
+ # Perform DFS using a stack
4133
+ stack = [vertex_id]
4134
+ current_island = set()
4135
+
4136
+ while stack:
4137
+ current = stack.pop()
4138
+ if current not in visited:
4139
+ visited.add(current)
4140
+ current_island.add(current)
4141
+ stack.extend(set(adjacency_dict[current]) - visited)
4142
+
4143
+ components.append(current_island)
4144
+
4145
+ return components
4146
+
4147
+ from topologicpy.Topology import Topology
4148
+ from topologicpy.Dictionary import Dictionary
4149
+ from topologicpy.Helper import Helper
4150
+
4151
+ if not Topology.IsInstance(graph, "Graph"):
4152
+ if not silent:
4153
+ print("Graph.ConnectedComponents - Error: The input graph is not a valid graph. Returning None.")
4154
+ return None
4155
+
4156
+ labelKey = "__label__"
4157
+ lengths = [] #List of lengths to sort the list of components by number of their vertices
4158
+ vertices = Graph.Vertices(graph)
4159
+ g_dict = Graph.AdjacencyDictionary(graph, vertexLabelKey=labelKey)
4160
+ components = find_connected_components(g_dict)
4161
+ return_components = []
4162
+ for component in components:
4163
+ i_verts = []
4164
+ for v in component:
4165
+ vert = Topology.Filter(vertices, searchType="equal to", key=labelKey, value=v)['filtered'][0]
4166
+ d = Topology.Dictionary(vert)
4167
+ d = Dictionary.RemoveKey(d, labelKey)
4168
+ vert = Topology.SetDictionary(vert, d)
4169
+ i_verts.append(vert)
4170
+ i_edges = Graph.Edges(graph, i_verts)
4171
+ lengths.append(len(i_verts))
4172
+ g_component = Graph.ByVerticesEdges(i_verts, i_edges)
4173
+ return_components.append(g_component)
4174
+ return_components = Helper.Sort(return_components, lengths)
4175
+ return_components.reverse()
4176
+ return return_components
4177
+
4084
4178
  @staticmethod
4085
4179
  def ContractEdge(graph, edge, vertex=None, tolerance=0.0001):
4086
4180
  """
@@ -4184,7 +4278,7 @@ class Graph:
4184
4278
  return graph
4185
4279
 
4186
4280
  @staticmethod
4187
- def ClosenessCentrality(graph, vertices=None, key: str = "closeness_centrality", mantissa: int = 6, tolerance = 0.0001):
4281
+ def ClosenessCentrality(graph, vertices=None, key: str = "closeness_centrality", mantissa: int = 6, tolerance = 0.0001, silent = False):
4188
4282
  """
4189
4283
  Return the closeness centrality measure of the input list of vertices within the input graph. The order of the returned list is the same as the order of the input list of vertices. If no vertices are specified, the closeness centrality of all the vertices in the input graph is computed. See https://en.wikipedia.org/wiki/Closeness_centrality.
4190
4284
 
@@ -4200,6 +4294,8 @@ class Graph:
4200
4294
  The desired length of the mantissa. The default is 6.
4201
4295
  tolerance : float , optional
4202
4296
  The desired tolerance. The default is 0.0001.
4297
+ silent : bool , optional
4298
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
4203
4299
 
4204
4300
  Returns
4205
4301
  -------
@@ -4207,56 +4303,68 @@ class Graph:
4207
4303
  The closeness centrality of the input list of vertices within the input graph. The values are in the range 0 to 1.
4208
4304
 
4209
4305
  """
4306
+
4307
+ def closeness_centrality(g):
4308
+ """
4309
+ Computes the closeness centrality for each vertex in the graph.
4310
+
4311
+ Parameters:
4312
+ graph (dict): A dictionary representing the graph where keys are vertices and
4313
+ values are lists of neighboring vertices.
4314
+
4315
+ Returns:
4316
+ dict: A dictionary where keys are vertices and values are their closeness centrality.
4317
+ """
4318
+ keys = list(g.keys())
4319
+ N = len(keys)
4320
+
4321
+ centralities = []
4322
+ for v in keys:
4323
+ total_distance = 0
4324
+ reachable_count = 0
4325
+
4326
+ for u in keys:
4327
+ if v != u:
4328
+ distance = Graph._topological_distance(g, v, u)
4329
+ if distance != None:
4330
+ total_distance += distance
4331
+ reachable_count += 1
4332
+
4333
+ if reachable_count > 0: # Avoid division by zero
4334
+ centrality = (reachable_count / total_distance)
4335
+ else:
4336
+ centrality = 0.0 # Isolated vertex
4337
+
4338
+ centralities.append(centrality)
4339
+ return centralities
4340
+
4341
+ from topologicpy.Vertex import Vertex
4210
4342
  from topologicpy.Topology import Topology
4211
4343
  from topologicpy.Dictionary import Dictionary
4344
+ from topologicpy.Helper import Helper
4212
4345
 
4213
4346
  if not Topology.IsInstance(graph, "Graph"):
4214
- print("Graph.ClosenessCentrality - Error: The input graph is not a valid graph. Returning None.")
4347
+ if not silent:
4348
+ print("Graph.ClosenessCentrality - Error: The input graph is not a valid graph. Returning None.")
4215
4349
  return None
4350
+ g = Graph.AdjacencyDictionary(graph)
4351
+ centralities = closeness_centrality(g)
4216
4352
  graphVertices = Graph.Vertices(graph)
4217
- if not isinstance(vertices, list):
4218
- vertices = graphVertices
4353
+ if vertices == None:
4354
+ for i, v in enumerate(graphVertices):
4355
+ d = Topology.Dictionary(v)
4356
+ d = Dictionary.SetValueAtKey(d, key, centralities[i])
4357
+ v = Topology.SetDictionary(v, d)
4358
+ return centralities
4219
4359
  else:
4220
- vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
4221
- if len(vertices) < 1:
4222
- print("Graph.ClosenessCentrality - Error: The input list of vertices does not contain any valid vertices. Returning None.")
4223
- return None
4224
- n = len(graphVertices)
4225
-
4226
- scores = []
4227
- try:
4228
- for va in tqdm(vertices, desc="Computing Closeness Centrality", leave=False):
4229
- top_dist = 0
4230
- for vb in graphVertices:
4231
- if Topology.IsSame(va, vb):
4232
- d = 0
4233
- else:
4234
- d = Graph.TopologicalDistance(graph, va, vb, tolerance=tolerance)
4235
- top_dist += d
4236
- if top_dist == 0:
4237
- print("Graph.ClosenessCentrality - Warning: Topological Distance is Zero.")
4238
- scores.append(0)
4239
- else:
4240
- scores.append(round((n-1)/top_dist, mantissa))
4241
- except:
4242
- print("Graph.ClosenessCentrality - Warning: Could not use tqdm.")
4243
- for va in vertices:
4244
- top_dist = 0
4245
- for vb in graphVertices:
4246
- if Topology.IsSame(va, vb):
4247
- d = 0
4248
- else:
4249
- d = Graph.TopologicalDistance(graph, va, vb, tolerance=tolerance)
4250
- top_dist += d
4251
- if top_dist == 0:
4252
- scores.append(0)
4253
- else:
4254
- scores.append(round((n-1)/top_dist, mantissa))
4255
- for i, v in enumerate(vertices):
4256
- d = Topology.Dictionary(v)
4257
- d = Dictionary.SetValueAtKey(d, key, scores[i])
4258
- v = Topology.SetDictionary(v, d)
4259
- return scores
4360
+ return_centralities = []
4361
+ for v in vertices:
4362
+ i = Vertex.Index(v, graphVertices)
4363
+ d = Topology.Dictionary(v)
4364
+ d = Dictionary.SetValueAtKey(d, key, centralities[i])
4365
+ v = Topology.SetDictionary(v, d)
4366
+ return_centralities.append(centralities[i])
4367
+ return centralities
4260
4368
 
4261
4369
  @staticmethod
4262
4370
  def Connect(graph, verticesA, verticesB, tolerance=0.0001):
@@ -8879,6 +8987,28 @@ class Graph:
8879
8987
  return None
8880
8988
  return len(Graph.Edges(graph))
8881
8989
 
8990
+ @staticmethod
8991
+ def _topological_distance(g, start, target):
8992
+ from collections import deque
8993
+ if start == target:
8994
+ return 0
8995
+ visited = set()
8996
+ queue = deque([(start, 0)]) # Each element is a tuple (vertex, distance)
8997
+
8998
+ while queue:
8999
+ current, distance = queue.popleft()
9000
+ if current in visited:
9001
+ continue
9002
+
9003
+ visited.add(current)
9004
+ for neighbor in g.get(current, []):
9005
+ if neighbor == target:
9006
+ return distance + 1
9007
+ if neighbor not in visited:
9008
+ queue.append((neighbor, distance + 1))
9009
+
9010
+ return None # Target not reachable
9011
+
8882
9012
  @staticmethod
8883
9013
  def TopologicalDistance(graph, vertexA, vertexB, tolerance=0.0001):
8884
9014
  """
@@ -8901,6 +9031,8 @@ class Graph:
8901
9031
  The topological distance between the input vertices.
8902
9032
 
8903
9033
  """
9034
+
9035
+ from topologicpy.Vertex import Vertex
8904
9036
  from topologicpy.Topology import Topology
8905
9037
 
8906
9038
  if not Topology.IsInstance(graph, "Graph"):
@@ -8912,7 +9044,19 @@ class Graph:
8912
9044
  if not Topology.IsInstance(vertexB, "Vertex"):
8913
9045
  print("Graph.TopologicalDistance - Error: The input vertexB is not a valid vertex. Returning None.")
8914
9046
  return None
8915
- return graph.TopologicalDistance(vertexA, vertexB, tolerance) # Hook to Core
9047
+
9048
+ g = Graph.AdjacencyDictionary(graph)
9049
+ vertices = Graph.Vertices(graph)
9050
+ keys = list(g.keys())
9051
+ index_a = Vertex.Index(vertexA, vertices, tolerance=tolerance)
9052
+ if index_a == None:
9053
+ return 0
9054
+ start = keys[index_a]
9055
+ index_b = Vertex.Index(vertexB, vertices, tolerance=tolerance)
9056
+ if index_b == None:
9057
+ return 0
9058
+ target = keys[index_b]
9059
+ return Graph._topological_distance(g, start, target)
8916
9060
 
8917
9061
  @staticmethod
8918
9062
  def Topology(graph):
topologicpy/Plotly.py CHANGED
@@ -305,8 +305,8 @@ class Plotly:
305
305
  showEdgeLabel: bool = False,
306
306
  showEdgeLegend: bool = False,
307
307
  edgeLegendLabel="Graph Edges",
308
- edgeLegendRank=2,
309
- edgeLegendGroup=2,
308
+ edgeLegendRank=5,
309
+ edgeLegendGroup=5,
310
310
  colorScale: str = "viridis",
311
311
  mantissa: int = 6,
312
312
  silent: bool = False):
@@ -411,7 +411,7 @@ class Plotly:
411
411
 
412
412
  if showVertices:
413
413
  vertices = Graph.Vertices(graph)
414
- v_dictionaries = [Topology.Dictionary(v) for v in vertices]
414
+ #v_dictionaries = [Topology.Dictionary(v) for v in vertices]
415
415
  e_cluster = Cluster.ByTopologies(vertices)
416
416
  geo = Topology.Geometry(e_cluster, mantissa=mantissa)
417
417
  vertices = geo['vertices']
@@ -427,6 +427,7 @@ class Plotly:
427
427
  vertexMinGroup=vertexMinGroup,
428
428
  vertexMaxGroup=vertexMaxGroup,
429
429
  vertexGroups=vertexGroups,
430
+ showVertexLegend=showVertexLegend,
430
431
  vertexLegendLabel=vertexLegendLabel,
431
432
  vertexLegendGroup=vertexLegendGroup,
432
433
  vertexLegendRank=vertexLegendRank,
@@ -653,7 +654,7 @@ class Plotly:
653
654
  trace = go.Scatter3d(x=x,
654
655
  y=y,
655
656
  z=z,
656
- name=label,
657
+ name=legendLabel,
657
658
  showlegend=showLegend,
658
659
  marker=dict(symbol="circle", size=marker_width),
659
660
  mode=mode,
@@ -680,7 +681,7 @@ class Plotly:
680
681
  trace = go.Scatter3d(x=x,
681
682
  y=y,
682
683
  z=z,
683
- name=label,
684
+ name=legendLabel,
684
685
  showlegend=showLegend,
685
686
  marker_size=0,
686
687
  mode=mode,
@@ -703,20 +704,49 @@ class Plotly:
703
704
 
704
705
  @staticmethod
705
706
  def DataByTopology(topology,
706
- showVertices=True, vertexSize=1.1, vertexSizeKey=None, vertexColor="black", vertexColorKey=None,
707
- vertexLabelKey=None, showVertexLabel=False, vertexGroupKey=None, vertexGroups=[],
708
- vertexMinGroup=None, vertexMaxGroup=None,
709
- showVertexLegend=False, vertexLegendLabel="Topology Vertices", vertexLegendRank=1,
707
+ showVertices=True,
708
+ vertexSize=1.1,
709
+ vertexSizeKey=None,
710
+ vertexColor="black",
711
+ vertexColorKey=None,
712
+ vertexLabelKey=None,
713
+ showVertexLabel=False,
714
+ vertexGroupKey=None,
715
+ vertexGroups=[],
716
+ vertexMinGroup=None,
717
+ vertexMaxGroup=None,
718
+ showVertexLegend=False,
719
+ vertexLegendLabel="Topology Vertices",
720
+ vertexLegendRank=1,
710
721
  vertexLegendGroup=1,
711
- showEdges=True, edgeWidth=1, edgeWidthKey=None, edgeColor="black", edgeColorKey=None,
712
- edgeLabelKey=None, showEdgeLabel=False, edgeGroupKey=None, edgeGroups=[],
713
- edgeMinGroup=None, edgeMaxGroup=None,
714
- showEdgeLegend=False, edgeLegendLabel="Topology Edges", edgeLegendRank=2,
722
+ showEdges=True,
723
+ edgeWidth=1,
724
+ edgeWidthKey=None,
725
+ edgeColor="black",
726
+ edgeColorKey=None,
727
+ edgeLabelKey=None,
728
+ showEdgeLabel=False,
729
+ edgeGroupKey=None,
730
+ edgeGroups=[],
731
+ edgeMinGroup=None,
732
+ edgeMaxGroup=None,
733
+ showEdgeLegend=False,
734
+ edgeLegendLabel="Topology Edges",
735
+ edgeLegendRank=2,
715
736
  edgeLegendGroup=2,
716
- showFaces=True, faceOpacity=0.5, faceOpacityKey=None, faceColor="#FAFAFA", faceColorKey=None,
717
- faceLabelKey=None, faceGroupKey=None, faceGroups=[],
718
- faceMinGroup=None, faceMaxGroup=None,
719
- showFaceLegend=False, faceLegendLabel="Topology Faces", faceLegendRank=3,
737
+ showFaces=True,
738
+ faceOpacity=0.5,
739
+ faceOpacityKey=None,
740
+ faceColor="#FAFAFA",
741
+ faceColorKey=None,
742
+ faceLabelKey=None,
743
+ faceGroupKey=None,
744
+ faceGroups=[],
745
+ faceMinGroup=None,
746
+ faceMaxGroup=None,
747
+ showFaceLegend=False,
748
+ faceLegendLabel="Topology Faces",
749
+ faceLegendRank=3,
720
750
  faceLegendGroup=3,
721
751
  intensityKey=None, intensities=[], colorScale="viridis", mantissa=6, tolerance=0.0001):
722
752
  """
topologicpy/Topology.py CHANGED
@@ -6240,7 +6240,7 @@ class Topology():
6240
6240
  return Topology.Type(topology)
6241
6241
 
6242
6242
  @staticmethod
6243
- def _InternalVertex(topology, tolerance: float = 0.0001):
6243
+ def _InternalVertex(topology, tolerance: float = 0.0001, silent: bool = False):
6244
6244
  """
6245
6245
  Returns a vertex guaranteed to be inside the input topology.
6246
6246
 
@@ -6250,6 +6250,8 @@ class Topology():
6250
6250
  The input topology.
6251
6251
  tolerance : float , ptional
6252
6252
  The desired tolerance. The default is 0.0001.
6253
+ silent : bool , optional
6254
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
6253
6255
 
6254
6256
  Returns
6255
6257
  -------
@@ -6271,20 +6273,20 @@ class Topology():
6271
6273
  top = Topology.Copy(topology)
6272
6274
  if Topology.IsInstance(top, "CellComplex"): #CellComplex
6273
6275
  tempCell = Topology.Cells(top)[0]
6274
- vst = Cell.InternalVertex(tempCell, tolerance=tolerance)
6276
+ vst = Cell.InternalVertex(tempCell, tolerance=tolerance, silent=silent)
6275
6277
  elif Topology.IsInstance(top, "Cell"): #Cell
6276
- vst = Cell.InternalVertex(top, tolerance=tolerance)
6278
+ vst = Cell.InternalVertex(top, tolerance=tolerance, silent=silent)
6277
6279
  elif Topology.IsInstance(top, "Shell"): #Shell
6278
6280
  tempFace = Topology.Faces(top)[0]
6279
- vst = Face.InternalVertex(tempFace, tolerance=tolerance)
6281
+ vst = Face.InternalVertex(tempFace, tolerance=tolerance, silent=silent)
6280
6282
  elif Topology.IsInstance(top, "Face"): #Face
6281
- vst = Face.InternalVertex(top, tolerance=tolerance)
6283
+ vst = Face.InternalVertex(top, tolerance=tolerance, silent=silent)
6282
6284
  elif Topology.IsInstance(top, "Wire"): #Wire
6283
6285
  if top.IsClosed():
6284
6286
  internalBoundaries = []
6285
6287
  try:
6286
6288
  tempFace = topologic.Face.ByExternalInternalBoundaries(top, internalBoundaries)
6287
- vst = Face.InternalVertex(tempFace, tolerance=tolerance)
6289
+ vst = Face.InternalVertex(tempFace, tolerance=tolerance, silent=silent)
6288
6290
  except:
6289
6291
  vst = Topology.Centroid(top)
6290
6292
  else:
@@ -6295,7 +6297,7 @@ class Topology():
6295
6297
  elif Topology.IsInstance(top, "Vertex"): #Vertex
6296
6298
  vst = top
6297
6299
  elif Topology.IsInstance(topology, "Aperture"): #Aperture
6298
- vst = Face.InternalVertex(Aperture.Topology(top), tolerance=tolerance)
6300
+ vst = Face.InternalVertex(Aperture.Topology(top), tolerance=tolerance, silent=silent)
6299
6301
  else:
6300
6302
  vst = Topology.Centroid(top)
6301
6303
  return vst
@@ -6303,7 +6305,7 @@ class Topology():
6303
6305
 
6304
6306
 
6305
6307
  @staticmethod
6306
- def InternalVertex(topology, timeout: int = 10, tolerance: float = 0.0001):
6308
+ def InternalVertex(topology, timeout: int = 30, tolerance: float = 0.0001, silent: bool = False):
6307
6309
  """
6308
6310
  Returns a vertex guaranteed to be inside the input topology.
6309
6311
 
@@ -6312,9 +6314,11 @@ class Topology():
6312
6314
  topology : topologic_core.Topology
6313
6315
  The input topology.
6314
6316
  timeout : int , optional
6315
- The amount of seconds to wait before timing out. The default is 10 seconds.
6317
+ The amount of seconds to wait before timing out. The default is 30 seconds.
6316
6318
  tolerance : float , ptional
6317
6319
  The desired tolerance. The default is 0.0001.
6320
+ silent : bool , optional
6321
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
6318
6322
 
6319
6323
  Returns
6320
6324
  -------
@@ -6325,22 +6329,21 @@ class Topology():
6325
6329
  import concurrent.futures
6326
6330
  import time
6327
6331
  # Wrapper function with timeout
6328
- def run_with_timeout(func, topology, tolerance=0.0001, timeout=10):
6332
+ def run_with_timeout(func, topology, tolerance=0.0001, silent=False, timeout=10):
6329
6333
  with concurrent.futures.ThreadPoolExecutor() as executor:
6330
- future = executor.submit(func, topology, tolerance=tolerance)
6334
+ future = executor.submit(func, topology, tolerance=tolerance, silent=silent)
6331
6335
  try:
6332
6336
  result = future.result(timeout=timeout) # Wait for the result with a timeout
6333
6337
  return result
6334
6338
  except concurrent.futures.TimeoutError:
6335
- print("Function took too long, retrying with a different solution.")
6336
6339
  return None # or try another approach here
6337
6340
 
6338
- result = run_with_timeout(Topology._InternalVertex, topology=topology, tolerance=tolerance, timeout=timeout) # Set a 10 second timeout
6341
+ result = run_with_timeout(Topology._InternalVertex, topology=topology, tolerance=tolerance, silent=silent, timeout=timeout) # Set a 10 second timeout
6339
6342
  if result is None:
6340
6343
  # Handle failure case (e.g., try a different solution)
6341
- print("Using a different approach.")
6342
- result = Topology.Centroid(topology)
6343
- print("Result is:", result)
6344
+ if not silent:
6345
+ print("Topology.InternalVertex - Warning: Operation took too long. Returning None")
6346
+ return None
6344
6347
  return result
6345
6348
 
6346
6349
  @staticmethod
@@ -7923,39 +7926,86 @@ class Topology():
7923
7926
 
7924
7927
  @staticmethod
7925
7928
  def Show(*topologies,
7929
+ nameKey = "name",
7926
7930
  opacityKey = "opacity",
7927
- showVertices=True, vertexSize=None, vertexSizeKey = None, vertexColor="black", vertexColorKey = None,
7928
- vertexLabelKey=None, showVertexLabel= False,
7929
- vertexGroupKey=None, vertexGroups=[],
7930
- vertexMinGroup=None, vertexMaxGroup=None,
7931
- showVertexLegend=False, vertexLegendLabel="Topology Vertices", vertexLegendRank=1,
7932
- vertexLegendGroup=1,
7933
-
7934
- showEdges=True, edgeWidth=None, edgeWidthKey = None, edgeColor=None, edgeColorKey = None,
7935
- edgeLabelKey=None, showEdgeLabel = False,
7936
- edgeGroupKey=None, edgeGroups=[],
7937
- edgeMinGroup=None, edgeMaxGroup=None,
7938
- showEdgeLegend=False, edgeLegendLabel="Topology Edges", edgeLegendRank=2,
7939
- edgeLegendGroup=2,
7940
-
7941
- showFaces=True, faceOpacity=0.5, faceOpacityKey=None, faceColor="#FAFAFA", faceColorKey = None,
7942
- faceLabelKey=None, faceGroupKey=None, faceGroups=[],
7943
- faceMinGroup=None, faceMaxGroup=None,
7944
- showFaceLegend=False, faceLegendLabel="Topology Faces", faceLegendRank=3,
7945
- faceLegendGroup=3,
7931
+ showVertices=True,
7932
+ vertexSize=None,
7933
+ vertexSizeKey = None,
7934
+ vertexColor="black",
7935
+ vertexColorKey = None,
7936
+ vertexLabelKey=None,
7937
+ showVertexLabel= False,
7938
+ vertexGroupKey=None,
7939
+ vertexGroups=[],
7940
+ vertexMinGroup=None,
7941
+ vertexMaxGroup=None,
7942
+ showVertexLegend=False,
7943
+ vertexLegendLabel="Vertices",
7944
+
7945
+ showEdges=True,
7946
+ edgeWidth=None,
7947
+ edgeWidthKey = None,
7948
+ edgeColor=None,
7949
+ edgeColorKey = None,
7950
+ edgeLabelKey=None,
7951
+ showEdgeLabel = False,
7952
+ edgeGroupKey=None,
7953
+ edgeGroups=[],
7954
+ edgeMinGroup=None,
7955
+ edgeMaxGroup=None,
7956
+ showEdgeLegend=False,
7957
+ edgeLegendLabel="Edges",
7958
+
7959
+ showFaces=True,
7960
+ faceOpacity=0.5,
7961
+ faceOpacityKey=None,
7962
+ faceColor="#FAFAFA",
7963
+ faceColorKey = None,
7964
+ faceLabelKey=None,
7965
+ faceGroupKey=None,
7966
+ faceGroups=[],
7967
+ faceMinGroup=None,
7968
+ faceMaxGroup=None,
7969
+ showFaceLegend=False,
7970
+ faceLegendLabel="Faces",
7946
7971
  intensityKey=None,
7947
7972
  intensities=[],
7948
7973
 
7949
- width=950, height=500,
7950
- xAxis=False, yAxis=False, zAxis=False, axisSize=1, backgroundColor='rgba(0,0,0,0)',
7951
- marginLeft=0, marginRight=0, marginTop=20, marginBottom=0, camera=[-1.25, -1.25, 1.25],
7952
- center=[0, 0, 0], up=[0, 0, 1], projection="perspective", renderer="notebook", showScale=False,
7974
+ width=950,
7975
+ height=500,
7976
+ xAxis=False,
7977
+ yAxis=False,
7978
+ zAxis=False,
7979
+ axisSize=1,
7980
+ backgroundColor='rgba(0,0,0,0)',
7981
+ marginLeft=0,
7982
+ marginRight=0,
7983
+ marginTop=20,
7984
+ marginBottom=0,
7985
+ camera=[-1.25, -1.25, 1.25],
7986
+ center=[0, 0, 0],
7987
+ up=[0, 0, 1],
7988
+ projection="perspective",
7989
+ renderer="notebook",
7990
+ showScale=False,
7953
7991
 
7954
- cbValues=[], cbTicks=5, cbX=-0.15, cbWidth=15, cbOutlineWidth=0, cbTitle="",
7955
- cbSubTitle="", cbUnits="", colorScale="Viridis",
7992
+ cbValues=[],
7993
+ cbTicks=5,
7994
+ cbX=-0.15,
7995
+ cbWidth=15,
7996
+ cbOutlineWidth=0,
7997
+ cbTitle="",
7998
+ cbSubTitle="",
7999
+ cbUnits="",
8000
+ colorScale="Viridis",
7956
8001
 
7957
- sagitta = 0, absolute = False, sides = 8, angle = 0,
7958
- mantissa=6, tolerance=0.0001, silent=False):
8002
+ sagitta = 0,
8003
+ absolute = False,
8004
+ sides = 8,
8005
+ angle = 0,
8006
+ mantissa=6,
8007
+ tolerance=0.0001,
8008
+ silent=False):
7959
8009
  """
7960
8010
  Shows the input topology on screen.
7961
8011
 
@@ -7997,10 +8047,6 @@ class Topology():
7997
8047
  If set to True, the legend for the vertices of this topology is shown. Otherwise, it isn't. The default is False.
7998
8048
  vertexLegendLabel : str , optional
7999
8049
  The legend label string used to identify vertices. The default is "Topology Vertices".
8000
- vertexLegendRank : int , optional
8001
- The legend rank order of the vertices of this topology. The default is 1.
8002
- vertexLegendGroup : int , optional
8003
- The number of the vertex legend group to which the vertices of this topology belong. The default is 1.
8004
8050
 
8005
8051
  showEdges : bool , optional
8006
8052
  If set to True the edges will be drawn. Otherwise, they will not be drawn. The default is True.
@@ -8034,10 +8080,6 @@ class Topology():
8034
8080
  If set to True, the legend for the edges of this topology is shown. Otherwise, it isn't. The default is False.
8035
8081
  edgeLegendLabel : str , optional
8036
8082
  The legend label string used to identify edges. The default is "Topology Edges".
8037
- edgeLegendRank : int , optional
8038
- The legend rank order of the edges of this topology. The default is 2.
8039
- edgeLegendGroup : int , optional
8040
- The number of the edge legend group to which the edges of this topology belong. The default is 2.
8041
8083
 
8042
8084
  showFaces : bool , optional
8043
8085
  If set to True the faces will be drawn. Otherwise, they will not be drawn. The default is True.
@@ -8069,10 +8111,6 @@ class Topology():
8069
8111
  If set to True, the legend for the faces of this topology is shown. Otherwise, it isn't. The default is False.
8070
8112
  faceLegendLabel : str , optional
8071
8113
  The legend label string used to idenitfy edges. The default is "Topology Faces".
8072
- faceLegendRank : int , optional
8073
- The legend rank order of the faces of this topology. The default is 3.
8074
- faceLegendGroup : int , optional
8075
- The number of the face legend group to which the faces of this topology belong. The default is 3.
8076
8114
  width : int , optional
8077
8115
  The width in pixels of the figure. The default value is 950.
8078
8116
  height : int , optional
@@ -8149,8 +8187,6 @@ class Topology():
8149
8187
  from topologicpy.Dictionary import Dictionary
8150
8188
  from topologicpy.Plotly import Plotly
8151
8189
  from topologicpy.Helper import Helper
8152
- from topologicpy.Graph import Graph
8153
- from topologicpy.Color import Color
8154
8190
 
8155
8191
  if isinstance(topologies, tuple):
8156
8192
  topologies = Helper.Flatten(list(topologies))
@@ -8164,8 +8200,18 @@ class Topology():
8164
8200
  if camera[0] == 0 and camera[1] == 0 and up == [0,0,1]:
8165
8201
  up = [0,1,0] #default to positive Y axis being up if looking down or up at the XY plane
8166
8202
  data = []
8167
- for topology in new_topologies:
8203
+ topology_counter = 0
8204
+ offset = 1
8205
+ if showEdges == True:
8206
+ offset += 1
8207
+ if showFaces == True:
8208
+ offset +=2
8209
+ temp_graphs = [g for g in new_topologies if Topology.IsInstance(g, "Graph")]
8210
+ graph_counter = len(new_topologies)*offset - len(temp_graphs)*offset
8211
+ for i, topology in enumerate(new_topologies):
8212
+ d = Topology.Dictionary(topology)
8168
8213
  if Topology.IsInstance(topology, "Graph"):
8214
+ name = Dictionary.ValueAtKey(d, nameKey) or "Untitled Graph"
8169
8215
  if vertexSize == None:
8170
8216
  vSize = 10
8171
8217
  else:
@@ -8178,6 +8224,9 @@ class Topology():
8178
8224
  eColor = "red"
8179
8225
  else:
8180
8226
  eColor = edgeColor
8227
+ vll = name+" ("+vertexLegendLabel+")"
8228
+ ell = name+" ("+edgeLegendLabel+")"
8229
+
8181
8230
  data += Plotly.DataByGraph(topology,
8182
8231
  sagitta=sagitta,
8183
8232
  absolute=absolute,
@@ -8195,6 +8244,9 @@ class Topology():
8195
8244
  showVertices=showVertices,
8196
8245
  showVertexLabel=showVertexLabel,
8197
8246
  showVertexLegend=showVertexLegend,
8247
+ vertexLegendLabel= str(i+1)+": "+vll,
8248
+ vertexLegendRank= (graph_counter+1),
8249
+ vertexLegendGroup= (graph_counter+1),
8198
8250
  edgeColor=eColor,
8199
8251
  edgeColorKey=edgeColorKey,
8200
8252
  edgeWidth=eWidth,
@@ -8207,9 +8259,14 @@ class Topology():
8207
8259
  showEdges=showEdges,
8208
8260
  showEdgeLabel=showEdgeLabel,
8209
8261
  showEdgeLegend=showEdgeLegend,
8262
+ edgeLegendLabel = str(i+1)+": "+ell,
8263
+ edgeLegendRank= (graph_counter+2),
8264
+ edgeLegendGroup=(graph_counter+2),
8210
8265
  colorScale=colorScale,
8211
8266
  silent=silent)
8267
+ graph_counter += offset
8212
8268
  else:
8269
+ name = Dictionary.ValueAtKey(d, nameKey) or "Untitled"
8213
8270
  if vertexSize == None:
8214
8271
  vSize = 1.1
8215
8272
  else:
@@ -8222,26 +8279,59 @@ class Topology():
8222
8279
  eColor = "black"
8223
8280
  else:
8224
8281
  eColor = edgeColor
8225
- d = Topology.Dictionary(topology)
8226
8282
  if not d == None:
8227
8283
  faceOpacity = Dictionary.ValueAtKey(d, opacityKey) or faceOpacity
8228
8284
  data += Plotly.DataByTopology(topology=topology,
8229
- showVertices=showVertices, vertexSize=vSize, vertexSizeKey=vertexSizeKey, vertexColor=vertexColor, vertexColorKey=vertexColorKey,
8230
- vertexLabelKey=vertexLabelKey, showVertexLabel=showVertexLabel, vertexGroupKey=vertexGroupKey, vertexGroups=vertexGroups,
8231
- vertexMinGroup=vertexMinGroup, vertexMaxGroup=vertexMaxGroup,
8232
- showVertexLegend=showVertexLegend, vertexLegendLabel=vertexLegendLabel, vertexLegendRank=vertexLegendRank,
8233
- vertexLegendGroup=vertexLegendGroup,
8234
- showEdges=showEdges, edgeWidth=eWidth, edgeWidthKey=edgeWidthKey, edgeColor=eColor, edgeColorKey=edgeColorKey,
8235
- edgeLabelKey=edgeLabelKey, showEdgeLabel=showEdgeLabel, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups,
8236
- edgeMinGroup=edgeMinGroup, edgeMaxGroup=edgeMaxGroup,
8237
- showEdgeLegend=showEdgeLegend, edgeLegendLabel=edgeLegendLabel, edgeLegendRank=edgeLegendRank,
8238
- edgeLegendGroup=edgeLegendGroup,
8239
- showFaces=showFaces, faceOpacity=faceOpacity, faceColor=faceColor, faceColorKey=faceColorKey,
8240
- faceLabelKey=faceLabelKey, faceGroupKey=faceGroupKey, faceGroups=faceGroups,
8241
- faceMinGroup=faceMinGroup, faceMaxGroup=faceMaxGroup,
8242
- showFaceLegend=showFaceLegend, faceLegendLabel=faceLegendLabel, faceLegendRank=faceLegendRank,
8243
- faceLegendGroup=faceLegendGroup,
8244
- intensityKey=intensityKey, intensities=intensities, colorScale=colorScale, mantissa=mantissa, tolerance=tolerance)
8285
+ showVertices=showVertices,
8286
+ vertexSize=vSize,
8287
+ vertexSizeKey=vertexSizeKey,
8288
+ vertexColor=vertexColor,
8289
+ vertexColorKey=vertexColorKey,
8290
+ vertexLabelKey=vertexLabelKey,
8291
+ showVertexLabel=showVertexLabel,
8292
+ vertexGroupKey=vertexGroupKey,
8293
+ vertexGroups=vertexGroups,
8294
+ vertexMinGroup=vertexMinGroup,
8295
+ vertexMaxGroup=vertexMaxGroup,
8296
+ showVertexLegend=showVertexLegend,
8297
+ vertexLegendLabel=str(i+1)+": "+name+" ("+vertexLegendLabel+")",
8298
+ vertexLegendRank=topology_counter+1,
8299
+ vertexLegendGroup=topology_counter+1,
8300
+ showEdges=showEdges,
8301
+ edgeWidth=eWidth,
8302
+ edgeWidthKey=edgeWidthKey,
8303
+ edgeColor=eColor,
8304
+ edgeColorKey=edgeColorKey,
8305
+ edgeLabelKey=edgeLabelKey,
8306
+ showEdgeLabel=showEdgeLabel,
8307
+ edgeGroupKey=edgeGroupKey,
8308
+ edgeGroups=edgeGroups,
8309
+ edgeMinGroup=edgeMinGroup,
8310
+ edgeMaxGroup=edgeMaxGroup,
8311
+ showEdgeLegend=showEdgeLegend,
8312
+ edgeLegendLabel=str(i+1)+": "+name+" ("+edgeLegendLabel+")",
8313
+ edgeLegendRank=topology_counter+2,
8314
+ edgeLegendGroup=topology_counter+2,
8315
+ showFaces=showFaces,
8316
+ faceOpacity=faceOpacity,
8317
+ faceOpacityKey=faceOpacityKey,
8318
+ faceColor=faceColor,
8319
+ faceColorKey=faceColorKey,
8320
+ faceLabelKey=faceLabelKey,
8321
+ faceGroupKey=faceGroupKey,
8322
+ faceGroups=faceGroups,
8323
+ faceMinGroup=faceMinGroup,
8324
+ faceMaxGroup=faceMaxGroup,
8325
+ showFaceLegend=showFaceLegend,
8326
+ faceLegendLabel=str(i+1)+": "+name+" ("+faceLegendLabel+")",
8327
+ faceLegendRank=topology_counter+3,
8328
+ faceLegendGroup=topology_counter+3,
8329
+ intensityKey=intensityKey,
8330
+ intensities=intensities,
8331
+ colorScale=colorScale,
8332
+ mantissa=mantissa,
8333
+ tolerance=tolerance)
8334
+ topology_counter += offset
8245
8335
  figure = Plotly.FigureByData(data=data, width=width, height=height,
8246
8336
  xAxis=xAxis, yAxis=yAxis, zAxis=zAxis, axisSize=axisSize,
8247
8337
  backgroundColor=backgroundColor,
@@ -9397,7 +9487,7 @@ class Topology():
9397
9487
  return topology.Type()
9398
9488
 
9399
9489
  @staticmethod
9400
- def TypeAsString(topology):
9490
+ def TypeAsString(topology, silent=False):
9401
9491
  """
9402
9492
  Returns the type of the input topology as a string.
9403
9493
 
@@ -9405,6 +9495,8 @@ class Topology():
9405
9495
  ----------
9406
9496
  topology : topologic_core.Topology
9407
9497
  The input topology.
9498
+ silent : bool , optional
9499
+ If set to True, no warnings or errors will be printed. The default is False.
9408
9500
 
9409
9501
  Returns
9410
9502
  -------
@@ -9412,10 +9504,13 @@ class Topology():
9412
9504
  The type of the topology as a string.
9413
9505
 
9414
9506
  """
9415
- if not Topology.IsInstance(topology, "Topology"):
9416
- print("Topology.TypeAsString - Error: The input topology parameter is not a valid topology. Returning None.")
9417
- return None
9418
- return topology.GetTypeAsString()
9507
+ if Topology.IsInstance(topology, "Graph"):
9508
+ return "Graph"
9509
+ elif Topology.IsInstance(topology, "Topology"):
9510
+ return topology.GetTypeAsString() # Hook to Core
9511
+ if not silent:
9512
+ print("Topology.TypeAsString - Error: The input topology parameter is not a valid topology or graph. Returning None.")
9513
+ return None
9419
9514
 
9420
9515
  @staticmethod
9421
9516
  def TypeID(name : str = None) -> int:
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.7.86'
1
+ __version__ = '0.7.90'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.86
3
+ Version: 0.7.90
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
@@ -1,7 +1,7 @@
1
1
  topologicpy/ANN.py,sha256=m_WxD1lgQqDhUpaM20Lia6TmJACDYaAE96wigsi-99U,47932
2
2
  topologicpy/Aperture.py,sha256=p9pUzTQSBWoUaDiug1V1R1hnEIEwYSXFg2t7iRAmNRY,2723
3
3
  topologicpy/BVH.py,sha256=mKVCAu9K8qzcWXtPDVH5usXZV1DNNNJl4n3rU5Lh1ZM,12931
4
- topologicpy/Cell.py,sha256=nVJEFgj6nnHDNUYIlMf1NS2xiufDMj18szKGqf9HwDM,108090
4
+ topologicpy/Cell.py,sha256=Fdqf2GCWfKe50EecBVcB8PCHKWENRUTTH8yPrOSF3-0,108321
5
5
  topologicpy/CellComplex.py,sha256=ncjfvJ2QJzz4Fu8BMaQBLxAQ6WHx6HfUCddaLP8kXsc,51480
6
6
  topologicpy/Cluster.py,sha256=__PvNVjRnFfy12aawd7HSrb3UBX3Rtd1iWSSQnPGpfk,55768
7
7
  topologicpy/Color.py,sha256=q9xsGmxFMz7sQKmygwSVS12GaTRB-OT0-_i6t3-cthE,20307
@@ -10,27 +10,27 @@ topologicpy/DGL.py,sha256=Dd6O08D-vSxpjHYgKm45JpKiaeGvWlg1BRMzYMAXGNc,138991
10
10
  topologicpy/Dictionary.py,sha256=t0O7Du-iPq46FyKqZfcjHfsUK1E8GS_e67R2V5cpkbw,33186
11
11
  topologicpy/Edge.py,sha256=KWOJCkLDwCWyZJ5MKwDhT5umWwCYBHtLOz6ulHrSOfY,67205
12
12
  topologicpy/EnergyModel.py,sha256=AqTtmXE35SxvRXhG3vYAQd7GQDW-6HtjYPHua6ME4Eg,53762
13
- topologicpy/Face.py,sha256=qiQmvCRFHO248VMqPxcE4Jrrw2JvNIJDdWHMopCPWGQ,142173
14
- topologicpy/Graph.py,sha256=YKVo3ePAesJL4pt8GBekzPhujGeTc2XbErnzqEOZITQ,431147
13
+ topologicpy/Face.py,sha256=f4DrZJ2AgwnTwIorJpwuOXtWq501wOMRixMgHZC78so,143843
14
+ topologicpy/Graph.py,sha256=Zxmoy2FAl5m_MGUd62jDeajmZAFlKXVHf1Fy68TrsSw,436694
15
15
  topologicpy/Grid.py,sha256=2s9cSlWldivn1i9EUz4OOokJyANveqmRe_vR93CAndI,18245
16
16
  topologicpy/Helper.py,sha256=F3h4_qcOD_PHAoVe0tEbEE7_jYyVcaHjtwVs4QHOZuI,23978
17
17
  topologicpy/Honeybee.py,sha256=HfTaEV1R8K1xOVQQy9sBOhBTF_ap8A2RxZOYhirp_Mw,21835
18
18
  topologicpy/Matrix.py,sha256=umgR7An919-wGInXJ1wpqnoQ2jCPdyMe2rcWTZ16upk,8079
19
19
  topologicpy/Neo4j.py,sha256=t52hgE9cVsqkGc7m7fjRsLnyfRHakVHwdvF4ms7ow78,22342
20
- topologicpy/Plotly.py,sha256=RqGTQM_EUskQdp27Fbu-KY07ErKxaC0PCksLokB8c9s,113753
20
+ topologicpy/Plotly.py,sha256=Ld-VrYAn_FwONYwdVoz-7Kqt-5fs-qbVl35Utmcu7OE,114508
21
21
  topologicpy/Polyskel.py,sha256=EFsuh2EwQJGPLiFUjvtXmAwdX-A4r_DxP5hF7Qd3PaU,19829
22
22
  topologicpy/PyG.py,sha256=LU9LCCzjxGPUM31qbaJXZsTvniTtgugxJY7y612t4A4,109757
23
23
  topologicpy/Shell.py,sha256=UdDz3zfIYmGRjoZIseviJ2cXNtR5Kx5tIsZLhWMyO_U,87906
24
24
  topologicpy/Speckle.py,sha256=AlsGlSDuKRtX5jhVsPNSSjjbZis079HbUchDH_5RJmE,18187
25
25
  topologicpy/Sun.py,sha256=42tDWMYpwRG7Z2Qjtp94eRgBuqySq7k8TgNUZDK7QxQ,36837
26
- topologicpy/Topology.py,sha256=OUm83_hemDabm1gLIRGmfR190RCb-GadMm5BDBb69vE,438388
26
+ topologicpy/Topology.py,sha256=d99wryPPXvw7eRw12GVKV-DT6jhlmVq6GsMAjg-E-40,441693
27
27
  topologicpy/Vector.py,sha256=A1g83zDHep58iVPY8WQ8iHNrSOfGWFEzvVeDuMnjDNY,33078
28
28
  topologicpy/Vertex.py,sha256=sYWTbAHqKGRUAJRCIUqrCO_xFhvsXK09Sx7E4dafPLQ,73754
29
29
  topologicpy/Wire.py,sha256=HjagWKoJb8Z3zhgOij_4k6ZnKIl5gk8LletHbsT1ZKU,190632
30
30
  topologicpy/__init__.py,sha256=vlPCanUbxe5NifC4pHcnhSzkmmYcs_UrZrTlVMsxcFs,928
31
- topologicpy/version.py,sha256=onIpJHxNjXWvum-_t59rYALX7MwOFPIcP-4a76gL8N4,23
32
- topologicpy-0.7.86.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
33
- topologicpy-0.7.86.dist-info/METADATA,sha256=evBDpufZw7KwLIkkWzkrLDnt5zwYmE_xz0AwHloe4g0,10513
34
- topologicpy-0.7.86.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
35
- topologicpy-0.7.86.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
- topologicpy-0.7.86.dist-info/RECORD,,
31
+ topologicpy/version.py,sha256=mYCzbNDO5wSdD-Yv5YhtOF5hGlgyQ-E65V4XiSUOLnk,23
32
+ topologicpy-0.7.90.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
33
+ topologicpy-0.7.90.dist-info/METADATA,sha256=h8bGLDHNJXflEvDHHSsD0bDwwj39F_AvSqvvwVvi5Ec,10513
34
+ topologicpy-0.7.90.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
35
+ topologicpy-0.7.90.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
+ topologicpy-0.7.90.dist-info/RECORD,,