topologicpy 0.7.84__py3-none-any.whl → 0.7.85__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
@@ -726,7 +726,7 @@ class Cell():
726
726
  from topologicpy.Topology import Topology
727
727
  import math
728
728
 
729
- def createCone(baseWire, topWire, baseVertex, topVertex, tolerance):
729
+ def createCone(baseWire, topWire, baseVertex, topVertex, tolerance=0.0001):
730
730
  if baseWire == None and topWire == None:
731
731
  raise Exception("Cell.Cone - Error: Both radii of the cone cannot be zero at the same time")
732
732
  elif baseWire == None:
@@ -789,7 +789,7 @@ class Cell():
789
789
  topWire = None
790
790
  baseVertex = Vertex.ByCoordinates(Vertex.X(origin, mantissa=mantissa)+xOffset, Vertex.Y(origin, mantissa=mantissa)+yOffset, Vertex.Z(origin, mantissa=mantissa)+zOffset)
791
791
  topVertex = Vertex.ByCoordinates(Vertex.X(origin, mantissa=mantissa)+xOffset, Vertex.Y(origin, mantissa=mantissa)+yOffset, Vertex.Z(origin, mantissa=mantissa)+zOffset+height)
792
- cone = createCone(baseWire, topWire, baseVertex, topVertex, tolerance)
792
+ cone = createCone(baseWire, topWire, baseVertex, topVertex, tolerance=tolerance)
793
793
  if cone == None:
794
794
  print("Cell.Cone - Error: Could not create a cone. Returning None.")
795
795
  return None
@@ -1304,7 +1304,7 @@ class Cell():
1304
1304
  from topologicpy.Topology import Topology
1305
1305
  import math
1306
1306
 
1307
- def createHyperboloid(baseVertices, topVertices, tolerance):
1307
+ def createHyperboloid(baseVertices, topVertices, tolerance=0.0001):
1308
1308
  baseWire = Wire.ByVertices(baseVertices, close=True)
1309
1309
  topWire = Wire.ByVertices(topVertices, close=True)
1310
1310
  baseFace = Face.ByWire(baseWire, tolerance=tolerance)
@@ -1358,7 +1358,7 @@ class Cell():
1358
1358
  topY = math.cos(angle-math.radians(twist))*topRadius + Vertex.Y(w_origin, mantissa=mantissa) + yOffset
1359
1359
  topV.append(Vertex.ByCoordinates(topX,topY,topZ))
1360
1360
 
1361
- hyperboloid = createHyperboloid(baseV, topV, tolerance)
1361
+ hyperboloid = createHyperboloid(baseV, topV, tolerance=tolerance)
1362
1362
  if hyperboloid == None:
1363
1363
  print("Cell.Hyperboloid - Error: Could not create a hyperboloid. Returning None.")
1364
1364
  return None
@@ -2074,7 +2074,7 @@ class Cell():
2074
2074
  if unused[i]:
2075
2075
  iv = Topology.InternalVertex(cells[i], tolerance=tolerance)
2076
2076
  for j in range(len(superCells)):
2077
- if (Vertex.IsInternal(iv, superCells[j], tolerance)):
2077
+ if (Vertex.IsInternal(iv, superCells[j], tolerance=tolerance)):
2078
2078
  sets[j].append(cells[i])
2079
2079
  unused[i] = False
2080
2080
  return sets
@@ -158,7 +158,7 @@ class CellComplex():
158
158
  return(temp_cells[0])
159
159
  if transferDictionaries == True:
160
160
  for temp_cell in temp_cells:
161
- v = Topology.InternalVertex(temp_cell)
161
+ v = Topology.InternalVertex(temp_cell, tolerance=tolerance)
162
162
  enclosing_cells = Vertex.EnclosingCell(v, cluster)
163
163
  dictionaries = [Topology.Dictionary(ec) for ec in enclosing_cells]
164
164
  d = Dictionary.ByMergedDictionaries(dictionaries, silent=silent)
@@ -191,7 +191,7 @@ class CellComplex():
191
191
  print("CellComplex.ByCellsCluster - Error: The input cluster parameter is not a valid topologic cluster. Returning None.")
192
192
  return None
193
193
  cells = Topology.Cells(cluster)
194
- return CellComplex.ByCells(cells, tolerance)
194
+ return CellComplex.ByCells(cells, tolerance=tolerance)
195
195
 
196
196
  @staticmethod
197
197
  def ByFaces(faces: list, tolerance: float = 0.0001, silent: bool = False):
@@ -236,7 +236,7 @@ class CellComplex():
236
236
  for i in range(1,len(faces)):
237
237
  newCellComplex = None
238
238
  try:
239
- newCellComplex = cellComplex.Merge(faces[i], False, tolerance)
239
+ newCellComplex = cellComplex.Merge(faces[i], False, tolerance) # Hook to Core
240
240
  except:
241
241
  if not silent:
242
242
  print("CellComplex.ByFaces - Warning: Failed to merge face #"+str(i)+". Skipping.")
@@ -284,7 +284,7 @@ class CellComplex():
284
284
  print("CellComplex.ByFacesCluster - Error: The input cluster parameter is not a valid topologic cluster. Returning None.")
285
285
  return None
286
286
  faces = Topology.Faces(cluster)
287
- return CellComplex.ByFaces(faces, tolerance)
287
+ return CellComplex.ByFaces(faces, tolerance=tolerance)
288
288
 
289
289
  @staticmethod
290
290
  def ByWires(wires: list, triangulate: bool = True, tolerance: float = 0.0001):
topologicpy/Cluster.py CHANGED
@@ -143,14 +143,14 @@ class Cluster():
143
143
  return Cluster.ByTopologies(vertices)
144
144
 
145
145
  @staticmethod
146
- def ByTopologies(*args, transferDictionaries: bool = False, silent=False):
146
+ def ByTopologies(*topologies, transferDictionaries: bool = False, silent=False):
147
147
  """
148
148
  Creates a topologic Cluster from the input list of topologies. The input can be individual topologies each as an input argument or a list of topologies stored in one input argument.
149
149
 
150
150
  Parameters
151
151
  ----------
152
- topologies : list
153
- The list of topologies.
152
+ *topologies : topologic_core.Topology
153
+ One or more instances of `topologic_core.Topology` to be processed.
154
154
  transferDictionaries : bool , optional
155
155
  If set to True, the dictionaries from the input topologies are merged and transferred to the cluster. Otherwise they are not. The default is False.
156
156
  silent : bool , optional
@@ -167,15 +167,15 @@ class Cluster():
167
167
  from topologicpy.Helper import Helper
168
168
  import inspect
169
169
 
170
- if len(args) == 0:
170
+ if len(topologies) == 0:
171
171
  if not silent:
172
172
  print("Cluster.ByTopologies - Error: The input topologies parameter is an empty list. Returning None.")
173
173
  curframe = inspect.currentframe()
174
174
  calframe = inspect.getouterframes(curframe, 2)
175
175
  print('caller name:', calframe[1][3])
176
176
  return None
177
- if len(args) == 1:
178
- topologies = args[0]
177
+ if len(topologies) == 1:
178
+ topologies = topologies[0]
179
179
  if isinstance(topologies, list):
180
180
  if len(topologies) == 0:
181
181
  if not silent:
@@ -186,7 +186,7 @@ class Cluster():
186
186
  return None
187
187
  else:
188
188
  topologyList = [x for x in topologies if Topology.IsInstance(x, "Topology")]
189
- if len(topologies) == 0:
189
+ if len(topologyList) == 0:
190
190
  if not silent:
191
191
  print("Cluster.ByTopologies - Error: The input topologies parameter does not contain any valid topologies. Returning None.")
192
192
  curframe = inspect.currentframe()
@@ -201,7 +201,7 @@ class Cluster():
201
201
  print('caller name:', calframe[1][3])
202
202
  return topologies
203
203
  else:
204
- topologyList = Helper.Flatten(list(args))
204
+ topologyList = Helper.Flatten(list(topologies))
205
205
  topologyList = [x for x in topologyList if Topology.IsInstance(x, "Topology")]
206
206
  if len(topologyList) == 0:
207
207
  if not silent:
topologicpy/Dictionary.py CHANGED
@@ -637,7 +637,40 @@ class Dictionary():
637
637
  return processTopologicDictionary(dictionary, key, value)
638
638
  else:
639
639
  return None
640
-
640
+
641
+ @staticmethod
642
+ def SetValuesAtKeys(dictionary, keys, values):
643
+ """
644
+ Creates a key/value pair in the input dictionary.
645
+
646
+ Parameters
647
+ ----------
648
+ keys : list
649
+ A list of strings representing the keys of the dictionary.
650
+ values : list
651
+ A list of values corresponding to the list of keys. Values can be integers, floats, strings, or lists
652
+
653
+ Returns
654
+ -------
655
+ topologic_core.Dictionary
656
+ The created dictionary.
657
+
658
+ """
659
+
660
+ if not isinstance(keys, list):
661
+ print("Dictionary.SetValuesAtKeys - Error: The input keys parameter is not a valid list. Returning None.")
662
+ return None
663
+ if not isinstance(values, list):
664
+ print("Dictionary.SetValuesAtkeys - Error: The input values parameter is not a valid list. Returning None.")
665
+ return None
666
+ if len(keys) != len(values):
667
+ print("Dictionary.SetValuesAtKeys - Error: The input keys and values parameters are not of equal length. Returning None.")
668
+ return None
669
+
670
+ for i, key in enumerate(keys):
671
+ dictionary = Dictionary.SetValueAtKey(dictionary, key, values[i])
672
+ return dictionary
673
+
641
674
  @staticmethod
642
675
  def _ConvertAttribute(attr):
643
676
  """
topologicpy/Edge.py CHANGED
@@ -214,7 +214,7 @@ class Edge():
214
214
 
215
215
  n = Edge.Normal(edge)
216
216
  n = Vector.Normalize(n)
217
- n = Vector.Multiply(n, offset, tolerance)
217
+ n = Vector.Multiply(n, offset, tolerance=tolerance)
218
218
  edge = Topology.Translate(edge, n[0], n[1], n[2])
219
219
  return edge
220
220
 
@@ -1544,7 +1544,7 @@ class Edge():
1544
1544
  vy = Vertex.Y(ev, mantissa=mantissa) - Vertex.Y(sv, mantissa=mantissa)
1545
1545
  vz = Vertex.Z(ev, mantissa=mantissa) - Vertex.Z(sv, mantissa=mantissa)
1546
1546
  vector = Vector.Normalize([vx, vy, vz])
1547
- vector = Vector.Multiply(vector, distance, tolerance)
1547
+ vector = Vector.Multiply(vector, distance, tolerance=tolerance)
1548
1548
  return Vertex.ByCoordinates(Vertex.X(origin, mantissa=mantissa)+vector[0], Vertex.Y(origin, mantissa=mantissa)+vector[1], Vertex.Z(origin, mantissa=mantissa)+vector[2])
1549
1549
 
1550
1550
  @staticmethod
topologicpy/Face.py CHANGED
@@ -1639,7 +1639,7 @@ class Face():
1639
1639
  return plane
1640
1640
  return [coef / norm for coef in plane]
1641
1641
 
1642
- def are_planes_coplanar(plane1, plane2, tolerance):
1642
+ def are_planes_coplanar(plane1, plane2, tolerance=0.0001):
1643
1643
  normalized_plane1 = normalize_plane_coefficients(plane1)
1644
1644
  normalized_plane2 = normalize_plane_coefficients(plane2)
1645
1645
  return np.allclose(normalized_plane1, normalized_plane2, atol=tolerance)
@@ -1844,7 +1844,7 @@ class Face():
1844
1844
  # Return the average angle
1845
1845
  return np.mean(angles)
1846
1846
 
1847
- def vertex_part_of_face(vertex, face, tolerance):
1847
+ def vertex_part_of_face(vertex, face, tolerance=0.0001):
1848
1848
  vertices = Topology.Vertices(face)
1849
1849
  for v in vertices:
1850
1850
  if Vertex.Distance(vertex, v) < tolerance:
topologicpy/Graph.py CHANGED
@@ -539,7 +539,7 @@ class Graph:
539
539
  from topologicpy.Dictionary import Dictionary
540
540
  from topologicpy.Topology import Topology
541
541
 
542
- def addIfUnique(graph_vertices, vertex, tolerance):
542
+ def addIfUnique(graph_vertices, vertex, tolerance=0.0001):
543
543
  unique = True
544
544
  returnVertex = vertex
545
545
  for gv in graph_vertices:
@@ -574,11 +574,11 @@ class Graph:
574
574
  print("Graph.AddEdge - Error: The input edge is not a valid edge. Returning the input graph.")
575
575
  return graph
576
576
  graph_vertices = Graph.Vertices(graph)
577
- graph_edges = Graph.Edges(graph, graph_vertices, tolerance)
577
+ graph_edges = Graph.Edges(graph, graph_vertices, tolerance=tolerance)
578
578
  vertices = Topology.Vertices(edge)
579
579
  new_vertices = []
580
580
  for vertex in vertices:
581
- graph_vertices, nv = addIfUnique(graph_vertices, vertex, tolerance)
581
+ graph_vertices, nv = addIfUnique(graph_vertices, vertex, tolerance=tolerance)
582
582
  new_vertices.append(nv)
583
583
  new_edge = Edge.ByVertices([new_vertices[0], new_vertices[1]], tolerance=tolerance)
584
584
  if transferEdgeDictionaries == True:
@@ -2537,7 +2537,7 @@ class Graph:
2537
2537
  outpostsKey: str = "outposts",
2538
2538
  vertexCategoryKey: str = "category",
2539
2539
  edgeCategoryKey : str = "category",
2540
- useInternalVertex: bool =True,
2540
+ useInternalVertex: bool = False,
2541
2541
  storeBREP: bool =False,
2542
2542
  mantissa: int = 6,
2543
2543
  tolerance: float = 0.0001):
@@ -2613,7 +2613,7 @@ class Graph:
2613
2613
  eds = []
2614
2614
  for sharedTopology in sharedTops:
2615
2615
  if useInternalVertex == True:
2616
- vst = Topology.InternalVertex(sharedTopology, tolerance)
2616
+ vst = Topology.InternalVertex(sharedTopology, tolerance=tolerance)
2617
2617
  else:
2618
2618
  vst = Topology.CenterOfMass(sharedTopology)
2619
2619
  d1 = Topology.Dictionary(sharedTopology)
@@ -2636,7 +2636,7 @@ class Graph:
2636
2636
  eds = []
2637
2637
  for sharedAp in sharedAps:
2638
2638
  if useInternalVertex == True:
2639
- vsa = Topology.InternalVertex(sharedAp, tolerance)
2639
+ vsa = Topology.InternalVertex(sharedAp, tolerance=tolerance)
2640
2640
  else:
2641
2641
  vsa = Topology.CenterOfMass(sharedAp)
2642
2642
  d1 = Topology.Dictionary(sharedAp)
@@ -2658,20 +2658,16 @@ class Graph:
2658
2658
  def _toExteriorTopologies(vt, exteriorTops):
2659
2659
  verts = []
2660
2660
  eds = []
2661
- for exteriorTop in exteriorTops:
2661
+ for i, exteriorTop in enumerate(exteriorTops):
2662
2662
  if useInternalVertex == True:
2663
- vet = Topology.InternalVertex(exteriorTop, tolerance)
2663
+ vet = Topology.InternalVertex(exteriorTop, tolerance=tolerance)
2664
2664
  else:
2665
2665
  vet = Topology.CenterOfMass(exteriorTop)
2666
- vet = Topology.SetDictionary(vet, Topology.Dictionary(exteriorTop), silent=True)
2667
2666
  d1 = Topology.Dictionary(exteriorTop)
2668
2667
  d1 = Dictionary.SetValueAtKey(d1, vertexCategoryKey, 3) # exterior topology
2669
2668
  if storeBREP:
2670
- d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exteriorTop), Topology.Type(exteriorTop), Topology.TypeAsString(exteriorTop)])
2671
- d3 = mergeDictionaries2([d1, d2])
2672
- vet = Topology.SetDictionary(vet, d3, silent=True)
2673
- else:
2674
- vet = Topology.SetDictionary(vet, d1, silent=True)
2669
+ d1 = Dictionary.SetValuesAtKeys(d1, ["brep", "brepType", "brepTypeString"], [Topology.BREPString(exteriorTop), Topology.Type(exteriorTop), Topology.TypeAsString(exteriorTop)])
2670
+ vet = Topology.SetDictionary(vet, d1, silent=True)
2675
2671
  verts.append(vet)
2676
2672
  tempe = Edge.ByStartVertexEndVertex(vt, vet, tolerance=tolerance)
2677
2673
  tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Topologies", 3])
@@ -2684,18 +2680,15 @@ class Graph:
2684
2680
  eds = []
2685
2681
  for exAp in exteriorAps:
2686
2682
  if useInternalVertex == True:
2687
- vea = Topology.InternalVertex(exAp, tolerance)
2683
+ vea = Topology.InternalVertex(exAp, tolerance=tolerance)
2688
2684
  else:
2689
2685
  vea = Topology.CenterOfMass(exAp)
2690
2686
  d1 = Topology.Dictionary(exAp)
2691
2687
  d1 = Dictionary.SetValueAtKey(d1, vertexCategoryKey, 4) # exterior aperture
2692
2688
  vea = Vertex.ByCoordinates(Vertex.X(vea, mantissa=mantissa)+(tolerance*100), Vertex.Y(vea, mantissa=mantissa)+(tolerance*100), Vertex.Z(vea, mantissa=mantissa)+(tolerance*100))
2693
2689
  if storeBREP:
2694
- d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exAp), Topology.Type(exAp), Topology.TypeAsString(exAp)])
2695
- d3 = mergeDictionaries2([d1, d2])
2696
- vea = Topology.SetDictionary(vea, d3, silent=True)
2697
- else:
2698
- vea = Topology.SetDictionary(vea, d1, silent=True)
2690
+ d1 = Dictionary.SetValuesAtKeys(d1, ["brep", "brepType", "brepTypeString"], [Topology.BREPString(exAp), Topology.Type(exAp), Topology.TypeAsString(exAp)])
2691
+ vea = Topology.SetDictionary(vea, d1, silent=True)
2699
2692
  verts.append(vea)
2700
2693
  tempe = Edge.ByStartVertexEndVertex(vt, vea, tolerance=tolerance)
2701
2694
  tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Apertures", 4])
@@ -2710,7 +2703,7 @@ class Graph:
2710
2703
  if Topology.IsInstance(content, "Aperture"):
2711
2704
  content = Aperture.Topology(content)
2712
2705
  if useInternalVertex == True:
2713
- vct = Topology.InternalVertex(content, tolerance)
2706
+ vct = Topology.InternalVertex(content, tolerance=tolerance)
2714
2707
  else:
2715
2708
  vct = Topology.CenterOfMass(content)
2716
2709
  vct = Vertex.ByCoordinates(Vertex.X(vct, mantissa=mantissa)+(tolerance*100), Vertex.Y(vct, mantissa=mantissa)+(tolerance*100), Vertex.Z(vct, mantissa=mantissa)+(tolerance*100))
@@ -2999,7 +2992,7 @@ class Graph:
2999
2992
  graph_edges += eds
3000
2993
  for sharedTopology in sharedTopologies:
3001
2994
  if useInternalVertex == True:
3002
- vst = Topology.InternalVertex(sharedTopology, tolerance)
2995
+ vst = Topology.InternalVertex(sharedTopology, tolerance=tolerance)
3003
2996
  else:
3004
2997
  vst = Topology.CenterOfMass(sharedTopology)
3005
2998
  d = Topology.Dictionary(sharedTopology)
