topologicpy 0.7.85__py3-none-any.whl → 0.7.87__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/Color.py CHANGED
@@ -483,6 +483,9 @@ class Color:
483
483
  print("Color.RGBToHex - Error: The input rgb parameter is not a valid list. Returning None.")
484
484
  return None
485
485
  r, g, b = rgb
486
+ r = int(r)
487
+ g = int(g)
488
+ b = int(b)
486
489
  hex_value = "#{:02x}{:02x}{:02x}".format(r, g, b)
487
490
  return hex_value.upper()
488
491
 
topologicpy/Graph.py CHANGED
@@ -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):
@@ -2619,11 +2805,8 @@ class Graph:
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])
@@ -2643,11 +2826,8 @@ class Graph:
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])
@@ -2710,11 +2890,8 @@ class Graph:
2710
2890
  d1 = Topology.Dictionary(content)
2711
2891
  d1 = Dictionary.SetValueAtKey(d1, vertexCategoryKey, 5) # content
2712
2892
  if storeBREP:
2713
- d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
2714
- d3 = mergeDictionaries2([d1, d2])
2715
- vct = Topology.SetDictionary(vct, d3, silent=True)
2716
- else:
2717
- 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)
2718
2895
  verts.append(vct)
2719
2896
  tempe = Edge.ByStartVertexEndVertex(vt, vct, tolerance=tolerance)
2720
2897
  tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
@@ -2748,11 +2925,8 @@ class Graph:
2748
2925
  d1 = Topology.Dictionary(vop)
2749
2926
  d1 = Dictionary.SetValueAtKey(d1, vertexCategoryKey, 6) # outpost
2750
2927
  if storeBREP:
2751
- d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(outpost), Topology.Type(outpost), Topology.TypeAsString(outpost)])
2752
- d3 = mergeDictionaries2([d1, d2])
2753
- vop = Topology.SetDictionary(vop, d3, silent=True)
2754
- else:
2755
- 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)
2756
2930
  verts.append(vop)
2757
2931
  tempe = Edge.ByStartVertexEndVertex(vt, vop, tolerance=tolerance)
2758
2932
  tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Outposts", 6])
@@ -2876,11 +3050,8 @@ class Graph:
2876
3050
  d1 = Topology.Dictionary(cell)
2877
3051
  d1 = Dictionary.SetValueAtKey(d1, vertexCategoryKey, 0) # main topology
2878
3052
  if storeBREP:
2879
- d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(cell), Topology.Type(cell), Topology.TypeAsString(cell)])
2880
- d3 = mergeDictionaries2([d1, d2])
2881
- vCell = Topology.SetDictionary(vCell, d3, silent=True)
2882
- else:
2883
- 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)
2884
3055
  graph_vertices.append(vCell)
2885
3056
  if direct == True:
2886
3057
  cells = Topology.Cells(topology)
@@ -3007,7 +3178,7 @@ class Graph:
3007
3178
  graph_vertices += verts
3008
3179
  graph_edges += eds
3009
3180
  if viaSharedApertures:
3010
- verts, eds = _viaSharedTopologies(vCell, sharedApertures)
3181
+ verts, eds = _viaSharedApertures(vCell, sharedApertures)
3011
3182
  graph_vertices += verts
3012
3183
  graph_edges += eds
3013
3184
  if toExteriorTopologies:
@@ -3251,7 +3422,7 @@ class Graph:
3251
3422
  graph_vertices += verts
3252
3423
  graph_edges += eds
3253
3424
  if viaSharedApertures:
3254
- verts, eds = _viaSharedTopologies(vFace, sharedApertures)
3425
+ verts, eds = _viaSharedApertures(vFace, sharedApertures)
3255
3426
  graph_vertices += verts
3256
3427
  graph_edges += eds
3257
3428
  if toExteriorTopologies:
@@ -3497,11 +3668,11 @@ class Graph:
3497
3668
  graph_vertices += verts
3498
3669
  graph_edges += eds
3499
3670
  if viaSharedApertures:
3500
- verts, eds = _viaSharedTopologies(vCell, sharedApertures)
3671
+ verts, eds = _viaSharedApertures(vEdge, sharedApertures)
3501
3672
  graph_vertices += verts
3502
3673
  graph_edges += eds
3503
3674
  if toExteriorTopologies:
3504
- verts, eds = _toExteriorTopologies(vCell, exteriorTopologies)
3675
+ verts, eds = _toExteriorTopologies(vEdge, exteriorTopologies)
3505
3676
  graph_vertices += verts
3506
3677
  graph_edges += eds
3507
3678
  for exteriorTopology in exteriorTopologies:
@@ -3534,8 +3705,6 @@ class Graph:
3534
3705
  graph_edges += eds
3535
3706
  return [graph_vertices, graph_edges]
3536
3707
 
3537
-
3538
-
3539
3708
  def processEdge(item):
3540
3709
  topology, others, outpostsKey, idKey, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, toOutposts, useInternalVertex, storeBREP, tolerance = item
3541
3710
  graph_vertices = []
@@ -3597,7 +3766,6 @@ class Graph:
3597
3766
  graph_edges += eds
3598
3767
  return [graph_vertices, graph_edges]
3599
3768
 
3600
-
3601
3769
  def processVertex(item):
3602
3770
  topology, others, outpostsKey, idKey, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, toOutposts, useInternalVertex, storeBREP, tolerance = item
3603
3771
  vertices = [topology]
@@ -3654,7 +3822,6 @@ class Graph:
3654
3822
 
3655
3823
  return [vertices, edges]
3656
3824
 
3657
-
3658
3825
  if not Topology.IsInstance(topology, "Topology"):
3659
3826
  print("Graph.ByTopology - Error: The input topology is not a valid topology. Returning None.")
3660
3827
  return None
@@ -8176,9 +8343,9 @@ class Graph:
8176
8343
  group = minVertexGroup
8177
8344
  if group > maxVertexGroup:
8178
8345
  group = maxVertexGroup
8179
- 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))
8180
8347
  else:
8181
- 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))
8182
8349
  colors.append(color)
8183
8350
  except:
8184
8351
  colors.append(vertexColor)
@@ -8474,7 +8641,7 @@ class Graph:
8474
8641
  angle = 0,
8475
8642
  vertexColor="black",
8476
8643
  vertexColorKey=None,
8477
- vertexSize=6,
8644
+ vertexSize=10,
8478
8645
  vertexSizeKey=None,
8479
8646
  vertexLabelKey=None,
8480
8647
  vertexGroupKey=None,
@@ -8484,7 +8651,7 @@ class Graph:
8484
8651
  showVertices=True,
8485
8652
  showVertexLabel=False,
8486
8653
  showVertexLegend=False,
8487
- edgeColor="black",
8654
+ edgeColor="red",
8488
8655
  edgeColorKey=None,
8489
8656
  edgeWidth=1,
8490
8657
  edgeWidthKey=None,
topologicpy/Plotly.py CHANGED
@@ -279,7 +279,7 @@ class Plotly:
279
279
  angle: float = 0,
280
280
  vertexColor: str = "black",
281
281
  vertexColorKey: str = None,
282
- vertexSize: float = 6,
282
+ vertexSize: float = 10,
283
283
  vertexSizeKey: str = None,
284
284
  vertexLabelKey: str = None,
285
285
  vertexGroupKey: str = None,
@@ -292,7 +292,7 @@ class Plotly:
292
292
  vertexLegendLabel="Graph Vertices",
293
293
  vertexLegendRank=4,
294
294
  vertexLegendGroup=4,
295
- edgeColor: str = "black",
295
+ edgeColor: str = "red",
296
296
  edgeColorKey: str = None,
297
297
  edgeWidth: float = 1,
298
298
  edgeWidthKey: str = None,
@@ -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
@@ -7923,39 +7923,86 @@ class Topology():
7923
7923
 
7924
7924
  @staticmethod
