topologicpy 0.7.84__py3-none-any.whl → 0.7.86__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
@@ -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:
@@ -2162,6 +2162,8 @@ class Graph:
2162
2162
  @staticmethod
2163
2163
  def ByIFCFile(file, includeTypes: list = [], excludeTypes: list = [],
2164
2164
  includeRels: list = [], excludeRels: list = [],
2165
+ transferDictionaries: bool = False, storeBREP: bool = False,
2166
+ removeCoplanarFaces: bool = False,
2165
2167
  xMin: float = -0.5, yMin: float = -0.5, zMin: float = -0.5,
2166
2168
  xMax: float = 0.5, yMax: float = 0.5, zMax: float = 0.5,
2167
2169
  tolerance: float = 0.0001):
@@ -2180,6 +2182,12 @@ class Graph:
2180
2182
  A list of IFC relationship types to include in the graph. The default is [] which means all relationship types are included.
2181
2183
  excludeRels : list , optional
2182
2184
  A list of IFC relationship types to exclude from the graph. The default is [] which mean no relationship type is excluded.
2185
+ transferDictionaries : bool , optional
2186
+ If set to True, the dictionaries from the IFC file will be transferred to the topology. Otherwise, they won't. The default is False.
2187
+ storeBREP : bool , optional
2188
+ If set to True, store the BRep of the subtopology in its representative vertex. The default is False.
2189
+ removeCoplanarFaces : bool , optional
2190
+ If set to True, coplanar faces are removed. Otherwise they are not. The default is False.
2183
2191
  xMin : float, optional
2184
2192
  The desired minimum value to assign for a vertex's X coordinate. The default is -0.5.
2185
2193
  yMin : float, optional
@@ -2281,6 +2289,126 @@ class Graph:
2281
2289
  relationships.append(ifc_rel)
2282
2290
  return relationships
2283
2291
 
2292
+ def get_psets(entity):
2293
+ # Initialize the PSET dictionary for this entity
2294
+ psets = {}
2295
+
2296
+ # Check if the entity has a GlobalId
2297
+ if not hasattr(entity, 'GlobalId'):
2298
+ raise ValueError("The provided entity does not have a GlobalId.")
2299
+
2300
+ # Get the property sets related to this entity
2301
+ for definition in entity.IsDefinedBy:
2302
+ if definition.is_a('IfcRelDefinesByProperties'):
2303
+ property_set = definition.RelatingPropertyDefinition
2304
+
2305
+ # Check if it is a property set
2306
+ if not property_set == None:
2307
+ if property_set.is_a('IfcPropertySet'):
2308
+ pset_name = "IFC_"+property_set.Name
2309
+
2310
+ # Dictionary to hold individual properties
2311
+ properties = {}
2312
+
2313
+ # Iterate over the properties in the PSET
2314
+ for prop in property_set.HasProperties:
2315
+ if prop.is_a('IfcPropertySingleValue'):
2316
+ # Get the property name and value
2317
+ prop_name = "IFC_"+prop.Name
2318
+ prop_value = prop.NominalValue.wrappedValue if prop.NominalValue else None
2319
+ properties[prop_name] = prop_value
2320
+
2321
+ # Add this PSET to the dictionary for this entity
2322
+ psets[pset_name] = properties
2323
+ return psets
2324
+
2325
+ def get_color_transparency_material(entity):
2326
+ import random
2327
+
2328
+ # Set default Material Name and ID
2329
+ material_list = []
2330
+ # Set default transparency based on entity type or material
2331
+ default_transparency = 0.0
2332
+
2333
+ # Check if the entity is an opening or made of glass
2334
+ is_a = entity.is_a().lower()
2335
+ if "opening" in is_a or "window" in is_a or "door" in is_a or "space" in is_a:
2336
+ default_transparency = 0.7
2337
+ elif "space" in is_a:
2338
+ default_transparency = 0.8
2339
+
2340
+ # Check if the entity has constituent materials (e.g., glass)
2341
+ else:
2342
+ # Check for associated materials (ConstituentMaterial or direct material assignment)
2343
+ materials_checked = False
2344
+ if hasattr(entity, 'HasAssociations'):
2345
+ for rel in entity.HasAssociations:
2346
+ if rel.is_a('IfcRelAssociatesMaterial'):
2347
+ material = rel.RelatingMaterial
2348
+ if material.is_a('IfcMaterial') and 'glass' in material.Name.lower():
2349
+ default_transparency = 0.5
2350
+ materials_checked = True
2351
+ elif material.is_a('IfcMaterialLayerSetUsage'):
2352
+ material_layers = material.ForLayerSet.MaterialLayers
2353
+ for layer in material_layers:
2354
+ material_list.append(layer.Material.Name)
2355
+ if 'glass' in layer.Material.Name.lower():
2356
+ default_transparency = 0.5
2357
+ materials_checked = True
2358
+
2359
+ # Check for ConstituentMaterial if available
2360
+ if hasattr(entity, 'HasAssociations') and not materials_checked:
2361
+ for rel in entity.HasAssociations:
2362
+ if rel.is_a('IfcRelAssociatesMaterial'):
2363
+ material = rel.RelatingMaterial
2364
+ if material.is_a('IfcMaterialConstituentSet'):
2365
+ for constituent in material.MaterialConstituents:
2366
+ material_list.append(constituent.Material.Name)
2367
+ if 'glass' in constituent.Material.Name.lower():
2368
+ default_transparency = 0.5
2369
+ materials_checked = True
2370
+
2371
+ # Check if the entity has ShapeAspects with associated materials or styles
2372
+ if hasattr(entity, 'HasShapeAspects') and not materials_checked:
2373
+ for shape_aspect in entity.HasShapeAspects:
2374
+ if hasattr(shape_aspect, 'StyledByItem') and shape_aspect.StyledByItem:
2375
+ for styled_item in shape_aspect.StyledByItem:
2376
+ for style in styled_item.Styles:
2377
+ if style.is_a('IfcSurfaceStyle'):
2378
+ for surface_style in style.Styles:
2379
+ if surface_style.is_a('IfcSurfaceStyleRendering'):
2380
+ transparency = getattr(surface_style, 'Transparency', default_transparency)
2381
+ if transparency > 0:
2382
+ default_transparency = transparency
2383
+
2384
+ # Try to get the actual color and transparency if defined
2385
+ if hasattr(entity, 'Representation') and entity.Representation:
2386
+ for rep in entity.Representation.Representations:
2387
+ for item in rep.Items:
2388
+ if hasattr(item, 'StyledByItem') and item.StyledByItem:
2389
+ for styled_item in item.StyledByItem:
2390
+ if hasattr(styled_item, 'Styles'):
2391
+ for style in styled_item.Styles:
2392
+ if style.is_a('IfcSurfaceStyle'):
2393
+ for surface_style in style.Styles:
2394
+ if surface_style.is_a('IfcSurfaceStyleRendering'):
2395
+ color = surface_style.SurfaceColour
2396
+ transparency = getattr(surface_style, 'Transparency', default_transparency)
2397
+ return (color.Red*255, color.Green*255, color.Blue*255), transparency, material_list
2398
+
2399
+ # If no color is defined, return a consistent random color based on the entity type
2400
+ if "wall" in is_a:
2401
+ color = (175, 175, 175)
2402
+ elif "slab" in is_a:
2403
+ color = (200, 200, 200)
2404
+ elif "space" in is_a:
2405
+ color = (250, 250, 250)
2406
+ else:
2407
+ random.seed(hash(is_a))
2408
+ color = (random.random(), random.random(), random.random())
2409
+
2410
+ return color, default_transparency, material_list
2411
+
2284
2412
  def vertexByIFCObject(ifc_object, object_types, restrict=False):