@@ -3023,7 +3016,7 @@ class Graph:
3023
3016
  graph_edges += eds
3024
3017
  for exteriorTopology in exteriorTopologies:
3025
3018
  if useInternalVertex == True:
3026
- vet = Topology.InternalVertex(exteriorTopology, tolerance)
3019
+ vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
3027
3020
  else:
3028
3021
  vet = Topology.CenterOfMass(exteriorTopology)
3029
3022
  d = Topology.Dictionary(exteriorTopology)
@@ -3084,7 +3077,7 @@ class Graph:
3084
3077
  graph_edges += eds
3085
3078
  for exteriorTopology in exteriorTopologies:
3086
3079
  if useInternalVertex == True:
3087
- vet = Topology.InternalVertex(exteriorTopology, tolerance)
3080
+ vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
3088
3081
  else:
3089
3082
  vet = Topology.CenterOfMass(exteriorTopology)
3090
3083
  d = Topology.Dictionary(exteriorTopology)
@@ -3243,7 +3236,7 @@ class Graph:
3243
3236
  graph_edges += eds
3244
3237
  for sharedTopology in sharedTopologies:
3245
3238
  if useInternalVertex == True:
3246
- vst = Topology.InternalVertex(sharedTopology, tolerance)
3239
+ vst = Topology.InternalVertex(sharedTopology, tolerance=tolerance)
3247
3240
  else:
3248
3241
  vst = Topology.CenterOfMass(sharedTopology)
3249
3242
  d = Topology.Dictionary(sharedTopology)
@@ -3267,7 +3260,7 @@ class Graph:
3267
3260
  graph_edges += eds
3268
3261
  for exteriorTopology in exteriorTopologies:
3269
3262
  if useInternalVertex == True:
3270
- vet = Topology.InternalVertex(exteriorTopology, tolerance)
3263
+ vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
3271
3264
  else:
3272
3265
  vet = Topology.CenterOfMass(exteriorTopology)
3273
3266
  d = Topology.Dictionary(exteriorTopology)
@@ -3328,7 +3321,7 @@ class Graph:
3328
3321
  graph_edges += eds
3329
3322
  for exteriorTopology in exteriorTopologies:
3330
3323
  if useInternalVertex == True:
3331
- vet = Topology.InternalVertex(exteriorTopology, tolerance)
3324
+ vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
3332
3325
  else:
3333
3326
  vet = Topology.CenterOfMass(exteriorTopology)
3334
3327
  d = Topology.Dictionary(exteriorTopology)
@@ -3489,7 +3482,7 @@ class Graph:
3489
3482
  graph_edges += eds
3490
3483
  for sharedTopology in sharedTopologies:
3491
3484
  if useInternalVertex == True:
3492
- vst = Topology.InternalVertex(sharedTopology, tolerance)
3485
+ vst = Topology.InternalVertex(sharedTopology, tolerance=tolerance)
3493
3486
  else:
3494
3487
  vst = Topology.CenterOfMass(sharedTopology)
3495
3488
  d = Topology.Dictionary(sharedTopology)
@@ -3513,7 +3506,7 @@ class Graph:
3513
3506
  graph_edges += eds
3514
3507
  for exteriorTopology in exteriorTopologies:
3515
3508
  if useInternalVertex == True:
3516
- vet = Topology.InternalVertex(exteriorTopology, tolerance)
3509
+ vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
3517
3510
  else:
3518
3511
  vet = Topology.CenterOfMass(exteriorTopology)
3519
3512
  d = Topology.Dictionary(exteriorTopology)
@@ -3576,7 +3569,7 @@ class Graph:
3576
3569
  graph_edges += eds
3577
3570
  for exteriorTopology in exteriorTopologies:
3578
3571
  if useInternalVertex == True:
3579
- vet = Topology.InternalVertex(exteriorTopology, tolerance)
3572
+ vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
3580
3573
  else:
3581
3574
  vet = Topology.CenterOfMass(exteriorTopology)
3582
3575
  d = Topology.Dictionary(exteriorTopology)
@@ -3616,7 +3609,7 @@ class Graph:
3616
3609
  if Topology.IsInstance(content, "Aperture"):
3617
3610
  content = Aperture.Topology(content)
3618
3611
  if useInternalVertex == True:
3619
- vst = Topology.InternalVertex(content, tolerance)
3612
+ vst = Topology.InternalVertex(content, tolerance=tolerance)
3620
3613
  else:
3621
3614
  vst = Topology.CenterOfMass(content)
3622
3615
  d1 = Topology.Dictionary(content)
@@ -3651,7 +3644,7 @@ class Graph:
3651
3644
  outposts = []
3652
3645
  for outpost in outposts:
3653
3646
  if useInternalVertex == True:
3654
- vop = Topology.InternalVertex(outpost, tolerance)
3647
+ vop = Topology.InternalVertex(outpost, tolerance=tolerance)
3655
3648
  else:
3656
3649
  vop = Topology.CenterOfMass(outpost)
3657
3650
  tempe = Edge.ByStartVertexEndVertex(topology, vop, tolerance=tolerance)
@@ -4071,7 +4064,7 @@ class Graph:
4071
4064
  if Topology.IsSame(va, vb):
4072
4065
  d = 0
4073
4066
  else:
4074
- d = Graph.TopologicalDistance(graph, va, vb, tolerance)
4067
+ d = Graph.TopologicalDistance(graph, va, vb, tolerance=tolerance)
4075
4068
  top_dist += d
4076
4069
  if top_dist == 0:
4077
4070
  print("Graph.ClosenessCentrality - Warning: Topological Distance is Zero.")
@@ -4086,7 +4079,7 @@ class Graph:
4086
4079
  if Topology.IsSame(va, vb):
4087
4080
  d = 0
4088
4081
  else:
4089
- d = Graph.TopologicalDistance(graph, va, vb, tolerance)
4082
+ d = Graph.TopologicalDistance(graph, va, vb, tolerance=tolerance)
4090
4083
  top_dist += d
4091
4084
  if top_dist == 0:
4092
4085
  scores.append(0)
@@ -4173,7 +4166,7 @@ class Graph:
4173
4166
  if not Topology.IsInstance(edge, "Edge"):
4174
4167
  print("Graph.ContainsEdge - Error: The input edge is not a valid edge. Returning None.")
4175
4168
  return None
4176
- return graph.ContainsEdge(edge, tolerance)
4169
+ return graph.ContainsEdge(edge, tolerance) # Hook to Core
4177
4170
 
4178
4171
  @staticmethod
4179
4172
  def ContainsVertex(graph, vertex, tolerance=0.0001):
@@ -4203,7 +4196,7 @@ class Graph:
4203
4196
  if not Topology.IsInstance(vertex, "Vertex"):
4204
4197
  print("Graph.ContainsVertex - Error: The input vertex is not a valid vertex. Returning None.")
4205
4198
  return None
4206
- return graph.ContainsVertex(vertex, tolerance)
4199
+ return graph.ContainsVertex(vertex, tolerance) # Hook to Core
4207
4200
 
4208
4201
 
4209
4202
  @staticmethod
@@ -4567,7 +4560,7 @@ class Graph:
4567
4560
  if not Topology.IsInstance(vertexB, "Vertex"):
4568
4561
  print("Graph.Edge - Error: The input vertexB is not a valid vertex. Returning None.")
4569
4562
  return None
4570
- return graph.Edge(vertexA, vertexB, tolerance)
4563
+ return graph.Edge(vertexA, vertexB, tolerance) # Hook to Core
4571
4564
 
4572
4565
  @staticmethod
4573
4566
  def Edges(graph, vertices=None, tolerance=0.0001):
@@ -8474,7 +8467,7 @@ class Graph:
8474
8467
  return shortestPaths
8475
8468
 
8476
8469
  @staticmethod
