OSArch Community

Dealing with dodgy IFC properties.

  1. C

    Anyone got any clever ideas on how I can remove a Property from a Pset. The catch is that the Property exists twice in the PropertySet, once with the correct Value, once with the string "Error".

    So far my attempt with ifcopenshell has stalled as I can't seem to pull Properties from a Pset if they exist twice, IOS just gives me one of the two.

    
    import ifcopenshell
    
    import ifcopenshell.util.element
    
    from pathlib import Path
    
    from pprint import pprint
    
    
    ifc_path = r"./mdl/"
    
    ifc_glob = Path(ifc_path).glob("*.ifc")
    
    
    guid_fpid_dict = {}
    
    
    for ifc_file in ifc_glob:
    
    
        mdl = ifcopenshell.open(ifc_file)
    
        objs = mdl.by_type("IfcBuildingElementProxy")
    
    
        for obj in objs:
    
    
            guid = obj.GlobalId        
    
            fpid = ifcopenshell.util.element.get_pset(obj, name="MyPset")
    
    
    
            guid_fpid_dict[guid] = fpid
    
    
    pprint(guid_fpid_dict["ExampleGlobalID"])
    

    The resulting dict only contains one instance of the Property, rather than the two I know it has. I assume this is because the IFC is so dodgy that IOS wasn't built to expect it.

    I would love to fix at source instead but that is just as much of a struggle.

  2. C

    In the end I managed to fix it at source, just a bit of dll decompilation magic needed...

Login or Register to reply.