2285
2413
  settings = ifcopenshell.geom.settings()
2286
2414
  settings.set(settings.USE_WORLD_COORDS,True)
@@ -2318,8 +2446,47 @@ class Graph:
2318
2446
  y = random.uniform(yMin,yMax)
2319
2447
  z = random.uniform(zMin,zMax)
2320
2448
  centroid = Vertex.ByCoordinates(x, y, z)
2321
- d = Dictionary.ByKeysValues(["id","psets", "type", "type_id", "name", "label"], [obj_id, psets, obj_type, obj_type_id, name, label])
2322
- centroid = Topology.SetDictionary(centroid, d)
2449
+
2450
+ # Store relevant information
2451
+ if transferDictionaries == True:
2452
+ color, transparency, material_list = get_color_transparency_material(ifc_object)
2453
+ entity_dict = {
2454
+ "TOPOLOGIC_id": str(Topology.UUID(centroid)),
2455
+ "TOPOLOGIC_name": getattr(ifc_object, 'Name', "Untitled"),
2456
+ "TOPOLOGIC_type": Topology.TypeAsString(centroid),
2457
+ "TOPOLOGIC_color": color,
2458
+ "TOPOLOGIC_opacity": 1.0 - transparency,
2459
+ "IFC_global_id": getattr(ifc_object, 'GlobalId', 0),
2460
+ "IFC_name": getattr(ifc_object, 'Name', "Untitled"),
2461
+ "IFC_type": ifc_object.is_a(),
2462
+ "IFC_material_list": material_list,
2463
+ }
2464
+ topology_dict = Dictionary.ByPythonDictionary(entity_dict)
2465
+ # Get PSETs dictionary
2466
+ pset_python_dict = get_psets(ifc_object)
2467
+ pset_dict = Dictionary.ByPythonDictionary(pset_python_dict)
2468
+ topology_dict = Dictionary.ByMergedDictionaries([topology_dict, pset_dict])
2469
+ if storeBREP == True:
2470
+ shape_topology = None
2471
+ if hasattr(ifc_object, "Representation") and ifc_object.Representation:
2472
+ for rep in ifc_object.Representation.Representations:
2473
+ if rep.is_a("IfcShapeRepresentation"):
2474
+ # Generate the geometry for this entity
2475
+ shape = ifcopenshell.geom.create_shape(settings, ifc_object)
2476
+ # Get grouped vertices and grouped faces
2477
+ grouped_verts = shape.geometry.verts
2478
+ verts = [ [grouped_verts[i], grouped_verts[i + 1], grouped_verts[i + 2]] for i in range(0, len(grouped_verts), 3)]
2479
+ grouped_edges = shape.geometry.edges
2480
+ edges = [[grouped_edges[i], grouped_edges[i + 1]] for i in range(0, len(grouped_edges), 2)]
2481
+ grouped_faces = shape.geometry.faces
2482
+ faces = [ [grouped_faces[i], grouped_faces[i + 1], grouped_faces[i + 2]] for i in range(0, len(grouped_faces), 3)]
2483
+ shape_topology = Topology.ByGeometry(verts, edges, faces, silent=True)
2484
+ if not shape_topology == None:
2485
+ if removeCoplanarFaces == True:
2486
+ shape_topology = Topology.RemoveCoplanarFaces(shape_topology, epsilon=0.0001)
2487
+ if not shape_topology == None:
2488
+ topology_dict = Dictionary.SetValuesAtKeys(topology_dict, ["brep", "brepType", "brepTypeString"], [Topology.BREPString(shape_topology), Topology.Type(shape_topology), Topology.TypeAsString(shape_topology)])
2489
+ centroid = Topology.SetDictionary(centroid, topology_dict)
2323
2490
  return centroid
2324
2491
  return None
2325
2492
 
@@ -2333,52 +2500,57 @@ class Graph:
2333
2500
  if ifc_rel.is_a("IfcRelConnectsPorts"):
2334
2501
  source = ifc_rel.RelatingPort
2335
2502
  destinations = ifc_rel.RelatedPorts
2336
- if ifc_rel.is_a("IfcRelConnectsPortToElement"):
2503
+ elif ifc_rel.is_a("IfcRelConnectsPortToElement"):
2337
2504
  source = ifc_rel.RelatingPort
2338
2505
  destinations = [ifc_rel.RelatedElement]
2339
- if ifc_rel.is_a("IfcRelAggregates"):
2506
+ elif ifc_rel.is_a("IfcRelAggregates"):
2340
2507
  source = ifc_rel.RelatingObject
2341
2508
  destinations = ifc_rel.RelatedObjects
2342
- if ifc_rel.is_a("IfcRelNests"):
2509
+ elif ifc_rel.is_a("IfcRelNests"):
2343
2510
  source = ifc_rel.RelatingObject
2344
2511
  destinations = ifc_rel.RelatedObjects
2345
- if ifc_rel.is_a("IfcRelAssignsToGroup"):
2512
+ elif ifc_rel.is_a("IfcRelAssignsToGroup"):
2346
2513
  source = ifc_rel.RelatingGroup
2347
2514
  destinations = ifc_rel.RelatedObjects
2348
- if ifc_rel.is_a("IfcRelConnectsPathElements"):
2515
+ elif ifc_rel.is_a("IfcRelConnectsPathElements"):
2349
2516
  source = ifc_rel.RelatingElement
2350
2517
  destinations = [ifc_rel.RelatedElement]
2351
- if ifc_rel.is_a("IfcRelConnectsStructuralMember"):
2518
+ elif ifc_rel.is_a("IfcRelConnectsStructuralMember"):
2352
2519
  source = ifc_rel.RelatingStructuralMember
2353
2520
  destinations = [ifc_rel.RelatedStructuralConnection]
2354
- if ifc_rel.is_a("IfcRelContainedInSpatialStructure"):
2521
+ elif ifc_rel.is_a("IfcRelContainedInSpatialStructure"):
2355
2522
  source = ifc_rel.RelatingStructure
2356
2523
  destinations = ifc_rel.RelatedElements
2357
- if ifc_rel.is_a("IfcRelFillsElement"):
2524
+ elif ifc_rel.is_a("IfcRelFillsElement"):
2358
2525
  source = ifc_rel.RelatingOpeningElement
2359
2526
  destinations = [ifc_rel.RelatedBuildingElement]
2360
- if ifc_rel.is_a("IfcRelSpaceBoundary"):
2527
+ elif ifc_rel.is_a("IfcRelSpaceBoundary"):
2361
2528
  source = ifc_rel.RelatingSpace
2362
2529
  destinations = [ifc_rel.RelatedBuildingElement]
2363
- if ifc_rel.is_a("IfcRelVoidsElement"):
2530
+ elif ifc_rel.is_a("IfcRelVoidsElement"):
2364
2531
  source = ifc_rel.RelatingBuildingElement
2365
2532
  destinations = [ifc_rel.RelatedOpeningElement]
2533
+ elif ifc_rel.is_a("IfcRelDefinesByProperties") or ifc_rel.is_a("IfcRelAssociatesMaterial") or ifc_rel.is_a("IfcRelDefinesByType"):
2534
+ source = None
2535
+ destinations = None
2536
+ else:
2537
+ print("Graph.ByIFCFile - Warning: The relationship", ifc_rel, "is not supported. Skipping.")
2366
2538
  if source:
2367
- sv = vertexAtKeyValue(vertices, key="id", value=source.id())
2539
+ sv = vertexAtKeyValue(vertices, key="IFC_global_id", value=getattr(source, 'GlobalId', 0))
2368
2540
  if sv:
2369
2541
  si = Vertex.Index(sv, vertices, tolerance=tolerance)
2370
2542
  if not si == None:
2371
2543
  for destination in destinations:
2372
2544
  if destination == None:
2373
2545
  continue
2374
- ev = vertexAtKeyValue(vertices, key="id", value=destination.id())
2546
+ ev = vertexAtKeyValue(vertices, key="IFC_global_id", value=getattr(destination, 'GlobalId', 0),)
2375
2547
  if ev:
2376
2548
  ei = Vertex.Index(ev, vertices, tolerance=tolerance)
2377
2549
  if not ei == None:
2378
2550
  if not([si,ei] in tuples or [ei,si] in tuples):
2379
2551
  tuples.append([si,ei])
2380
2552
  e = Edge.ByVertices([sv,ev])
2381
- d = Dictionary.ByKeysValues(["id", "name", "type"], [ifc_rel.id(), ifc_rel.Name, ifc_rel.is_a()])
2553
+ d = Dictionary.ByKeysValues(["IFC_global_id", "IFC_name", "IFC_type"], [ifc_rel.id(), ifc_rel.Name, ifc_rel.is_a()])
2382
2554
  e = Topology.SetDictionary(e, d)
2383
2555
  edges.append(e)
2384
2556
  return edges
@@ -2399,7 +2571,7 @@ class Graph:
2399
2571
  return g
2400
2572
 
2401
2573
  @staticmethod