8477
- def Show(graph,
8470
+ def Show(*graphs,
8478
8471
  sagitta = 0,
8479
8472
  absolute = False,
8480
8473
  sides = 8,
@@ -8486,6 +8479,8 @@ class Graph:
8486
8479
  vertexLabelKey=None,
8487
8480
  vertexGroupKey=None,
8488
8481
  vertexGroups=[],
8482
+ vertexMinGroup=None,
8483
+ vertexMaxGroup=None,
8489
8484
  showVertices=True,
8490
8485
  showVertexLabel=False,
8491
8486
  showVertexLegend=False,
@@ -8496,6 +8491,8 @@ class Graph:
8496
8491
  edgeLabelKey=None,
8497
8492
  edgeGroupKey=None,
8498
8493
  edgeGroups=[],
8494
+ edgeMinGroup=None,
8495
+ edgeMaxGroup=None,
8499
8496
  showEdges=True,
8500
8497
  showEdgeLabel=False,
8501
8498
  showEdgeLegend=False,
@@ -8522,8 +8519,8 @@ class Graph:
8522
8519
 
8523
8520
  Parameters
8524
8521
  ----------
8525
- graph : topologic_core.Graph
8526
- The input graph.
8522
+ *graphs : topologic_core.Graph
8523
+ One or more toplogic_core.graph objects.
8527
8524
  sagitta : float , optional
8528
8525
  The length of the sagitta. In mathematics, the sagitta is the line connecting the center of a chord to the apex (or highest point) of the arc subtended by that chord. The default is 0 which means a straight edge is drawn instead of an arc. The default is 0.
8529
8526
  absolute : bool , optional
@@ -8553,6 +8550,10 @@ class Graph:
8553
8550
  The dictionary key to use to display the vertex group. The default is None.
8554
8551
  vertexGroups : list , optional
8555
8552
  The list of vertex groups against which to index the color of the vertex. The default is [].
8553
+ vertexMinGroup : int or float , optional
8554
+ For numeric vertexGroups, vertexMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the minimum value in vertexGroups. The default is None.
8555
+ vertexMaxGroup : int or float , optional
8556
+ For numeric vertexGroups, vertexMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the maximum value in vertexGroups. The default is None.
8556
8557
  showVertices : bool , optional
8557
8558
  If set to True the vertices will be drawn. Otherwise, they will not be drawn. The default is True.
8558
8559
  showVertexLabel : bool , optional
@@ -8579,6 +8580,10 @@ class Graph:
8579
8580
  The dictionary key to use to display the edge group. The default is None.
8580
8581
  edgeGroups : list , optional
8581
8582
  The list of edge groups against which to index the color of the edge. The default is [].
8583
+ edgeMinGroup : int or float , optional
8584
+ For numeric edgeGroups, edgeMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the edgeGroupKey. If set to None, it is set to the minimum value in edgeGroups. The default is None.
8585
+ edgeMaxGroup : int or float , optional
8586
+ For numeric edgeGroups, edgeMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the edgeGroupKey. If set to None, it is set to the maximum value in edgeGroups. The default is None.
8582
8587
  showEdges : bool , optional
8583
8588
  If set to True the edges will be drawn. Otherwise, they will not be drawn. The default is True.
8584
8589
  showEdgeLabel : bool , optional
@@ -8637,12 +8642,49 @@ class Graph:
8637
8642
  """
8638
8643
  from topologicpy.Plotly import Plotly
8639
8644
  from topologicpy.Topology import Topology
8645
+ from topologicpy.Helper import Helper
8640
8646
 
8641
- if not Topology.IsInstance(graph, "Graph"):
8642
- print("Graph.Show - Error: The input graph is not a valid graph. Returning None.")
8643
- return None
8644
-
8645
- data= Plotly.DataByGraph(graph, sagitta=sagitta, absolute=absolute, sides=sides, angle=angle, vertexColor=vertexColor, vertexColorKey=vertexColorKey, vertexSize=vertexSize, vertexSizeKey=vertexSizeKey, vertexLabelKey=vertexLabelKey, vertexGroupKey=vertexGroupKey, vertexGroups=vertexGroups, showVertices=showVertices, showVertexLabel=showVertexLabel, showVertexLegend=showVertexLegend, edgeColor=edgeColor, edgeColorKey=edgeColorKey, edgeWidth=edgeWidth, edgeWidthKey=edgeWidthKey, edgeLabelKey=edgeLabelKey, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups, showEdges=showEdges, showEdgeLabel=showEdgeLabel, showEdgeLegend=showEdgeLegend, colorScale=colorScale, silent=silent)
8647
+ if isinstance(graphs, tuple):
8648
+ graphs = Helper.Flatten(list(graphs))
8649
+ if isinstance(graphs, list):
8650
+ new_graphs = [t for t in graphs if Topology.IsInstance(t, "Graph")]
8651
+ if len(new_graphs) == 0:
8652
+ if not silent:
8653
+ print("Topology.Show - Error: the input topologies parameter does not contain any valid topology. Returning None.")
8654
+ return None
8655
+ data = []
8656
+ for graph in new_graphs:
8657
+ data += Plotly.DataByGraph(graph,
8658
+ sagitta=sagitta,
8659
+ absolute=absolute,
8660
+ sides=sides,
8661
+ angle=angle,
8662
+ vertexColor=vertexColor,
8663
+ vertexColorKey=vertexColorKey,
8664
+ vertexSize=vertexSize,
8665
+ vertexSizeKey=vertexSizeKey,
8666
+ vertexLabelKey=vertexLabelKey,
8667
+ vertexGroupKey=vertexGroupKey,
8668
+ vertexGroups=vertexGroups,
8669
+ vertexMinGroup=vertexMinGroup,
8670
+ vertexMaxGroup=vertexMaxGroup,
8671
+ showVertices=showVertices,
8672
+ showVertexLabel=showVertexLabel,
8673
+ showVertexLegend=showVertexLegend,
8674
+ edgeColor=edgeColor,
8675
+ edgeColorKey=edgeColorKey,
8676
+ edgeWidth=edgeWidth,
8677
+ edgeWidthKey=edgeWidthKey,
8678
+ edgeLabelKey=edgeLabelKey,
8679
+ edgeGroupKey=edgeGroupKey,
8680
+ edgeGroups=edgeGroups,
8681
+ edgeMinGroup=edgeMinGroup,
8682
+ edgeMaxGroup=edgeMaxGroup,
8683
+ showEdges=showEdges,
8684
+ showEdgeLabel=showEdgeLabel,
8685
+ showEdgeLegend=showEdgeLegend,
8686
+ colorScale=colorScale,
8687
+ silent=silent)
8646
8688
  fig = Plotly.FigureByData(data, width=width, height=height, xAxis=xAxis, yAxis=yAxis, zAxis=zAxis, axisSize=axisSize, backgroundColor=backgroundColor,
8647
8689
  marginLeft=marginLeft, marginRight=marginRight, marginTop=marginTop, marginBottom=marginBottom, tolerance=tolerance)
8648
8690
  Plotly.Show(fig, renderer=renderer, camera=camera, center=center, up=up, projection=projection)
@@ -8703,7 +8745,7 @@ class Graph:
8703
8745
  if not Topology.IsInstance(vertexB, "Vertex"):
8704
8746
  print("Graph.TopologicalDistance - Error: The input vertexB is not a valid vertex. Returning None.")
8705
8747
  return None
8706
- return graph.TopologicalDistance(vertexA, vertexB, tolerance)
8748
+ return graph.TopologicalDistance(vertexA, vertexB, tolerance) # Hook to Core
8707
8749
 
8708
8750
  @staticmethod
8709
8751
  def Topology(graph):
@@ -8781,7 +8823,7 @@ class Graph:
8781
8823
  if not vertexInList(vertex, vertices):
8782
8824
  vertices.append(vertex)
8783
8825
  if parent:
8784
- edge = Graph.Edge(graph, parent, vertex, tolerance)
8826
+ edge = Graph.Edge(graph, parent, vertex, tolerance=tolerance)
8785
8827
  ev = Edge.EndVertex(edge)
8786
8828
  if Vertex.Distance(parent, ev) < tolerance:
8787
8829
  edge = Edge.Reverse(edge)
@@ -8792,7 +8834,7 @@ class Graph:
8792
8834
  dictionary['vertices'] = vertices
8793
8835
  dictionary['edges'] = edges
8794
8836
  for child in children:
8795
- dictionary = buildTree(graph, dictionary, child, vertex, tolerance)
8837
+ dictionary = buildTree(graph, dictionary, child, vertex, tolerance=tolerance)
8796
8838
  return dictionary
8797
8839
 
8798
8840
  if not Topology.IsInstance(graph, "Graph"):
@@ -8803,7 +8845,7 @@ class Graph:
8803
8845
  else:
8804
8846
  vertex = Graph.NearestVertex(graph, vertex)
8805
8847
  dictionary = {'vertices':[], 'edges':[]}
8806
- dictionary = buildTree(graph, dictionary, vertex, None, tolerance)
8848
+ dictionary = buildTree(graph, dictionary, vertex, None, tolerance=tolerance)
8807
8849
  return Graph.ByVerticesEdges(dictionary['vertices'], dictionary['edges'])
8808
8850
 
8809
8851
  @staticmethod
topologicpy/Grid.py CHANGED
@@ -86,7 +86,7 @@ class Grid():
86
86
  uRange.sort()
87
87
  uuVector = Vector.Normalize(uVector)
88
88
  for u in uRange:
89
- tempVec = Vector.Multiply(uuVector, u, tolerance)
89
+ tempVec = Vector.Multiply(uuVector, u, tolerance=tolerance)
90
90
  v1 = Vertex.ByCoordinates(Vertex.X(uOrigin, mantissa=mantissa)+tempVec[0], Vertex.Y(uOrigin, mantissa=mantissa)+tempVec[1], Vertex.Z(uOrigin, mantissa=mantissa)+tempVec[2])
91
91
  v2 = Vertex.ByCoordinates(Vertex.X(v1, mantissa=mantissa)+vVector[0], Vertex.Y(v1, mantissa=mantissa)+vVector[1], Vertex.Z(v1, mantissa=mantissa)+vVector[2])
92
92
  e = Edge.ByVertices([v1, v2], tolerance=tolerance)
@@ -107,7 +107,7 @@ class Grid():
107
107
  vRange.sort()
108
108
  uvVector = Vector.Normalize(vVector)
109
109
  for v in vRange:
110
- tempVec = Vector.Multiply(uvVector, v, tolerance)
110
+ tempVec = Vector.Multiply(uvVector, v, tolerance=tolerance)
111
111
  v1 = Vertex.ByCoordinates(Vertex.X(vOrigin, mantissa=mantissa)+tempVec[0], Vertex.Y(vOrigin, mantissa=mantissa)+tempVec[1], Vertex.Z(vOrigin, mantissa=mantissa)+tempVec[2])
112
112
  v2 = Vertex.ByCoordinates(Vertex.X(v1, mantissa=mantissa)+uVector[0], Vertex.Y(v1, mantissa=mantissa)+uVector[1], Vertex.Z(v1, mantissa=mantissa)+uVector[2])
113
113
  e = Edge.ByVertices([v1, v2], tolerance=tolerance)
@@ -282,8 +282,8 @@ class Grid():
282
282
  uvVector = Vector.Normalize(vVector)
283
283
  for u in uRange:
284
284
  for v in vRange:
285
- uTempVec = Vector.Multiply(uuVector, u, tolerance)
286
- vTempVec = Vector.Multiply(uvVector, v, tolerance)
285
+ uTempVec = Vector.Multiply(uuVector, u, tolerance=tolerance)
286
+ vTempVec = Vector.Multiply(uvVector, v, tolerance=tolerance)
287
287
  gridVertex = Vertex.ByCoordinates(Vertex.X(origin, mantissa=mantissa)+uTempVec[0], Vertex.Y(origin, mantissa=mantissa)+vTempVec[1], Vertex.Z(origin, mantissa=mantissa)+uTempVec[2])
288
288
  if clip and Topology.IsInstance(face, "Face"):
289
289
  gridVertex = gridVertex.Intersect(face, False)