IfcOpenShell - get psets from model object rather than element?

Maybe a very simple question - but is there a way to get property sets from the 'model object' rather than querying elements in the model directly?
At the moment I know ifcopenshell.util.element.get_psets / get_pset - which takes an element as its argument.
Basically I would like to be able to generate a list of every property variant in a model. Imagine I want to know all the FireRating property values from the Pset_WallCommon property set.
I guess I could iterate through every element in the model and return its value for this property, but is there an easier way?

Comments

  • Sure:

    values = set()
    for pset in ifc_file.by_type('IfcPropertySet'):
        if pset.Name != "Pset_WallCommon":
            continue
        for prop in pset.HasProperties:
            if prop.Name == "FireRating":
                values.add(prop.NominalValue.wrappedValue)
    

    I guess this is a oneliner:

    values = set()
    [[values.add(p.NominalValue) for p in ps.HasProperties if p.Name == "FireRating"] for ps in ifc_file.by_type('IfcPropertySet') if ps.Name == "Pset_WallCommon"]
    

    (untested)

    steverugiOwura_quCSNArv
Sign In or Register to comment.