BuildingInformationModel
- class compas_ifc.bim.BuildingInformationModel(filepath=None, schema='IFC4', use_occ=False, load_geometries=True, rectify_placements=True, rectify_verbose=False, name=None, **kwargs)
Bases:
ElementFactoryMixin,InteractionMixin,TreeMixin,ModelA building information model backed by an IFC file.
Extends
compas_model.Modelto provide IFC-specific functionality including reading/writing IFC files, spatial hierarchy management, and IFC entity creation. The model’streeholds the spatial hierarchy and thegraphholds non-hierarchical relationships (interactions).This class acts as a bi-directional front-end: every mutation (adding elements, changing geometry/properties/transforms) immediately updates the underlying IFC file. Calling
save()writes the file.IfcProject-level information (units, schema, metadata) is managed directly by this class rather than as a separate element.
- Parameters:
- filepathstr, optional
Path to an IFC file to load.
- schemastr, optional
IFC schema to use when creating a new file. Default is “IFC4”.
- use_occbool, optional
Whether to use OpenCascade for geometry. Default is False.
- load_geometriesbool, optional
Whether to pre-load geometries during import. Default is True.
- rectify_placementsbool, optional
Whether to rewrite IFC placements during import so that each element’s
IfcLocalPlacement.PlacementRelTopoints to its spatial parent’s placement andRelativePlacementholds the local transform. Default is True.- rectify_verbosebool, optional
If True and
rectify_placementsis True, print a line for each rectified placement showing whatPlacementRelTochanged from and to (e.g. “IfcWall ‘Wall A’: PlacementRelTo IfcBuilding ‘B1’ -> IfcBuildingStorey ‘S1’”). Default is False.- namestr, optional
Name of the model.
Methods
Add a GenericElement to the model tree and create its IFC entity.
Find an element by its IFC GlobalId.
Find all elements with a given name.
Find all elements of a given IFC type (e.g.
Remove a GenericElement from the model and the IFC file.
Save the IFC file to disk, optionally converting to another schema.
Show the model (or specific elements and their children) in compas_viewer.
Validate all elements against information requirements.
Inherited Methods
Converts the instance to a string.
Add a list of elements to the model.
Add a group to the model.
Add an interaction between two elements of the model.
Add a material to the model.
Add a modifier between two elements, with one the source of the modifier and the other the target.
Add a material to the model or retrieve an existing instance of the same type.
Assign a material to an element or a list of elements.
Compute the axis-aligned bounding box of the datastructure.
Compute the Bounding Volume Hierarchy (BVH) of the elements for fast collision checks.
Detect volumetric collisions (interferences) between building elements.
Detect geometric contacts between building elements and add them as connection edges.
Compute the contacts between the block elements of this model.
Compute the KD tree of the elements for fast nearest neighbour queries.
Compute the oriented bounding box of the datastructure.
Make an independent copy of the data object.
Create an IfcBeam and add it to the model.
Create an IfcColumn and add it to the model.
Create an IfcDoor and add it to the model.
Create a building element and add it to the model.
Create an IfcRoof and add it to the model.
Create an IfcSlab and add it to the model.
Create an IfcWall and add it to the model.
Create an IfcWindow and add it to the model.
Find the nearest neighbours to a root element.
Iterate over the elements contained in the model.
Export selected elements to a new IFC file.
Extract elements into a new standalone BuildingInformationModel.
Find all model elements of a given type.
Returns True if the model contains an element with the given name.
Construct an object of this type from a JSON file.
Construct an object of this type from a JSON string.
Get all graph edges that have at least one relationship of a given category.
Get all graph edges belonging to a relationship group.
Returns True if the model contains the given element.
Returns True if the model contains an element with the given name.
Returns True if two elements have an interaction set between them.
Verify that the model contains a specific material.
Iterate over the materials stored in the model.
Find the nearest neighbours to a point.
Print the spatial hierarchy of the model.
Remove all model elements of a given type.
Remove the interaction between two elements.
Rotate the datastructure.
Returns a rotated copy of this geometry.
Scale the datastructure.
Returns a scaled copy of this geometry.
Compute a hash of the data for comparison during version control using the sha256 algorithm.
Visualize all collision pairs at once, each pair in its own colour.
Show the model with an interactive collision list in compas_viewer.
Create a template BIM model with default spatial hierarchy.
Convert an object to its native data representation and save it to a JSON file.
Convert an object to its native data representation and save it to a JSON string.
Trace elements reachable from
startthrough interaction edges.Transform the model and all that it contains.
Transforms the data structure.
Returns a transformed copy of this data structure.
Returns a transformed copy of this data structure.
Translate the datastructure.
Returns a translated copy of this geometry.
Validate the data against the object's data schema.