topologicpy 0.8.4__py3-none-any.whl → 0.8.7__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
@@ -2624,6 +2624,10 @@ class Graph:
2624
2624
  # Store relevant information
2625
2625
  if transferDictionaries == True:
2626
2626
  color, transparency, material_list = get_color_transparency_material(ifc_object)
2627
+ if color == None:
2628
+ color = "white"
2629
+ if transparency == None:
2630
+ transparency = 0
2627
2631
  entity_dict = {
2628
2632
  "TOPOLOGIC_id": str(Topology.UUID(centroid)),
2629
2633
  "TOPOLOGIC_name": getattr(ifc_object, 'Name', "Untitled"),
@@ -2645,19 +2649,22 @@ class Graph:
2645
2649
  if hasattr(ifc_object, "Representation") and ifc_object.Representation:
2646
2650
  for rep in ifc_object.Representation.Representations:
2647
2651
  if rep.is_a("IfcShapeRepresentation"):
2648
- # Generate the geometry for this entity
2649
- shape = ifcopenshell.geom.create_shape(settings, ifc_object)
2650
- # Get grouped vertices and grouped faces
2651
- grouped_verts = shape.geometry.verts
2652
- verts = [ [grouped_verts[i], grouped_verts[i + 1], grouped_verts[i + 2]] for i in range(0, len(grouped_verts), 3)]
2653
- grouped_edges = shape.geometry.edges
2654
- edges = [[grouped_edges[i], grouped_edges[i + 1]] for i in range(0, len(grouped_edges), 2)]
2655
- grouped_faces = shape.geometry.faces
2656
- faces = [ [grouped_faces[i], grouped_faces[i + 1], grouped_faces[i + 2]] for i in range(0, len(grouped_faces), 3)]
2657
- shape_topology = Topology.ByGeometry(verts, edges, faces, silent=True)
2658
- if not shape_topology == None:
2659
- if removeCoplanarFaces == True:
2660
- shape_topology = Topology.RemoveCoplanarFaces(shape_topology, epsilon=0.0001)
2652
+ try:
2653
+ # Generate the geometry for this entity
2654
+ shape = ifcopenshell.geom.create_shape(settings, ifc_object)
2655
+ # Get grouped vertices and grouped faces
2656
+ grouped_verts = shape.geometry.verts
2657
+ verts = [ [grouped_verts[i], grouped_verts[i + 1], grouped_verts[i + 2]] for i in range(0, len(grouped_verts), 3)]
2658
+ grouped_edges = shape.geometry.edges
2659
+ edges = [[grouped_edges[i], grouped_edges[i + 1]] for i in range(0, len(grouped_edges), 2)]
2660
+ grouped_faces = shape.geometry.faces
2661
+ faces = [ [grouped_faces[i], grouped_faces[i + 1], grouped_faces[i + 2]] for i in range(0, len(grouped_faces), 3)]
2662
+ shape_topology = Topology.ByGeometry(verts, edges, faces, silent=True)
2663
+ if not shape_topology == None:
2664
+ if removeCoplanarFaces == True:
2665
+ shape_topology = Topology.RemoveCoplanarFaces(shape_topology, epsilon=0.0001)
2666
+ except:
2667
+ pass
2661
2668
  if not shape_topology == None and storeBREP:
2662
2669
  topology_dict = Dictionary.SetValuesAtKeys(topology_dict, ["brep", "brepType", "brepTypeString"], [Topology.BREPString(shape_topology), Topology.Type(shape_topology), Topology.TypeAsString(shape_topology)])
2663
2670
  if not shape_topology == None and useInternalVertex == True:
topologicpy/Topology.py CHANGED
@@ -2515,50 +2515,55 @@ class Topology():
2515
2515
  def convert_to_topology(entity, settings, transferDictionaries=False):
2516
2516
  if hasattr(entity, "Representation") and entity.Representation:
2517
2517
  for rep in entity.Representation.Representations:
2518
+ shape_topology = None
2518
2519
  if rep.is_a("IfcShapeRepresentation"):
2519
2520
  # Generate the geometry for this entity
2520
- shape = ifcopenshell.geom.create_shape(settings, entity)
2521
2521
  try:
2522
+ shape = ifcopenshell.geom.create_shape(settings, entity)
2522
2523
  trans = shape.transformation
2523
2524
  # Convert into a 4x4 matrix
2524
2525
  matrix = [trans.matrix[i:i+4] for i in range(0, len(trans.matrix), 4)]
2526
+ # Get grouped vertices and grouped faces
2527
+ grouped_verts = shape.geometry.verts
2528
+ verts = [ [grouped_verts[i], grouped_verts[i + 1], grouped_verts[i + 2]] for i in range(0, len(grouped_verts), 3)]
2529
+ grouped_edges = shape.geometry.edges
2530
+ edges = [[grouped_edges[i], grouped_edges[i + 1]] for i in range(0, len(grouped_edges), 2)]
2531
+ grouped_faces = shape.geometry.faces
2532
+ faces = [ [grouped_faces[i], grouped_faces[i + 1], grouped_faces[i + 2]] for i in range(0, len(grouped_faces), 3)]
2533
+ #shape_topology = ifc_to_topologic_geometry(verts, edges, faces)
2534
+ #shape_topology = Topology.SelfMerge(Topology.ByGeometry(verts, edges, faces))
2535
+ shape_topology = Topology.ByGeometry(verts, edges, faces, silent=True)
2536
+ if not shape_topology == None:
2537
+ if removeCoplanarFaces == True:
2538
+ shape_topology = Topology.RemoveCoplanarFaces(shape_topology, epsilon=0.0001)
2539
+ shape_topology = Topology.Transform(shape_topology, matrix)
2540
+
2541
+ # Store relevant information
2542
+ if transferDictionaries == True:
2543
+ color, transparency, material_list = get_color_transparency_material(entity)
2544
+ if color == None:
2545
+ color = "white"
2546
+ if transparency == None:
2547
+ transparency = 0
2548
+ entity_dict = {
2549
+ "TOPOLOGIC_id": str(Topology.UUID(shape_topology)),
2550
+ "TOPOLOGIC_name": getattr(entity, 'Name', "Untitled"),
2551
+ "TOPOLOGIC_type": Topology.TypeAsString(shape_topology),
2552
+ "TOPOLOGIC_color": color,
2553
+ "TOPOLOGIC_opacity": 1.0 - transparency,
2554
+ "IFC_global_id": getattr(entity, 'GlobalId', 0),
2555
+ "IFC_name": getattr(entity, 'Name', "Untitled"),
2556
+ "IFC_type": entity.is_a(),
2557
+ "IFC_material_list": material_list,
2558
+ }
2559
+ topology_dict = Dictionary.ByPythonDictionary(entity_dict)
2560
+ # Get PSETs dictionary
2561
+ pset_python_dict = get_psets(entity)
2562
+ pset_dict = Dictionary.ByPythonDictionary(pset_python_dict)
2563
+ topology_dict = Dictionary.ByMergedDictionaries([topology_dict, pset_dict])
2564
+ shape_topology = Topology.SetDictionary(shape_topology, topology_dict)
2525
2565
  except:
2526
2566
  pass
2527
- # Get grouped vertices and grouped faces
2528
- grouped_verts = shape.geometry.verts
2529
- verts = [ [grouped_verts[i], grouped_verts[i + 1], grouped_verts[i + 2]] for i in range(0, len(grouped_verts), 3)]
2530
- grouped_edges = shape.geometry.edges
2531
- edges = [[grouped_edges[i], grouped_edges[i + 1]] for i in range(0, len(grouped_edges), 2)]
2532
- grouped_faces = shape.geometry.faces
2533
- faces = [ [grouped_faces[i], grouped_faces[i + 1], grouped_faces[i + 2]] for i in range(0, len(grouped_faces), 3)]
2534
- #shape_topology = ifc_to_topologic_geometry(verts, edges, faces)
2535
- #shape_topology = Topology.SelfMerge(Topology.ByGeometry(verts, edges, faces))
2536
- shape_topology = Topology.ByGeometry(verts, edges, faces, silent=True)
2537
- if not shape_topology == None:
2538
- if removeCoplanarFaces == True:
2539
- shape_topology = Topology.RemoveCoplanarFaces(shape_topology, epsilon=0.0001)
2540
- shape_topology = Topology.Transform(shape_topology, matrix)
2541
-
2542
- # Store relevant information
2543
- if transferDictionaries == True:
2544
- color, transparency, material_list = get_color_transparency_material(entity)
2545
- entity_dict = {
2546
- "TOPOLOGIC_id": str(Topology.UUID(shape_topology)),
2547
- "TOPOLOGIC_name": getattr(entity, 'Name', "Untitled"),
2548
- "TOPOLOGIC_type": Topology.TypeAsString(shape_topology),
2549
- "TOPOLOGIC_color": color,
2550
- "TOPOLOGIC_opacity": 1.0 - transparency,
2551
- "IFC_global_id": getattr(entity, 'GlobalId', 0),
2552
- "IFC_name": getattr(entity, 'Name', "Untitled"),
2553
- "IFC_type": entity.is_a(),
2554
- "IFC_material_list": material_list,
2555
- }
2556
- topology_dict = Dictionary.ByPythonDictionary(entity_dict)
2557
- # Get PSETs dictionary
2558
- pset_python_dict = get_psets(entity)
2559
- pset_dict = Dictionary.ByPythonDictionary(pset_python_dict)
2560
- topology_dict = Dictionary.ByMergedDictionaries([topology_dict, pset_dict])
2561
- shape_topology = Topology.SetDictionary(shape_topology, topology_dict)
2562
2567
  return shape_topology
2563
2568
  return None
2564
2569
 
@@ -4195,8 +4200,10 @@ class Topology():
4195
4200
  if normalize == False:
4196
4201
  scale_factor = 1.0
4197
4202
  else:
4198
- edges = Topology.Edges(translated_top)
4199
- max_edge_length = max([Edge.Length(edge, mantissa=mantissa) for edge in edges])
4203
+ #edges = Topology.Edges(translated_top)
4204
+ #max_edge_length = max([Edge.Length(edge, mantissa=mantissa) for edge in edges])
4205
+ longest_edges = Topology.LongestEdges(translated_top, removeCoplanarFaces=True)
4206
+ max_edge_length = Edge.Length(longest_edges[0])
4200
4207
  scale_factor = 1.0 / max_edge_length if max_edge_length != 0 else 1.0
4201
4208
  scaling_matrix = Matrix.ByScaling(scaleX=scale_factor, scaleY=scale_factor, scaleZ=scale_factor)
4202
4209
  scaled_top = Topology.Scale(translated_top, origin=Vertex.Origin(), x=scale_factor, y=scale_factor, z=scale_factor)
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.8.4'
1
+ __version__ = '0.8.7'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: topologicpy
3
- Version: 0.8.4
3
+ Version: 0.8.7
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
@@ -11,7 +11,7 @@ topologicpy/Dictionary.py,sha256=t0O7Du-iPq46FyKqZfcjHfsUK1E8GS_e67R2V5cpkbw,331
11
11
  topologicpy/Edge.py,sha256=lWwJdQkAhiH5POB7TN6HSLv03g2jXHzBU7e2fE3eAno,71340
12
12
  topologicpy/EnergyModel.py,sha256=UoQ9Jm-hYsN383CbcLKw-y6BKitRHj0uyh84yQ-8ACg,53856
13
13
  topologicpy/Face.py,sha256=D1g4O5i5QMPZvIoX06Z-FsyNsYBDkCiHWJp00uqnr5o,180742
14
- topologicpy/Graph.py,sha256=T_NC-Gvf7F7DWdfWvQB7sQ_v790lTT74SLKTl-UhSZE,492072
14
+ topologicpy/Graph.py,sha256=rq7QGgb2eTJucFT6YeQujs1zoZg-KHMvHOWPjG1btG4,492418
15
15
  topologicpy/Grid.py,sha256=2s9cSlWldivn1i9EUz4OOokJyANveqmRe_vR93CAndI,18245
16
16
  topologicpy/Helper.py,sha256=DAAE_Ie_ekeMnCvcW08xXRwSAGCkjrS4lbz-o3ELuY4,27172
17
17
  topologicpy/Honeybee.py,sha256=Y_El6M8x3ixvvIe_VcRiwj_4C89ZZg5_WlT7adbCkpw,21849
@@ -23,14 +23,14 @@ topologicpy/PyG.py,sha256=LU9LCCzjxGPUM31qbaJXZsTvniTtgugxJY7y612t4A4,109757
23
23
  topologicpy/Shell.py,sha256=fLRnQ79vtdBDRW1Xn8Gaap34XheGbw7UBFd-ALJ2Y1g,87978
24
24
  topologicpy/Speckle.py,sha256=AlsGlSDuKRtX5jhVsPNSSjjbZis079HbUchDH_5RJmE,18187
25
25
  topologicpy/Sun.py,sha256=42tDWMYpwRG7Z2Qjtp94eRgBuqySq7k8TgNUZDK7QxQ,36837
26
- topologicpy/Topology.py,sha256=IHLJxh0TQ7P8Git4qfFDlvas81JXaKQGjxwgBzIX1T0,463367
26
+ topologicpy/Topology.py,sha256=qw64d3Ct6u7W8Fy_-JIg3_xsyOzDIQ1hdnpxF2p_wH4,463931
27
27
  topologicpy/Vector.py,sha256=Cl7besf20cAGmyNPh-9gbFAHnRU5ZWSMChJ3VyFIDs4,35416
28
28
  topologicpy/Vertex.py,sha256=tv6C-rbuNgXHDGgVLT5fbalynLdXqlUuiCDKtkeQ0vk,77814
29
29
  topologicpy/Wire.py,sha256=Gl3Jpygwp8775SG57ua5r5ffTHcN4FOAkeI87yP1cok,234001
30
30
  topologicpy/__init__.py,sha256=vlPCanUbxe5NifC4pHcnhSzkmmYcs_UrZrTlVMsxcFs,928
31
- topologicpy/version.py,sha256=PtH7P3DXedvpK4LWSSxCTW38cmEXvmG6EvUpXZC-eLo,22
32
- topologicpy-0.8.4.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
33
- topologicpy-0.8.4.dist-info/METADATA,sha256=WsO5JswYFeodLDlAb5Jv9TnaIhSl0z2ge2fhH-3hLpw,10512
34
- topologicpy-0.8.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
35
- topologicpy-0.8.4.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
- topologicpy-0.8.4.dist-info/RECORD,,
31
+ topologicpy/version.py,sha256=JGCf_Ym2Ht0sZ3u8dNB1-xTLbDj-N0D-i99vGQQMfWs,22
32
+ topologicpy-0.8.7.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
33
+ topologicpy-0.8.7.dist-info/METADATA,sha256=uDBR73QF2TnGhpaMNI-vIBGeZTF-c7IMM5DI7AxwzEI,10512
34
+ topologicpy-0.8.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
35
+ topologicpy-0.8.7.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
+ topologicpy-0.8.7.dist-info/RECORD,,