7925
7925
  def Show(*topologies,
7926
+ nameKey = "name",
7926
7927
  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="black", 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,
7928
+ showVertices=True,
7929
+ vertexSize=None,
7930
+ vertexSizeKey = None,
7931
+ vertexColor="black",
7932
+ vertexColorKey = None,
7933
+ vertexLabelKey=None,
7934
+ showVertexLabel= False,
7935
+ vertexGroupKey=None,
7936
+ vertexGroups=[],
7937
+ vertexMinGroup=None,
7938
+ vertexMaxGroup=None,
7939
+ showVertexLegend=False,
7940
+ vertexLegendLabel="Vertices",
7941
+
7942
+ showEdges=True,
7943
+ edgeWidth=None,
7944
+ edgeWidthKey = None,
7945
+ edgeColor=None,
7946
+ edgeColorKey = None,
7947
+ edgeLabelKey=None,
7948
+ showEdgeLabel = False,
7949
+ edgeGroupKey=None,
7950
+ edgeGroups=[],
7951
+ edgeMinGroup=None,
7952
+ edgeMaxGroup=None,
7953
+ showEdgeLegend=False,
7954
+ edgeLegendLabel="Edges",
7955
+
7956
+ showFaces=True,
7957
+ faceOpacity=0.5,
7958
+ faceOpacityKey=None,
7959
+ faceColor="#FAFAFA",
7960
+ faceColorKey = None,
7961
+ faceLabelKey=None,
7962
+ faceGroupKey=None,
7963
+ faceGroups=[],
7964
+ faceMinGroup=None,
7965
+ faceMaxGroup=None,
7966
+ showFaceLegend=False,
7967
+ faceLegendLabel="Faces",
7946
7968
  intensityKey=None,
7947
7969
  intensities=[],
7948
7970
 
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,
7971
+ width=950,
7972
+ height=500,
7973
+ xAxis=False,
7974
+ yAxis=False,
7975
+ zAxis=False,
7976
+ axisSize=1,
7977
+ backgroundColor='rgba(0,0,0,0)',
7978
+ marginLeft=0,
7979
+ marginRight=0,
7980
+ marginTop=20,
7981
+ marginBottom=0,
7982
+ camera=[-1.25, -1.25, 1.25],
7983
+ center=[0, 0, 0],
7984
+ up=[0, 0, 1],
7985
+ projection="perspective",
7986
+ renderer="notebook",
7987
+ showScale=False,
7953
7988
 
7954
- cbValues=[], cbTicks=5, cbX=-0.15, cbWidth=15, cbOutlineWidth=0, cbTitle="",
7955
- cbSubTitle="", cbUnits="", colorScale="Viridis",
7989
+ cbValues=[],
7990
+ cbTicks=5,
7991
+ cbX=-0.15,
7992
+ cbWidth=15,
7993
+ cbOutlineWidth=0,
7994
+ cbTitle="",
7995
+ cbSubTitle="",
7996
+ cbUnits="",
7997
+ colorScale="Viridis",
7956
7998
 
7957
- sagitta = 0, absolute = False, sides = 8, angle = 0,
7958
- mantissa=6, tolerance=0.0001, silent=False):
7999
+ sagitta = 0,
8000
+ absolute = False,
8001
+ sides = 8,
8002
+ angle = 0,
8003
+ mantissa=6,
8004
+ tolerance=0.0001,
8005
+ silent=False):
7959
8006
  """
7960
8007
  Shows the input topology on screen.
7961
8008
 
@@ -7997,10 +8044,6 @@ class Topology():
7997
8044
  If set to True, the legend for the vertices of this topology is shown. Otherwise, it isn't. The default is False.
7998
8045
  vertexLegendLabel : str , optional
7999
8046
  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
8047
 
8005
8048
  showEdges : bool , optional
8006
8049
  If set to True the edges will be drawn. Otherwise, they will not be drawn. The default is True.
@@ -8034,10 +8077,6 @@ class Topology():
8034
8077
  If set to True, the legend for the edges of this topology is shown. Otherwise, it isn't. The default is False.
8035
8078
  edgeLegendLabel : str , optional
8036
8079
  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
8080
 
8042
8081
  showFaces : bool , optional
8043
8082
  If set to True the faces will be drawn. Otherwise, they will not be drawn. The default is True.
@@ -8069,10 +8108,6 @@ class Topology():
8069
8108
  If set to True, the legend for the faces of this topology is shown. Otherwise, it isn't. The default is False.
8070
8109
  faceLegendLabel : str , optional
8071
8110
  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
8111
  width : int , optional
8077
8112
  The width in pixels of the figure. The default value is 950.
8078
8113
  height : int , optional
@@ -8149,8 +8184,6 @@ class Topology():
8149
8184
  from topologicpy.Dictionary import Dictionary
8150
8185
  from topologicpy.Plotly import Plotly
8151
8186
  from topologicpy.Helper import Helper
8152
- from topologicpy.Graph import Graph
8153
- from topologicpy.Color import Color
8154
8187
 
8155
8188
  if isinstance(topologies, tuple):
8156
8189
  topologies = Helper.Flatten(list(topologies))
@@ -8164,16 +8197,33 @@ class Topology():
8164
8197
  if camera[0] == 0 and camera[1] == 0 and up == [0,0,1]:
8165
8198
  up = [0,1,0] #default to positive Y axis being up if looking down or up at the XY plane
8166
8199
  data = []
8167
- for topology in new_topologies:
8200
+ topology_counter = 0
8201
+ offset = 1
8202
+ if showEdges == True:
8203
+ offset += 1
8204
+ if showFaces == True:
8205
+ offset +=2
8206
+ temp_graphs = [g for g in new_topologies if Topology.IsInstance(g, "Graph")]
8207
+ graph_counter = len(new_topologies)*offset - len(temp_graphs)*offset
8208
+ for i, topology in enumerate(new_topologies):
8209
+ d = Topology.Dictionary(topology)
8168
8210
  if Topology.IsInstance(topology, "Graph"):
8211
+ name = Dictionary.ValueAtKey(d, nameKey) or "Untitled Graph"
8169
8212
  if vertexSize == None:
8170
- vSize = 6
8213
+ vSize = 10
8171
8214
  else:
8172
8215
  vSize = vertexSize
8173
8216
  if edgeWidth == None:
8174
8217
  eWidth = 1
8175
8218
  else:
8176
8219
  eWidth = edgeWidth
8220
+ if edgeColor == None:
8221
+ eColor = "red"
8222
+ else:
8223
+ eColor = edgeColor
8224
+ vll = name+" ("+vertexLegendLabel+")"
8225
+ ell = name+" ("+edgeLegendLabel+")"
8226
+
8177
8227
  data += Plotly.DataByGraph(topology,
8178
8228
  sagitta=sagitta,
8179
8229
  absolute=absolute,
@@ -8191,7 +8241,10 @@ class Topology():
8191
8241
  showVertices=showVertices,
8192
8242
  showVertexLabel=showVertexLabel,
8193
8243
  showVertexLegend=showVertexLegend,
8194
- edgeColor=edgeColor,
8244
+ vertexLegendLabel= str(i+1)+": "+vll,
8245
+ vertexLegendRank= (graph_counter+1),
8246
+ vertexLegendGroup= (graph_counter+1),
8247
+ edgeColor=eColor,
8195
8248
  edgeColorKey=edgeColorKey,
8196
8249
  edgeWidth=eWidth,
8197
8250
  edgeWidthKey=edgeWidthKey,
@@ -8203,9 +8256,14 @@ class Topology():
8203
8256
  showEdges=showEdges,
8204
8257
  showEdgeLabel=showEdgeLabel,
8205
8258
  showEdgeLegend=showEdgeLegend,
8259
+ edgeLegendLabel = str(i+1)+": "+ell,
8260
+ edgeLegendRank= (graph_counter+2),
8261
+ edgeLegendGroup=(graph_counter+2),
8206
8262
  colorScale=colorScale,
8207
8263
  silent=silent)
8264
+ graph_counter += offset
8208
8265
  else:
8266
+ name = Dictionary.ValueAtKey(d, nameKey) or "Untitled"
8209
8267
  if vertexSize == None:
8210
8268
  vSize = 1.1
8211
8269
  else:
@@ -8214,26 +8272,63 @@ class Topology():
8214
8272
  eWidth = 1
8215
8273
  else:
8216
8274
  eWidth = edgeWidth
8217
- d = Topology.Dictionary(topology)
8275
+ if edgeColor == None:
8276
+ eColor = "black"
8277
+ else:
8278
+ eColor = edgeColor
8218
8279
  if not d == None:
8219
8280
  faceOpacity = Dictionary.ValueAtKey(d, opacityKey) or faceOpacity
8220
8281
  data += Plotly.DataByTopology(topology=topology,
8221
- showVertices=showVertices, vertexSize=vSize, vertexSizeKey=vertexSizeKey, vertexColor=vertexColor, vertexColorKey=vertexColorKey,
8222
- vertexLabelKey=vertexLabelKey, showVertexLabel=showVertexLabel, vertexGroupKey=vertexGroupKey, vertexGroups=vertexGroups,
8223
- vertexMinGroup=vertexMinGroup, vertexMaxGroup=vertexMaxGroup,
8224
- showVertexLegend=showVertexLegend, vertexLegendLabel=vertexLegendLabel, vertexLegendRank=vertexLegendRank,
8225
- vertexLegendGroup=vertexLegendGroup,
8226
- showEdges=showEdges, edgeWidth=eWidth, edgeWidthKey=edgeWidthKey, edgeColor=edgeColor, edgeColorKey=edgeColorKey,
8227
- edgeLabelKey=edgeLabelKey, showEdgeLabel=showEdgeLabel, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups,
8228
- edgeMinGroup=edgeMinGroup, edgeMaxGroup=edgeMaxGroup,
8229
- showEdgeLegend=showEdgeLegend, edgeLegendLabel=edgeLegendLabel, edgeLegendRank=edgeLegendRank,
8230
- edgeLegendGroup=edgeLegendGroup,
8231
- showFaces=showFaces, faceOpacity=faceOpacity, faceColor=faceColor, faceColorKey=faceColorKey,
8232
- faceLabelKey=faceLabelKey, faceGroupKey=faceGroupKey, faceGroups=faceGroups,
8233
- faceMinGroup=faceMinGroup, faceMaxGroup=faceMaxGroup,
8234
- showFaceLegend=showFaceLegend, faceLegendLabel=faceLegendLabel, faceLegendRank=faceLegendRank,
8235
- faceLegendGroup=faceLegendGroup,
8236
- intensityKey=intensityKey, intensities=intensities, colorScale=colorScale, mantissa=mantissa, tolerance=tolerance)
8282
+ showVertices=showVertices,
8283
+ vertexSize=vSize,
8284
+ vertexSizeKey=vertexSizeKey,
8285
+ vertexColor=vertexColor,
8286
+ vertexColorKey=vertexColorKey,
8287
+ vertexLabelKey=vertexLabelKey,
8288
+ showVertexLabel=showVertexLabel,
8289
+ vertexGroupKey=vertexGroupKey,
8290
+ vertexGroups=vertexGroups,
8291
+ vertexMinGroup=vertexMinGroup,
8292
+ vertexMaxGroup=vertexMaxGroup,
8293
+ showVertexLegend=showVertexLegend,
8294
+ vertexLegendLabel=str(i+1)+": "+name+" ("+vertexLegendLabel+")",
8295
+ vertexLegendRank=topology_counter+1,
8296
+ vertexLegendGroup=topology_counter+1,
8297
+ showEdges=showEdges,
8298
+ edgeWidth=eWidth,
8299
+ edgeWidthKey=edgeWidthKey,
8300
+ edgeColor=eColor,
8301
+ edgeColorKey=edgeColorKey,
8302
+ edgeLabelKey=edgeLabelKey,
8303
+ showEdgeLabel=showEdgeLabel,
8304
+ edgeGroupKey=edgeGroupKey,
8305
+ edgeGroups=edgeGroups,
8306
+ edgeMinGroup=edgeMinGroup,
8307
+ edgeMaxGroup=edgeMaxGroup,
8308
+ showEdgeLegend=showEdgeLegend,
8309
+ edgeLegendLabel=str(i+1)+": "+name+" ("+edgeLegendLabel+")",
8310
+ edgeLegendRank=topology_counter+2,
8311
+ edgeLegendGroup=topology_counter+2,
8312
+ showFaces=showFaces,
8313
+ faceOpacity=faceOpacity,
8314
+ faceOpacityKey=faceOpacityKey,
8315
+ faceColor=faceColor,
8316
+ faceColorKey=faceColorKey,
8317
+ faceLabelKey=faceLabelKey,
8318
+ faceGroupKey=faceGroupKey,
8319
+ faceGroups=faceGroups,
8320
+ faceMinGroup=faceMinGroup,
8321
+ faceMaxGroup=faceMaxGroup,
8322
+ showFaceLegend=showFaceLegend,
8323
+ faceLegendLabel=str(i+1)+": "+name+" ("+faceLegendLabel+")",
8324
+ faceLegendRank=topology_counter+3,
8325
+ faceLegendGroup=topology_counter+3,
8326
+ intensityKey=intensityKey,
8327
+ intensities=intensities,
8328
+ colorScale=colorScale,
8329
+ mantissa=mantissa,
8330
+ tolerance=tolerance)
8331
+ topology_counter += offset
8237
8332
  figure = Plotly.FigureByData(data=data, width=width, height=height,
8238
8333
  xAxis=xAxis, yAxis=yAxis, zAxis=zAxis, axisSize=axisSize,
8239
8334
  backgroundColor=backgroundColor,
@@ -9389,7 +9484,7 @@ class Topology():
9389
9484
  return topology.Type()
9390
9485
 
9391
9486
  @staticmethod
9392
- def TypeAsString(topology):
9487
+ def TypeAsString(topology, silent=False):
9393
9488
  """
