compas_ifc.entities

Internal IFC entity wrappers. The user-facing API does not require touching these directly — see compas_ifc.bim and compas_ifc.element — but they are documented for contributors and for advanced workflows that need raw IFC entity access through element._ifc_entity.

Architecture

Every IFC entity loaded through compas_ifc is wrapped in a Base. Direct attribute access proxies through __getattr__() to the underlying ifcopenshell.entity_instance. Inverse attributes are exposed as zero-argument callables (wall.ContainedInStructure()) to mark the syntactic distinction from direct attributes (wall.Name).

Type information for the IFC class hierarchy is provided through PEP 561 stubs at compas_ifc/entities/generated/{IFC2X3,IFC4,IFC4X3}.pyi. These stubs are consumed by IDEs and type checkers; there is no runtime class per IFC type. Schema-class attributes added by hand-written extensions are merged into the matching stub class so they appear in autocomplete alongside the EXPRESS-defined attributes.

Base

base.Base

Root class for all IFC entity wrappers.

base.TypeDefinition

Root class for all IFC type definitions.

base.extends

Register a class as an extension of one or more IFC classes.

Extensions

Hand-written extensions registered via the extends() decorator. Each adds Python-friendly properties to entities of a particular IFC class.

extensions.IfcObjectDefinitionExtras

Extras applied to entities of class IfcObjectDefinition.

extensions.IfcObjectExtras

Extras applied to entities of class IfcObject.

extensions.IfcContextExtras

Extras applied to entities of class IfcContext.

extensions.IfcProjectExtras

Extras applied to entities of class IfcProject.

extensions.IfcProductExtras

Extras applied to entities of class IfcProduct.

extensions.IfcElementExtras

Extras applied to entities of class IfcElement.

extensions.IfcSpatialContainerExtras

Extras applied to IFC entities that act as spatial containers.

extensions.IfcSiteExtras

Extras applied to entities of class IfcSite.

extensions.IfcBuildingExtras

Extras applied to entities of class IfcBuilding.

Stub generator

The stub generator under compas_ifc.entities.generator writes one .pyi file per supported schema. Run by maintainers when adding support for a new IFC schema version; not typically invoked by users.

python -m compas_ifc.entities.generator

generator.Generator

Generate a .pyi stub for a single IFC schema.