B
by BalThorsGate on 17 Dec 2022, edited 19 Dec 2022
#
Hello fellow nerds.
I am fairly new to python and ifcopenshell.
And i wonder, is it possible to get to an element based on what sone it relates to?
Like a bathroom connected to a wall and then a hallway on the other side.
As long as the geometry is cut accordingly i should work, right?
And if it does, perhaps someone could point me in the direction of an answer?
Thank you :)
Thor
A
by Ace on 19 Dec 2022
#
I think topologic does what you are asking for,
T
by theoryshaw on 19 Dec 2022, edited 19 Dec 2022
#
+2 votes
I'm also a newbie, but something like the following might work.
I also attached a blenderbim/ifc file, if you'd like to play around with it as well.
import bpy
import ifcopenshell
from blenderbim.bim.ifc import IfcStore
Ifc = ifcopenshell.open(IfcStore.path)
first_zone = Ifc.by_type("IfcZone")[0]
listofwalls = []
first_zone_is_groupedby = first_zone.IsGroupedBy
for group in first_zone_is_groupedby:
spatialobjects = group.RelatedObjects
for spatialobject in spatialobjects:
spatialstructures = spatialobject.ContainsElements
for spatialstructure in spatialstructures:
elements = spatialstructure.RelatedElements
for element in elements:
if element.is_a("IfcWall"):
listofwalls.append(element)
for entity in listofwalls:
wallname = "IfcWall/" + entity.Name
obj = bpy.data.objects[wallname]
obj.select_set(True)