9394
9489
  Returns the type of the input topology as a string.
9395
9490
 
@@ -9397,6 +9492,8 @@ class Topology():
9397
9492
  ----------
9398
9493
  topology : topologic_core.Topology
9399
9494
  The input topology.
9495
+ silent : bool , optional
9496
+ If set to True, no warnings or errors will be printed. The default is False.
9400
9497
 
9401
9498
  Returns
9402
9499
  -------
@@ -9404,10 +9501,13 @@ class Topology():
9404
9501
  The type of the topology as a string.
9405
9502
 
9406
9503
  """
9407
- if not Topology.IsInstance(topology, "Topology"):
9408
- print("Topology.TypeAsString - Error: The input topology parameter is not a valid topology. Returning None.")
9409
- return None
9410
- return topology.GetTypeAsString()
9504
+ if Topology.IsInstance(topology, "Graph"):
9505
+ return "Graph"
9506
+ elif Topology.IsInstance(topology, "Topology"):
9507
+ return topology.GetTypeAsString() # Hook to Core
9508
+ if not silent:
9509
+ print("Topology.TypeAsString - Error: The input topology parameter is not a valid topology or graph. Returning None.")
9510
+ return None
9411
9511
 
9412
9512
  @staticmethod
9413
9513
  def TypeID(name : str = None) -> int:
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.7.85'
1
+ __version__ = '0.7.87'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.85
3
+ Version: 0.7.87
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
@@ -4,33 +4,33 @@ topologicpy/BVH.py,sha256=mKVCAu9K8qzcWXtPDVH5usXZV1DNNNJl4n3rU5Lh1ZM,12931
4
4
  topologicpy/Cell.py,sha256=nVJEFgj6nnHDNUYIlMf1NS2xiufDMj18szKGqf9HwDM,108090
5
5
  topologicpy/CellComplex.py,sha256=ncjfvJ2QJzz4Fu8BMaQBLxAQ6WHx6HfUCddaLP8kXsc,51480
6
6
  topologicpy/Cluster.py,sha256=__PvNVjRnFfy12aawd7HSrb3UBX3Rtd1iWSSQnPGpfk,55768
7
- topologicpy/Color.py,sha256=wPhA7rLr9BTZsWYUUVnQpbmL5ZMkGlDSsa8f3S5B-d4,20250
7
+ topologicpy/Color.py,sha256=q9xsGmxFMz7sQKmygwSVS12GaTRB-OT0-_i6t3-cthE,20307
8
8
  topologicpy/Context.py,sha256=ppApYKngZZCQBFWaxIMi2z2dokY23c935IDCBosxDAE,3055
9
9
  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
13
  topologicpy/Face.py,sha256=qiQmvCRFHO248VMqPxcE4Jrrw2JvNIJDdWHMopCPWGQ,142173
14
- topologicpy/Graph.py,sha256=6MBhPWrUNdahojjXeGRVijB8XOEyoIEvR8HH_t2eDCc,419867
14
+ topologicpy/Graph.py,sha256=YKVo3ePAesJL4pt8GBekzPhujGeTc2XbErnzqEOZITQ,431147
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=z1eiHo_Mcdp9yOYyGDv66Jn-em4USDbAK8XwjgFCkBA,113754
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=vQiMoXf6tDFwgfDKDzMx0I8nsMY4GWQ4HNq4MnXwg8U,438126
26
+ topologicpy/Topology.py,sha256=E683mKTwx4a1p1l6vN5KWFqX9gVJwV78S12EdtkfQjM,441297
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=0Z4Msc5ULmAdPGdoztKcgRR0Ng7inqSPxMZwQPC2cYE,23
32
- topologicpy-0.7.85.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
33
- topologicpy-0.7.85.dist-info/METADATA,sha256=fFxkcP9zSNFaIGgI0GgzB2HSF6b8_UaDgULmguzdf3Q,10513
34
- topologicpy-0.7.85.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
35
- topologicpy-0.7.85.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
- topologicpy-0.7.85.dist-info/RECORD,,
31
+ topologicpy/version.py,sha256=9To1hhHw5YQrfDyVdFvuKgwM_UIfjviXKudPl9B2kdE,23
32
+ topologicpy-0.7.87.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
33
+ topologicpy-0.7.87.dist-info/METADATA,sha256=UWltJr_9E-eV2trZxj7ZsvXZlVD8GHtBWdIxgUvn6zM,10513
34
+ topologicpy-0.7.87.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
35
+ topologicpy-0.7.87.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
+ topologicpy-0.7.87.dist-info/RECORD,,