IfcBuildingElement class attributes

edited January 2023 in General

All building element have som direct attributes which do describe the object but are not in a pset but in the entity directly. A IfcDoor for example has
Name, Description, ObjectType, OverallHeight , OverallWidth, PredefinedType, OperationType, SINGLE_SWING_LEFT, UserDefinedOperationType

Is there a possiblility to get all these attributes without implementing the name of them directly? Something like we have with the comon psets definition.

Tagged:

Comments

  • edited December 2020

    We had this discussion recently with theoryshaw and Moult. I documented it on wiki : https://wiki.osarch.org/index.php?title=IfcOpenShell_code_examples#Exploring_IFC_schema

    bernd
  • great :-)

  • I noticed that the example in the wiki doesn't include a check for whether the attribute is derived. Note that this can be important if you are doing bulk checks. Use the element.derived() function.

  • edited December 2020

    @Moult said:
    I noticed that the example in the wiki doesn't include a check for whether the attribute is derived.

    What is the difference between a derived attribute and a not derived attribute.

  • Derived is a parent's class attribute

  • not in sense of coding but in sens of ifc. Which class attribute is derived and which not?

  • @Cyril said:
    We had this discussion recently with theoryshaw and Moult. I documented it on wiki : https://wiki.osarch.org/index.php?title=IfcOpenShell_code_examples#Exploring_IFC_schema

    Does this mean a derived attribute is the same as a referenced attribute?

  • A described by Wikipedia:

    There are three different kinds of attributes, explicit, derived and inverse attributes. And all these can be re-declared in a subtype. In addition an explicit attribute can be re-declared as derived in a subtype. No other change of the kind of attributes is possible.

    • Explicit attributes are those with direct values visible in a STEP-File.
    • Derived attributes get their values from an expression. In most cases the expression refers to other attributes of THIS instance. The expression may also use EXPRESS functions.
    • Inverse attributes do not add "information" to an entity, but only name and constrain an explicit attribute to an entity from the other end.

    An example may be IfcGeometricRepresentationSubContext, which if you read the express definition, has 4 derived attributes. It is important to check if you are automatically setting attribute values since it is not possible to set a value to a derived attribute.

    stephen_lCyril
  • PitPit
    edited January 2023

    Hello to all the contributors. All your responses give a super valueable information.
    I would like to ask** if there is any util in ifcopenshell to get the inverse attributes of an entity**(python)as they are extremely useful to understand how the element is positionned in the schema and its relations. In the page
    https://wiki.osarch.org/index.php?title=IfcOpenShell_code_examples#Exploring_IFC_schema
    explicit and derived attributes are retrived but I miss a list of the inversed. Any idea?

  • I'm a newbie, but the following might help.

    import bpy
    import ifcopenshell
    from blenderbim.bim.ifc import IfcStore
    
    
    Ifc = ifcopenshell.open(IfcStore.path)
    
    wall = Ifc.by_type('IfcWall')[0]
    inverse_attribute_classes = Ifc.get_inverse(wall)
    
    for inverse_class in inverse_attribute_classes:
        print(inverse_class)
    
    schema_version = Ifc.wrapped_data.schema
    
    schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name(schema_version)
    
    wallentity = schema.declaration_by_name("IfcWall")
    
    wallentity.all_attributes()
    
    walls_inverse_attributes = wallentity.all_inverse_attributes()
    for inverse_attribute in walls_inverse_attributes:
        print(inverse_attribute)
    
    print('x')
    

    I've attached a BlenderBIM/IFC file to try it out.

    Output...

    Pit
  • @Cyril said:
    We had this discussion recently with theoryshaw and Moult. I documented it on wiki

    Awesome that you added it to the wiki!

    Pit
Sign In or Register to comment.