Correct way to remove complete Psets · Issue #1424 · IfcOpenShell/IfcOpenShell · GitHub
Skip to content

Correct way to remove complete Psets #1424

Description

@AlexanderNitsch

I'm trying to delete some Property Sets from multiple objects, but I have yet to find a way to do this properly.

Currently I'm trying the following, but this leaves me with a corrupted ifc file.

ifc = ifcopenshell.open(filepath)
    all_elements = ifc.by_type(element_type)
        for element in all_elements:
        if element.is_a('IfcTypeObject'):
            if element.HasPropertySets:
                for definition in element.HasPropertySets:
                    if SOME CONDITION:
                        ifc.remove(definition)
        else:
            for relationship in element.IsDefinedBy:
                if relationship.is_a('IfcRelDefinesByProperties'):
                    definition = relationship.RelatingPropertyDefinition
                    if SOME CONDITION:
                        ifc.remove(ifc.by_guid(definition.GlobalId))

If I save this ifc file and try to get the psets of elements with ifcopenshell.util.element.get_psets(element), I get multiple empty definitions back ( Like remains of the Psets that I wanted to delete).
In my final Code I want to only delete some Psets (f.e. based on name)

How would I go about cleanly removing complete Psets.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions