Add pset to elements or types

Hi All,
What is the correct way to add a new pset to an ifc model?
I want all my ifc entities of type IfcBuildingElementProxy to have a pset called TypeData_Spec with 3 properties. Each entity will then have different property values.
Do I need to create a pset for each entity or can I create one pset with these 3 properties and then assign a value for each element?

model = ifcopenshell.open(r'TPZ_Zone.ifc')
trees = model.by_type("IfcBuildingElementProxy")
for t in trees:
    pset = ifcopenshell.api.run("pset.add_pset", model, product=t, name="TypeData_Spec")    
    treeId = t.Name.split('-')[0]
    treeIndex = id.index(treeId)
    ifcopenshell.api.run("pset.edit_pset", model, pset=pset, properties={"Tree Status": treeStatus[treeIndex], 
                                                                         "Tree Height": height[treeIndex],
                                                                         "Tree Name" : name[treeIndex]
                                                                         })
model.write(newFile)  

This code will create 3 IFCPROPERTYSET. Can't I just have one IFCPROPERTYSET with different IFCPROPERTYSINGLEVALUE in it?

Thank you
Giovanni

Tagged:

Comments

  • What you've done is correct. No, you cannot have one property set, since they have different properties.

    If you have types of trees, you can assign the property once to the type, and it is inherited by all occurrences. This might apply to the tree height or name. It's probably not necessary to store the eastings or northings as you can have that directly in the object placement of the tree.

    GiovanniB
  • Thank you Dion.

Sign In or Register to comment.