OSArch Community

Inherit Psets and Qtos of a user defined type for a given element

  1. S

    Hi 👋,

    In ìfcopenshell 0.8.0, my goal is to instantiate an IfcWall using a custom IfcWallType in order to inherit all Psets and Qtos that I defined on the IfcWallType:

    
    my_wall_type = ifcopenshell.api.root.create_entity(
    
        model,
    
        ifc_class="IfcWallType",
    
        name="Custom_Wall_Type",
    
    )
    
    # add some Psets to my_wall_type...
    
    my_wall = ifcopenshell.api.root.create_entity(
    
        model,
    
        ifc_class="IfcWall",
    
        predefined_type="Custom_Wall_Type",
    
        name="my_wall",
    
    )
    

    but when opening the resulting IFC file in Bonsai, it shows "No Relating Type" in Scene > Object Information of the selected wall:

    I've tried to play around with ifcopenshell.api.aggregate.assign_object() without any success for the moment.

    <br>

    For programmatic reasons, I would have loved 😍 to instantiate the object with the predefined type as a class instead of a string, but this currently doesn't work, obviously:

    
    my_wall_type = ifcopenshell.api.root.create_entity(
    
        model,
    
        ifc_class="IfcWallType",
    
        name="Custom_Wall_Type",
    
    )
    
    # add some Psets to my_wall_type...
    
    my_wall = ifcopenshell.api.root.create_entity(
    
        model,
    
        ifc_class="IfcWall",
    
        predefined_type=my_wall_type, # <---- use the type instance to inherit everything from it!
    
        name="my_wall",
    
    )
    

    I guess I certainly missed some other obvious method here...

    Thanks 🙏!

  2. B

    In IFC PredefinedType is an optional object attribute that offers some fine grained classification. To assign a Type to an Element use ifcopenshell.api.type.assign_type()

  3. B

    e.g. an IfcWall might have a PredefinedType of 'PARAPET', but this is just a text label - when you select the Wall in Bonsai the class will be displayed as 'IfcWall[PARAPET]'

Login or Register to reply.