topologicpy 0.7.85__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/Color.py +3 -0
- topologicpy/Graph.py +221 -54
- topologicpy/Plotly.py +2 -2
- topologicpy/Topology.py +12 -4
- topologicpy/version.py +1 -1
- {topologicpy-0.7.85.dist-info → topologicpy-0.7.86.dist-info}/METADATA +1 -1
- {topologicpy-0.7.85.dist-info → topologicpy-0.7.86.dist-info}/RECORD +10 -10
- {topologicpy-0.7.85.dist-info → topologicpy-0.7.86.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.85.dist-info → topologicpy-0.7.86.dist-info}/WHEEL +0 -0
- {topologicpy-0.7.85.dist-info → topologicpy-0.7.86.dist-info}/top_level.txt +0 -0
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
|
-
|
2322
|
-
|
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
|
-
|
2503
|
+
elif ifc_rel.is_a("IfcRelConnectsPortToElement"):
|
2337
2504
|
source = ifc_rel.RelatingPort
|
2338
2505
|
destinations = [ifc_rel.RelatedElement]
|
2339
|
-
|
2506
|
+
elif ifc_rel.is_a("IfcRelAggregates"):
|
2340
2507
|
source = ifc_rel.RelatingObject
|
2341
2508
|
destinations = ifc_rel.RelatedObjects
|
2342
|
-
|
2509
|
+
elif ifc_rel.is_a("IfcRelNests"):
|
2343
2510
|
source = ifc_rel.RelatingObject
|
2344
2511
|
destinations = ifc_rel.RelatedObjects
|
2345
|
-
|
2512
|
+
elif ifc_rel.is_a("IfcRelAssignsToGroup"):
|
2346
2513
|
source = ifc_rel.RelatingGroup
|
2347
2514
|
destinations = ifc_rel.RelatedObjects
|
2348
|
-
|
2515
|
+
elif ifc_rel.is_a("IfcRelConnectsPathElements"):
|
2349
2516
|
source = ifc_rel.RelatingElement
|
2350
2517
|
destinations = [ifc_rel.RelatedElement]
|
2351
|
-
|
2518
|
+
elif ifc_rel.is_a("IfcRelConnectsStructuralMember"):
|
2352
2519
|
source = ifc_rel.RelatingStructuralMember
|
2353
2520
|
destinations = [ifc_rel.RelatedStructuralConnection]
|
2354
|
-
|
2521
|
+
elif ifc_rel.is_a("IfcRelContainedInSpatialStructure"):
|
2355
2522
|
source = ifc_rel.RelatingStructure
|
2356
2523
|
destinations = ifc_rel.RelatedElements
|
2357
|
-
|
2524
|
+
elif ifc_rel.is_a("IfcRelFillsElement"):
|
2358
2525
|
source = ifc_rel.RelatingOpeningElement
|
2359
2526
|
destinations = [ifc_rel.RelatedBuildingElement]
|
2360
|
-
|
2527
|
+
elif ifc_rel.is_a("IfcRelSpaceBoundary"):
|
2361
2528
|
source = ifc_rel.RelatingSpace
|
2362
2529
|
destinations = [ifc_rel.RelatedBuildingElement]
|
2363
|
-
|
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="
|
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="
|
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(["
|
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,
|
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
|
-
|
2623
|
-
|
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
|
-
|
2647
|
-
|
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
|
-
|
2714
|
-
|
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
|
-
|
2752
|
-
|
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
|
-
|
2880
|
-
|
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 =
|
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 =
|
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 =
|
3671
|
+
verts, eds = _viaSharedApertures(vEdge, sharedApertures)
|
3501
3672
|
graph_vertices += verts
|
3502
3673
|
graph_edges += eds
|
3503
3674
|
if toExteriorTopologies:
|
3504
|
-
verts, eds = _toExteriorTopologies(
|
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.
|
8346
|
+
color = Color.AnyToHex(Color.ByValueInRange(group, minValue=minVertexGroup, maxValue=maxVertexGroup, colorScale=colorScale))
|
8180
8347
|
else:
|
8181
|
-
color = Color.
|
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=
|
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="
|
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 =
|
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 = "
|
295
|
+
edgeColor: str = "red",
|
296
296
|
edgeColorKey: str = None,
|
297
297
|
edgeWidth: float = 1,
|
298
298
|
edgeWidthKey: str = None,
|
topologicpy/Topology.py
CHANGED
@@ -7931,7 +7931,7 @@ class Topology():
|
|
7931
7931
|
showVertexLegend=False, vertexLegendLabel="Topology Vertices", vertexLegendRank=1,
|
7932
7932
|
vertexLegendGroup=1,
|
7933
7933
|
|
7934
|
-
showEdges=True, edgeWidth=None, edgeWidthKey = None, edgeColor=
|
7934
|
+
showEdges=True, edgeWidth=None, edgeWidthKey = None, edgeColor=None, edgeColorKey = None,
|
7935
7935
|
edgeLabelKey=None, showEdgeLabel = False,
|
7936
7936
|
edgeGroupKey=None, edgeGroups=[],
|
7937
7937
|
edgeMinGroup=None, edgeMaxGroup=None,
|
@@ -8167,13 +8167,17 @@ class Topology():
|
|
8167
8167
|
for topology in new_topologies:
|
8168
8168
|
if Topology.IsInstance(topology, "Graph"):
|
8169
8169
|
if vertexSize == None:
|
8170
|
-
vSize =
|
8170
|
+
vSize = 10
|
8171
8171
|
else:
|
8172
8172
|
vSize = vertexSize
|
8173
8173
|
if edgeWidth == None:
|
8174
8174
|
eWidth = 1
|
8175
8175
|
else:
|
8176
8176
|
eWidth = edgeWidth
|
8177
|
+
if edgeColor == None:
|
8178
|
+
eColor = "red"
|
8179
|
+
else:
|
8180
|
+
eColor = edgeColor
|
8177
8181
|
data += Plotly.DataByGraph(topology,
|
8178
8182
|
sagitta=sagitta,
|
8179
8183
|
absolute=absolute,
|
@@ -8191,7 +8195,7 @@ class Topology():
|
|
8191
8195
|
showVertices=showVertices,
|
8192
8196
|
showVertexLabel=showVertexLabel,
|
8193
8197
|
showVertexLegend=showVertexLegend,
|
8194
|
-
edgeColor=
|
8198
|
+
edgeColor=eColor,
|
8195
8199
|
edgeColorKey=edgeColorKey,
|
8196
8200
|
edgeWidth=eWidth,
|
8197
8201
|
edgeWidthKey=edgeWidthKey,
|
@@ -8214,6 +8218,10 @@ class Topology():
|
|
8214
8218
|
eWidth = 1
|
8215
8219
|
else:
|
8216
8220
|
eWidth = edgeWidth
|
8221
|
+
if edgeColor == None:
|
8222
|
+
eColor = "black"
|
8223
|
+
else:
|
8224
|
+
eColor = edgeColor
|
8217
8225
|
d = Topology.Dictionary(topology)
|
8218
8226
|
if not d == None:
|
8219
8227
|
faceOpacity = Dictionary.ValueAtKey(d, opacityKey) or faceOpacity
|
@@ -8223,7 +8231,7 @@ class Topology():
|
|
8223
8231
|
vertexMinGroup=vertexMinGroup, vertexMaxGroup=vertexMaxGroup,
|
8224
8232
|
showVertexLegend=showVertexLegend, vertexLegendLabel=vertexLegendLabel, vertexLegendRank=vertexLegendRank,
|
8225
8233
|
vertexLegendGroup=vertexLegendGroup,
|
8226
|
-
showEdges=showEdges, edgeWidth=eWidth, edgeWidthKey=edgeWidthKey, edgeColor=
|
8234
|
+
showEdges=showEdges, edgeWidth=eWidth, edgeWidthKey=edgeWidthKey, edgeColor=eColor, edgeColorKey=edgeColorKey,
|
8227
8235
|
edgeLabelKey=edgeLabelKey, showEdgeLabel=showEdgeLabel, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups,
|
8228
8236
|
edgeMinGroup=edgeMinGroup, edgeMaxGroup=edgeMaxGroup,
|
8229
8237
|
showEdgeLegend=showEdgeLegend, edgeLegendLabel=edgeLegendLabel, edgeLegendRank=edgeLegendRank,
|
topologicpy/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.7.
|
1
|
+
__version__ = '0.7.86'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: topologicpy
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.86
|
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=
|
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=
|
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=
|
20
|
+
topologicpy/Plotly.py,sha256=RqGTQM_EUskQdp27Fbu-KY07ErKxaC0PCksLokB8c9s,113753
|
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=
|
26
|
+
topologicpy/Topology.py,sha256=OUm83_hemDabm1gLIRGmfR190RCb-GadMm5BDBb69vE,438388
|
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=
|
32
|
-
topologicpy-0.7.
|
33
|
-
topologicpy-0.7.
|
34
|
-
topologicpy-0.7.
|
35
|
-
topologicpy-0.7.
|
36
|
-
topologicpy-0.7.
|
31
|
+
topologicpy/version.py,sha256=onIpJHxNjXWvum-_t59rYALX7MwOFPIcP-4a76gL8N4,23
|
32
|
+
topologicpy-0.7.86.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
|
33
|
+
topologicpy-0.7.86.dist-info/METADATA,sha256=evBDpufZw7KwLIkkWzkrLDnt5zwYmE_xz0AwHloe4g0,10513
|
34
|
+
topologicpy-0.7.86.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
35
|
+
topologicpy-0.7.86.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
|
36
|
+
topologicpy-0.7.86.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|