2402
- def ByIFCPath(path, includeTypes=[], excludeTypes=[], includeRels=[], excludeRels=[], xMin=-0.5, yMin=-0.5, zMin=-0.5, xMax=0.5, yMax=0.5, zMax=0.5):
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):
2403
2575
  """
2404
2576
  Create a Graph from an IFC path. This code is partially based on code from Bruno Postle.
2405
2577
 
@@ -2415,6 +2587,12 @@ class Graph:
2415
2587
  A list of IFC relationship types to include in the graph. The default is [] which means all relationship types are included.
2416
2588
  excludeRels : list , optional
2417
2589
  A list of IFC relationship types to exclude from the graph. The default is [] which mean no relationship type is excluded.
2590
+ transferDictionaries : bool , optional
2591
+ If set to True, the dictionaries from the IFC file will be transferred to the topology. Otherwise, they won't. The default is False.
2592
+ storeBREP : bool , optional
2593
+ If set to True, store the BRep of the subtopology in its representative vertex. The default is False.
2594
+ removeCoplanarFaces : bool , optional
2595
+ If set to True, coplanar faces are removed. Otherwise they are not. The default is False.
2418
2596
  xMin : float, optional
2419
2597
  The desired minimum value to assign for a vertex's X coordinate. The default is -0.5.
2420
2598
  yMin : float, optional
@@ -2463,7 +2641,15 @@ class Graph:
2463
2641
  if not ifc_file:
2464
2642
  print("Graph.ByIFCPath - Error: Could not open the IFC file. Returning None.")
2465
2643
  return None
2466
- return Graph.ByIFCFile(ifc_file, includeTypes=includeTypes, excludeTypes=excludeTypes, includeRels=includeRels, excludeRels=excludeRels, xMin=xMin, yMin=yMin, zMin=zMin, xMax=xMax, yMax=yMax, zMax=zMax)
2644
+ return Graph.ByIFCFile(ifc_file,
2645
+ includeTypes=includeTypes,
2646
+ excludeTypes=excludeTypes,
2647
+ includeRels=includeRels,
2648
+ excludeRels=excludeRels,
2649
+ transferDictionaries=transferDictionaries,
2650
+ storeBREP=storeBREP,
2651
+ removeCoplanarFaces=removeCoplanarFaces,
2652
+ xMin=xMin, yMin=yMin, zMin=zMin, xMax=xMax, yMax=yMax, zMax=zMax)
2467
2653
 
2468
2654
  @staticmethod
2469
2655
  def ByMeshData(vertices, edges, vertexDictionaries=None, edgeDictionaries=None, tolerance=0.0001):
@@ -2537,7 +2723,7 @@ class Graph:
2537
2723
  outpostsKey: str = "outposts",
2538
2724
  vertexCategoryKey: str = "category",
2539
2725
  edgeCategoryKey : str = "category",
2540
- useInternalVertex: bool =True,
2726
+ useInternalVertex: bool = False,
2541
2727
  storeBREP: bool =False,
2542
2728
  mantissa: int = 6,
2543
2729
  tolerance: float = 0.0001):
@@ -2613,17 +2799,14 @@ class Graph:
2613
2799
  eds = []
2614
2800
  for sharedTopology in sharedTops:
2615
2801
  if useInternalVertex == True:
2616
- vst = Topology.InternalVertex(sharedTopology, tolerance)
2802
+ vst = Topology.InternalVertex(sharedTopology, tolerance=tolerance)
2617
2803
  else:
2618
2804
  vst = Topology.CenterOfMass(sharedTopology)
2619
2805
  d1 = Topology.Dictionary(sharedTopology)
2620
2806
  d1 = Dictionary.SetValueAtKey(d1, vertexCategoryKey, 1) # shared topology
2621
2807
  if storeBREP:
2622
- d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(sharedTopology), Topology.Type(sharedTopology), Topology.TypeAsString(sharedTopology)])
2623
- d3 = mergeDictionaries2([d1, d2])
2624
- vst = Topology.SetDictionary(vst, d3, silent=True)
2625
- else:
2626
- vst = Topology.SetDictionary(vst, d1, silent=True)
2808
+ d1 = Dictionary.SetValuesAtKeys(d1, ["brep", "brepType", "brepTypeString"], [Topology.BREPString(sharedTopology), Topology.Type(sharedTopology), Topology.TypeAsString(sharedTopology)])
2809
+ vst = Topology.SetDictionary(vst, d1, silent=True)
2627
2810
  verts.append(vst)
2628
2811
  tempe = Edge.ByStartVertexEndVertex(vt, vst, tolerance=tolerance)
2629
2812
  tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["Via_Shared_Topologies", 1])
@@ -2636,18 +2819,15 @@ class Graph:
2636
2819
  eds = []
2637
2820
  for sharedAp in sharedAps:
2638
2821
  if useInternalVertex == True:
2639
- vsa = Topology.InternalVertex(sharedAp, tolerance)
2822
+ vsa = Topology.InternalVertex(sharedAp, tolerance=tolerance)
2640
2823
  else:
2641
2824
  vsa = Topology.CenterOfMass(sharedAp)
2642
2825
  d1 = Topology.Dictionary(sharedAp)
2643
2826
  d1 = Dictionary.SetValueAtKey(d1, vertexCategoryKey, 2) # shared aperture
2644
2827
  vsa = Vertex.ByCoordinates(Vertex.X(vsa, mantissa=mantissa)+(tolerance*100), Vertex.Y(vsa, mantissa=mantissa)+(tolerance*100), Vertex.Z(vsa, mantissa=mantissa)+(tolerance*100))
2645
2828
  if storeBREP:
2646
- d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(sharedAp), Topology.Type(sharedAp), Topology.TypeAsString(sharedAp)])
2647
- d3 = mergeDictionaries2([d1, d2])
2648
- vsa = Topology.SetDictionary(vsa, d3, silent=True)
2649
- else:
2650
- vsa = Topology.SetDictionary(vsa, d1, silent=True)
2829
+ d1 = Dictionary.SetValuesAtKeys(d1, ["brep", "brepType", "brepTypeString"], [Topology.BREPString(sharedAp), Topology.Type(sharedAp), Topology.TypeAsString(sharedAp)])
2830
+ vsa = Topology.SetDictionary(vsa, d1, silent=True)
2651
2831
  verts.append(vsa)
2652
2832
  tempe = Edge.ByStartVertexEndVertex(vt, vsa, tolerance=tolerance)
2653
2833
  tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["Via_Shared_Apertures", 2])
@@ -2658,20 +2838,16 @@ class Graph:
2658
2838
  def _toExteriorTopologies(vt, exteriorTops):
2659
2839
  verts = []
2660
2840
  eds = []
2661
- for exteriorTop in exteriorTops:
2841
+ for i, exteriorTop in enumerate(exteriorTops):
2662
2842
  if useInternalVertex == True:
2663
- vet = Topology.InternalVertex(exteriorTop, tolerance)
2843
+ vet = Topology.InternalVertex(exteriorTop, tolerance=tolerance)
2664
2844
  else:
2665
2845
  vet = Topology.CenterOfMass(exteriorTop)
2666
- vet = Topology.SetDictionary(vet, Topology.Dictionary(exteriorTop), silent=True)
2667
2846
  d1 = Topology.Dictionary(exteriorTop)
2668
2847
  d1 = Dictionary.SetValueAtKey(d1, vertexCategoryKey, 3) # exterior topology
2669
2848
  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)
2849
+ d1 = Dictionary.SetValuesAtKeys(d1, ["brep", "brepType", "brepTypeString"], [Topology.BREPString(exteriorTop), Topology.Type(exteriorTop), Topology.TypeAsString(exteriorTop)])
2850
+ vet = Topology.SetDictionary(vet, d1, silent=True)
2675
2851
  verts.append(vet)
2676
2852
  tempe = Edge.ByStartVertexEndVertex(vt, vet, tolerance=tolerance)
2677
2853
  tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Topologies", 3])
@@ -2684,18 +2860,15 @@ class Graph:
2684
2860
  eds = []
2685
2861
  for exAp in exteriorAps:
2686
2862
  if useInternalVertex == True:
2687
- vea = Topology.InternalVertex(exAp, tolerance)
2863
+ vea = Topology.InternalVertex(exAp, tolerance=tolerance)
2688
2864
  else:
2689
2865
  vea = Topology.CenterOfMass(exAp)
2690
2866
  d1 = Topology.Dictionary(exAp)
2691
2867
  d1 = Dictionary.SetValueAtKey(d1, vertexCategoryKey, 4) # exterior aperture
2692
2868
  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
2869
  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)
2870
+ d1 = Dictionary.SetValuesAtKeys(d1, ["brep", "brepType", "brepTypeString"], [Topology.BREPString(exAp), Topology.Type(exAp), Topology.TypeAsString(exAp)])
2871
+ vea = Topology.SetDictionary(vea, d1, silent=True)
2699
2872
  verts.append(vea)
2700
2873
  tempe = Edge.ByStartVertexEndVertex(vt, vea, tolerance=tolerance)
2701
2874
  tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Apertures", 4])
@@ -2710,18 +2883,15 @@ class Graph:
2710
2883
  if Topology.IsInstance(content, "Aperture"):
2711
2884
  content = Aperture.Topology(content)
2712
2885
  if useInternalVertex == True:
2713
- vct = Topology.InternalVertex(content, tolerance)
2886
+ vct = Topology.InternalVertex(content, tolerance=tolerance)
2714
2887
  else:
2715
2888
  vct = Topology.CenterOfMass(content)
2716
2889
  vct = Vertex.ByCoordinates(Vertex.X(vct, mantissa=mantissa)+(tolerance*100), Vertex.Y(vct, mantissa=mantissa)+(tolerance*100), Vertex.Z(vct, mantissa=mantissa)+(tolerance*100))
2717
2890
  d1 = Topology.Dictionary(content)
2718
2891
  d1 = Dictionary.SetValueAtKey(d1, vertexCategoryKey, 5) # content
2719
2892
  if storeBREP:
2720
- d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
2721
- d3 = mergeDictionaries2([d1, d2])
2722
- vct = Topology.SetDictionary(vct, d3, silent=True)
2723
- else:
2724
- vct = Topology.SetDictionary(vct, d1, silent=True)
2893
+ d1 = Dictionary.SetValuesAtKeys(d1, ["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
2894
+ vct = Topology.SetDictionary(vct, d1, silent=True)
2725
2895
  verts.append(vct)
2726
2896
  tempe = Edge.ByStartVertexEndVertex(vt, vct, tolerance=tolerance)
2727
2897
  tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
@@ -2755,11 +2925,8 @@ class Graph:
2755
2925
  d1 = Topology.Dictionary(vop)
2756
2926
  d1 = Dictionary.SetValueAtKey(d1, vertexCategoryKey, 6) # outpost
2757
2927
  if storeBREP:
2758
- d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(outpost), Topology.Type(outpost), Topology.TypeAsString(outpost)])
2759
- d3 = mergeDictionaries2([d1, d2])
2760
- vop = Topology.SetDictionary(vop, d3, silent=True)
2761
- else:
2762
- vop = Topology.SetDictionary(vop, d1, silent=True)
2928
+ d1 = Dictionary.SetValuesAtKeys(d1, ["brep", "brepType", "brepTypeString"], [Topology.BREPString(outpost), Topology.Type(outpost), Topology.TypeAsString(outpost)])
2929
+ vop = Topology.SetDictionary(vop, d1, silent=True)
2763
2930
  verts.append(vop)
2764
2931
  tempe = Edge.ByStartVertexEndVertex(vt, vop, tolerance=tolerance)
2765
2932
  tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Outposts", 6])
@@ -2883,11 +3050,8 @@ class Graph:
2883
3050
  d1 = Topology.Dictionary(cell)
2884
3051
  d1 = Dictionary.SetValueAtKey(d1, vertexCategoryKey, 0) # main topology
2885
3052
  if storeBREP:
2886
- d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(cell), Topology.Type(cell), Topology.TypeAsString(cell)])
2887
- d3 = mergeDictionaries2([d1, d2])
2888
- vCell = Topology.SetDictionary(vCell, d3, silent=True)
2889
- else:
2890
- vCell = Topology.SetDictionary(vCell, d1, silent=True)
3053
+ d1 = Dictionary.SetValuesAtKeys(d1, ["brep", "brepType", "brepTypeString"], [Topology.BREPString(cell), Topology.Type(cell), Topology.TypeAsString(cell)])
3054
+ vCell = Topology.SetDictionary(vCell, d1, silent=True)
2891
3055
  graph_vertices.append(vCell)
2892
3056
  if direct == True:
2893
3057
  cells = Topology.Cells(topology)
@@ -2999,7 +3163,7 @@ class Graph:
2999
3163
  graph_edges += eds
3000
3164
  for sharedTopology in sharedTopologies:
3001
3165
  if useInternalVertex == True:
3002
- vst = Topology.InternalVertex(sharedTopology, tolerance)
3166
+ vst = Topology.InternalVertex(sharedTopology, tolerance=tolerance)
3003
3167
  else:
3004
3168
  vst = Topology.CenterOfMass(sharedTopology)
3005
3169
  d = Topology.Dictionary(sharedTopology)
@@ -3014,7 +3178,7 @@ class Graph:
3014
3178
  graph_vertices += verts
3015
3179
  graph_edges += eds
3016
3180
  if viaSharedApertures:
3017
- verts, eds = _viaSharedTopologies(vCell, sharedApertures)
3181
+ verts, eds = _viaSharedApertures(vCell, sharedApertures)
3018
3182
  graph_vertices += verts
3019
3183
  graph_edges += eds
3020
3184
  if toExteriorTopologies:
@@ -3023,7 +3187,7 @@ class Graph:
3023
3187
  graph_edges += eds
3024
3188
  for exteriorTopology in exteriorTopologies:
3025
3189
  if useInternalVertex == True:
3026
- vet = Topology.InternalVertex(exteriorTopology, tolerance)
3190
+ vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
3027
3191
  else:
3028
3192
  vet = Topology.CenterOfMass(exteriorTopology)
3029
3193
  d = Topology.Dictionary(exteriorTopology)
@@ -3084,7 +3248,7 @@ class Graph:
3084
3248
  graph_edges += eds
3085
3249
  for exteriorTopology in exteriorTopologies:
3086
3250
  if useInternalVertex == True:
3087
- vet = Topology.InternalVertex(exteriorTopology, tolerance)
3251
+ vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
3088
3252
  else:
3089
3253
  vet = Topology.CenterOfMass(exteriorTopology)
3090
3254
  d = Topology.Dictionary(exteriorTopology)
@@ -3243,7 +3407,7 @@ class Graph:
3243
3407
  graph_edges += eds
3244
3408
  for sharedTopology in sharedTopologies:
3245
3409
  if useInternalVertex == True:
3246
- vst = Topology.InternalVertex(sharedTopology, tolerance)
3410
+ vst = Topology.InternalVertex(sharedTopology, tolerance=tolerance)
3247
3411
  else:
3248
3412
  vst = Topology.CenterOfMass(sharedTopology)
3249
3413
  d = Topology.Dictionary(sharedTopology)
@@ -3258,7 +3422,7 @@ class Graph:
3258
3422
  graph_vertices += verts
3259
3423
  graph_edges += eds
3260
3424
  if viaSharedApertures:
3261
- verts, eds = _viaSharedTopologies(vFace, sharedApertures)
3425
+ verts, eds = _viaSharedApertures(vFace, sharedApertures)
3262
3426
  graph_vertices += verts
3263
3427
  graph_edges += eds
3264
3428
  if toExteriorTopologies:
@@ -3267,7 +3431,7 @@ class Graph:
3267
3431
  graph_edges += eds
3268
3432
  for exteriorTopology in exteriorTopologies:
3269
3433
  if useInternalVertex == True:
3270
- vet = Topology.InternalVertex(exteriorTopology, tolerance)
3434
+ vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
3271
3435
  else:
3272
3436
  vet = Topology.CenterOfMass(exteriorTopology)
3273
3437
  d = Topology.Dictionary(exteriorTopology)
@@ -3328,7 +3492,7 @@ class Graph:
3328
3492
  graph_edges += eds
3329
3493
  for exteriorTopology in exteriorTopologies:
3330
3494
  if useInternalVertex == True:
3331
- vet = Topology.InternalVertex(exteriorTopology, tolerance)
3495
+ vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
3332
3496
  else:
3333
3497
  vet = Topology.CenterOfMass(exteriorTopology)
3334
3498
  d = Topology.Dictionary(exteriorTopology)
@@ -3489,7 +3653,7 @@ class Graph:
3489
3653
  graph_edges += eds
3490
3654
  for sharedTopology in sharedTopologies:
3491
3655
  if useInternalVertex == True:
3492
- vst = Topology.InternalVertex(sharedTopology, tolerance)
3656
+ vst = Topology.InternalVertex(sharedTopology, tolerance=tolerance)
3493
3657
  else:
3494
3658
  vst = Topology.CenterOfMass(sharedTopology)
3495
3659
  d = Topology.Dictionary(sharedTopology)
@@ -3504,16 +3668,16 @@ class Graph:
3504
3668
  graph_vertices += verts
3505
3669
  graph_edges += eds
3506
3670
  if viaSharedApertures:
3507
- verts, eds = _viaSharedTopologies(vCell, sharedApertures)
3671
+ verts, eds = _viaSharedApertures(vEdge, sharedApertures)
3508
3672
  graph_vertices += verts
3509
3673
  graph_edges += eds
3510
3674
  if toExteriorTopologies:
3511
- verts, eds = _toExteriorTopologies(vCell, exteriorTopologies)
3675
+ verts, eds = _toExteriorTopologies(vEdge, exteriorTopologies)
3512
3676
  graph_vertices += verts
3513
3677
  graph_edges += eds
3514
3678
  for exteriorTopology in exteriorTopologies:
3515
3679
  if useInternalVertex == True:
3516
- vet = Topology.InternalVertex(exteriorTopology, tolerance)
3680
+ vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
3517
3681
  else:
3518
3682
  vet = Topology.CenterOfMass(exteriorTopology)
3519
3683
  d = Topology.Dictionary(exteriorTopology)
@@ -3541,8 +3705,6 @@ class Graph:
3541
3705
  graph_edges += eds
3542
3706
  return [graph_vertices, graph_edges]
3543
3707
 
3544
-
3545
-
3546
3708
  def processEdge(item):
3547
3709
  topology, others, outpostsKey, idKey, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, toOutposts, useInternalVertex, storeBREP, tolerance = item
3548
3710
  graph_vertices = []
@@ -3576,7 +3738,7 @@ class Graph:
3576
3738
  graph_edges += eds
3577
3739
  for exteriorTopology in exteriorTopologies:
3578
3740
  if useInternalVertex == True:
3579
- vet = Topology.InternalVertex(exteriorTopology, tolerance)
3741
+ vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
3580
3742
  else:
3581
3743
  vet = Topology.CenterOfMass(exteriorTopology)
3582
3744
  d = Topology.Dictionary(exteriorTopology)
@@ -3604,7 +3766,6 @@ class Graph:
3604
3766
  graph_edges += eds
3605
3767
  return [graph_vertices, graph_edges]
3606
3768
 
3607
-
3608
3769
  def processVertex(item):
3609
3770
  topology, others, outpostsKey, idKey, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, toOutposts, useInternalVertex, storeBREP, tolerance = item
3610
3771
  vertices = [topology]
@@ -3616,7 +3777,7 @@ class Graph:
3616
3777
  if Topology.IsInstance(content, "Aperture"):
3617
3778
  content = Aperture.Topology(content)
3618
3779
  if useInternalVertex == True:
3619
- vst = Topology.InternalVertex(content, tolerance)
3780
+ vst = Topology.InternalVertex(content, tolerance=tolerance)
3620
3781
  else:
3621
3782
  vst = Topology.CenterOfMass(content)
3622
3783
  d1 = Topology.Dictionary(content)
@@ -3651,7 +3812,7 @@ class Graph:
3651
3812
  outposts = []
3652
3813
  for outpost in outposts:
3653
3814
  if useInternalVertex == True:
3654
- vop = Topology.InternalVertex(outpost, tolerance)
3815
+ vop = Topology.InternalVertex(outpost, tolerance=tolerance)
3655
3816
  else:
3656
3817
  vop = Topology.CenterOfMass(outpost)
3657
3818
  tempe = Edge.ByStartVertexEndVertex(topology, vop, tolerance=tolerance)
@@ -3661,7 +3822,6 @@ class Graph:
3661
3822
 
3662
3823
  return [vertices, edges]
3663
3824
 
3664
-
3665
3825
  if not Topology.IsInstance(topology, "Topology"):
3666
3826
  print("Graph.ByTopology - Error: The input topology is not a valid topology. Returning None.")
3667
3827
  return None
@@ -4071,7 +4231,7 @@ class Graph:
4071
4231
  if Topology.IsSame(va, vb):
4072
4232
  d = 0
4073
4233
  else:
4074
- d = Graph.TopologicalDistance(graph, va, vb, tolerance)
4234
+ d = Graph.TopologicalDistance(graph, va, vb, tolerance=tolerance)
4075
4235
  top_dist += d
4076
4236
  if top_dist == 0:
4077
4237
  print("Graph.ClosenessCentrality - Warning: Topological Distance is Zero.")
@@ -4086,7 +4246,7 @@ class Graph:
4086
4246
  if Topology.IsSame(va, vb):
4087
4247
  d = 0
4088
4248
  else:
4089
- d = Graph.TopologicalDistance(graph, va, vb, tolerance)
4249
+ d = Graph.TopologicalDistance(graph, va, vb, tolerance=tolerance)
4090
4250
  top_dist += d
4091
4251
  if top_dist == 0:
4092
4252
  scores.append(0)
@@ -4173,7 +4333,7 @@ class Graph:
4173
4333
  if not Topology.IsInstance(edge, "Edge"):
4174
4334
  print("Graph.ContainsEdge - Error: The input edge is not a valid edge. Returning None.")
4175
4335
  return None
4176
- return graph.ContainsEdge(edge, tolerance)
4336
+ return graph.ContainsEdge(edge, tolerance) # Hook to Core
4177
4337
 
4178
4338
  @staticmethod
4179
4339
  def ContainsVertex(graph, vertex, tolerance=0.0001):
@@ -4203,7 +4363,7 @@ class Graph:
4203
4363
  if not Topology.IsInstance(vertex, "Vertex"):
4204
4364
  print("Graph.ContainsVertex - Error: The input vertex is not a valid vertex. Returning None.")
4205
4365
  return None
4206
- return graph.ContainsVertex(vertex, tolerance)
4366
+ return graph.ContainsVertex(vertex, tolerance) # Hook to Core
4207
4367
 
4208
4368
 
4209
4369
  @staticmethod
@@ -4567,7 +4727,7 @@ class Graph:
4567
4727
  if not Topology.IsInstance(vertexB, "Vertex"):
4568
4728
  print("Graph.Edge - Error: The input vertexB is not a valid vertex. Returning None.")
4569
4729
  return None
4570
- return graph.Edge(vertexA, vertexB, tolerance)
4730
+ return graph.Edge(vertexA, vertexB, tolerance) # Hook to Core
4571
4731
 
4572
4732
  @staticmethod
4573
4733
  def Edges(graph, vertices=None, tolerance=0.0001):
@@ -8183,9 +8343,9 @@ class Graph:
8183
8343
  group = minVertexGroup
8184
8344
  if group > maxVertexGroup:
8185
8345
  group = maxVertexGroup
8186
- color = Color.RGBToHex(Color.ByValueInRange(group, minValue=minVertexGroup, maxValue=maxVertexGroup, colorScale=colorScale))
8346
+ color = Color.AnyToHex(Color.ByValueInRange(group, minValue=minVertexGroup, maxValue=maxVertexGroup, colorScale=colorScale))
8187
8347
  else:
8188
- color = Color.RGBToHex(Color.ByValueInRange(vertexGroups.index(group), minValue=minVertexGroup, maxValue=maxVertexGroup, colorScale=colorScale))
8348
+ color = Color.AnyToHex(Color.ByValueInRange(vertexGroups.index(group), minValue=minVertexGroup, maxValue=maxVertexGroup, colorScale=colorScale))
8189
8349
  colors.append(color)
8190
8350
  except:
8191
8351
  colors.append(vertexColor)
@@ -8474,28 +8634,32 @@ class Graph:
8474
8634
  return shortestPaths
8475
8635
 
8476
8636
  @staticmethod
8477
- def Show(graph,
8637
+ def Show(*graphs,
8478
8638
  sagitta = 0,
8479
8639
  absolute = False,
8480
8640
  sides = 8,
8481
8641
  angle = 0,
8482
8642
  vertexColor="black",
8483
8643
  vertexColorKey=None,
8484
- vertexSize=6,
8644
+ vertexSize=10,
8485
8645
  vertexSizeKey=None,
8486
8646
  vertexLabelKey=None,
8487
8647
  vertexGroupKey=None,
8488
8648
  vertexGroups=[],
8649
+ vertexMinGroup=None,
8650
+ vertexMaxGroup=None,
8489
8651
  showVertices=True,
8490
8652
  showVertexLabel=False,
8491
8653
  showVertexLegend=False,
8492
- edgeColor="black",
8654
+ edgeColor="red",
8493
8655
  edgeColorKey=None,
8494
8656
  edgeWidth=1,
8495
8657
  edgeWidthKey=None,
8496
8658
  edgeLabelKey=None,
8497
8659
  edgeGroupKey=None,
8498
8660
  edgeGroups=[],
8661
+ edgeMinGroup=None,
8662
+ edgeMaxGroup=None,
8499
8663
  showEdges=True,
8500
8664
  showEdgeLabel=False,
8501
8665
  showEdgeLegend=False,
@@ -8522,8 +8686,8 @@ class Graph:
8522
8686
 
8523
8687
  Parameters
8524
8688
  ----------
8525
- graph : topologic_core.Graph
8526
- The input graph.
8689
+ *graphs : topologic_core.Graph
8690
+ One or more toplogic_core.graph objects.
8527
8691
  sagitta : float , optional
8528
8692
  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
8693
  absolute : bool , optional
@@ -8553,6 +8717,10 @@ class Graph:
8553
8717
  The dictionary key to use to display the vertex group. The default is None.
8554
8718
  vertexGroups : list , optional
8555
8719
  The list of vertex groups against which to index the color of the vertex. The default is [].
8720
+ vertexMinGroup : int or float , optional
8721
+ 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.
8722
+ vertexMaxGroup : int or float , optional
8723
+ 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
8724
  showVertices : bool , optional
8557
8725
  If set to True the vertices will be drawn. Otherwise, they will not be drawn. The default is True.
8558
8726
  showVertexLabel : bool , optional
@@ -8579,6 +8747,10 @@ class Graph:
8579
8747
  The dictionary key to use to display the edge group. The default is None.
8580
8748
  edgeGroups : list , optional
8581
8749
  The list of edge groups against which to index the color of the edge. The default is [].
8750
+ edgeMinGroup : int or float , optional
8751
+ 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.
8752
+ edgeMaxGroup : int or float , optional
8753
+ 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
8754
  showEdges : bool , optional
8583
8755
  If set to True the edges will be drawn. Otherwise, they will not be drawn. The default is True.
8584
8756
  showEdgeLabel : bool , optional
@@ -8637,12 +8809,49 @@ class Graph:
8637
8809
  """
8638
8810
  from topologicpy.Plotly import Plotly
8639
8811
  from topologicpy.Topology import Topology
8812
+ from topologicpy.Helper import Helper
8640
8813
 
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)
8814
+ if isinstance(graphs, tuple):
8815
+ graphs = Helper.Flatten(list(graphs))
8816
+ if isinstance(graphs, list):
8817
+ new_graphs = [t for t in graphs if Topology.IsInstance(t, "Graph")]
8818
+ if len(new_graphs) == 0:
8819
+ if not silent:
8820
+ print("Topology.Show - Error: the input topologies parameter does not contain any valid topology. Returning None.")
8821
+ return None
8822
+ data = []
8823
+ for graph in new_graphs:
8824
+ data += Plotly.DataByGraph(graph,
8825
+ sagitta=sagitta,
8826
+ absolute=absolute,
8827
+ sides=sides,
8828
+ angle=angle,
8829
+ vertexColor=vertexColor,
8830
+ vertexColorKey=vertexColorKey,
8831
+ vertexSize=vertexSize,
8832
+ vertexSizeKey=vertexSizeKey,
8833
+ vertexLabelKey=vertexLabelKey,
8834
+ vertexGroupKey=vertexGroupKey,
8835
+ vertexGroups=vertexGroups,
8836
+ vertexMinGroup=vertexMinGroup,
8837
+ vertexMaxGroup=vertexMaxGroup,
8838
+ showVertices=showVertices,
8839
+ showVertexLabel=showVertexLabel,
8840
+ showVertexLegend=showVertexLegend,
8841
+ edgeColor=edgeColor,
8842
+ edgeColorKey=edgeColorKey,
8843
+ edgeWidth=edgeWidth,
8844
+ edgeWidthKey=edgeWidthKey,
8845
+ edgeLabelKey=edgeLabelKey,
8846
+ edgeGroupKey=edgeGroupKey,
8847
+ edgeGroups=edgeGroups,
8848
+ edgeMinGroup=edgeMinGroup,
8849
+ edgeMaxGroup=edgeMaxGroup,
8850
+ showEdges=showEdges,
8851
+ showEdgeLabel=showEdgeLabel,
8852
+ showEdgeLegend=showEdgeLegend,
8853
+ colorScale=colorScale,
8854
+ silent=silent)
8646
8855
  fig = Plotly.FigureByData(data, width=width, height=height, xAxis=xAxis, yAxis=yAxis, zAxis=zAxis, axisSize=axisSize, backgroundColor=backgroundColor,
8647
8856
  marginLeft=marginLeft, marginRight=marginRight, marginTop=marginTop, marginBottom=marginBottom, tolerance=tolerance)
8648
8857
  Plotly.Show(fig, renderer=renderer, camera=camera, center=center, up=up, projection=projection)
@@ -8703,7 +8912,7 @@ class Graph:
8703
8912
  if not Topology.IsInstance(vertexB, "Vertex"):
8704
8913
  print("Graph.TopologicalDistance - Error: The input vertexB is not a valid vertex. Returning None.")
8705
8914
  return None
8706
- return graph.TopologicalDistance(vertexA, vertexB, tolerance)
8915
+ return graph.TopologicalDistance(vertexA, vertexB, tolerance) # Hook to Core
8707
8916
 
8708
8917
  @staticmethod
8709
8918
  def Topology(graph):
@@ -8781,7 +8990,7 @@ class Graph:
8781
8990
  if not vertexInList(vertex, vertices):
8782
8991
  vertices.append(vertex)
8783
8992
  if parent:
8784
- edge = Graph.Edge(graph, parent, vertex, tolerance)
8993
+ edge = Graph.Edge(graph, parent, vertex, tolerance=tolerance)
8785
8994
  ev = Edge.EndVertex(edge)
8786
8995
  if Vertex.Distance(parent, ev) < tolerance:
8787
8996
  edge = Edge.Reverse(edge)
@@ -8792,7 +9001,7 @@ class Graph:
8792
9001
  dictionary['vertices'] = vertices
8793
9002
  dictionary['edges'] = edges
8794
9003
  for child in children:
8795
- dictionary = buildTree(graph, dictionary, child, vertex, tolerance)
9004
+ dictionary = buildTree(graph, dictionary, child, vertex, tolerance=tolerance)
8796
9005
  return dictionary
8797
9006
 
8798
9007
  if not Topology.IsInstance(graph, "Graph"):
@@ -8803,7 +9012,7 @@ class Graph:
8803
9012
  else:
8804
9013
  vertex = Graph.NearestVertex(graph, vertex)
8805
9014
  dictionary = {'vertices':[], 'edges':[]}
8806
- dictionary = buildTree(graph, dictionary, vertex, None, tolerance)
9015
+ dictionary = buildTree(graph, dictionary, vertex, None, tolerance=tolerance)
8807
9016
  return Graph.ByVerticesEdges(dictionary['vertices'], dictionary['edges'])
8808
9017
 
8809
9018
  @staticmethod