IfcOpenShell: Filtering descriptions of Types

edited September 2022 in General

How does one filter all the descriptions of the IfcTypes with IfcOpenShell?

I now have this

 if ifcproduct:
            type_name_list.append(ifcproduct.ObjectType)

But it returns only labels where the descriptions are filled.

How do I get all the IfcWallType, IfcBeamType, IfcCoveringType etc.. descriptions?
Could not find any code examples.

Tagged:

Comments

  • this?

    import blenderbim.tool as tool
    type_entities = tool.Ifc.get().by_type("IfcTypeObject")
    
  • ...or this, if just ifcopenshell?

    import ifcopenshell
    Ifc = ifcopenshell.open('path/to/ifc_file')
    type_entities = Ifc.by_type("IfcTypeObject")
    
  • @theoryshaw

    Thanks for your answers, how do I get the types when looping over an ifproduct?

    import blenderbim.bim.import_ifc
    from blenderbim.bim.ifc import IfcStore
    import blenderbim.tool as tool
    import ifcopenshell
    
    ifc_file = ifcopenshell.open(IfcStore.path)
    products = ifc_file.by_type('IfcProduct')
    
    for product in products:
        #here I want to get the types of each IfcProduct instance, I amlost
    
    
    theoryshaw
  • Found this in the documentation of BuildingSmart

    Any instance of IfcProduct defines a particular occurrence of a product, the common type information, that relates to many similar (or identical) occurrences of IfcProduct, is handled by the IfcTypeProduct (and its subtypes), assigned to one or many occurrences of IfcProduct by using the objectified relationship IfcRelDefinesByType. The IfcTypeProduct may provide, in addition to common properties, also a common geometric representation for all occurrences.
    
    An IfcProduct occurs at a specific location in space if it has a geometric representation assigned. It can be placed relatively to other products, but ultimately relative to the world coordinate system defined for this project.
    
    The inherited ObjectType attribute can be used to designate a particular type of the product instance. If subtypes of IfcProduct have a PredefinedType defined, the ObjectType is used to provide the user defined, particular type of the product instance, if the PredefinedType is set to USERDEFINED.
    

    I need to get to IfcRelDefinesByType somehow

  • @Coen a product can only have 0 or 1 types, not more. You can use ifcopenshell.util.element.get_type(product).

    By the way, the type should not be stored in the ObjectType attribute that you alluded to in your first post. This a common mistake done by Autodesk and has led to a common misconception. https://github.com/Autodesk/revit-ifc/issues/502

    Coentheoryshaw
  • @Moult

    Thanks! Autodesk misleading me once again...

    Nigel
Sign In or Register to comment.