Advertisement
Guest User

Untitled

a guest
Jan 17th, 2024
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. import blenderbim.tool as tool
  2. import multiprocessing
  3. import ifcopenshell
  4. import ifcopenshell.geom
  5.  
  6. ifc_file = tool.Ifc.get()
  7. elements = ifc_file.by_type("IfcWall")
  8.  
  9. settings = ifcopenshell.geom.settings()
  10. settings.set(settings.DISABLE_OPENING_SUBTRACTIONS, True)
  11. iterator = ifcopenshell.geom.iterator(settings, ifc_file, multiprocessing.cpu_count(), include=elements)
  12. if iterator.initialize():
  13.     while True:
  14.         shape = iterator.get()
  15.         matrix = shape.transformation.matrix.data
  16.         faces = shape.geometry.faces
  17.         edges = shape.geometry.edges
  18.         verts = shape.geometry.verts
  19.         materials = shape.geometry.materials
  20.         material_ids = shape.geometry.material_ids
  21.        
  22.         element = ifc_file.by_id(shape.id)
  23.         qto = ifcopenshell.util.element.get_pset(element, "Qto_WallBaseQuantities")
  24.         if qto:
  25.             qto = ifc_file.by_id(qto["id"])
  26.         else:
  27.             qto = ifcopenshell.api.run("pset.add_qto", ifc_file, product=element, name="Qto_WallBaseQuantities")
  28.         volume = ifcopenshell.util.shape.get_volume(shape.geometry)
  29.         ifcopenshell.api.run("pset.edit_qto", ifc_file, qto=qto, properties={"GrossVolume": volume})
  30.        
  31.         # ... write code to process geometry here ...
  32.         if not iterator.next():
  33.             break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement