Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import blenderbim.tool as tool
- import multiprocessing
- import ifcopenshell
- import ifcopenshell.geom
- ifc_file = tool.Ifc.get()
- elements = ifc_file.by_type("IfcWall")
- settings = ifcopenshell.geom.settings()
- settings.set(settings.DISABLE_OPENING_SUBTRACTIONS, True)
- iterator = ifcopenshell.geom.iterator(settings, ifc_file, multiprocessing.cpu_count(), include=elements)
- if iterator.initialize():
- while True:
- shape = iterator.get()
- matrix = shape.transformation.matrix.data
- faces = shape.geometry.faces
- edges = shape.geometry.edges
- verts = shape.geometry.verts
- materials = shape.geometry.materials
- material_ids = shape.geometry.material_ids
- element = ifc_file.by_id(shape.id)
- qto = ifcopenshell.util.element.get_pset(element, "Qto_WallBaseQuantities")
- if qto:
- qto = ifc_file.by_id(qto["id"])
- else:
- qto = ifcopenshell.api.run("pset.add_qto", ifc_file, product=element, name="Qto_WallBaseQuantities")
- volume = ifcopenshell.util.shape.get_volume(shape.geometry)
- ifcopenshell.api.run("pset.edit_qto", ifc_file, qto=qto, properties={"GrossVolume": volume})
- # ... write code to process geometry here ...
- if not iterator.next():
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement