Model

class compas_ifc.model.Model(filepath=None, schema='IFC4', use_occ=False, load_geometries=True, verbose=True, extensions=None)

Bases: Data

The Model class is the COMPAS IFC’s main entry point. It is a intuitive abstraction on top of an IFC file, providing a set of easy-to-use methods for interacting with the IFC data.

Attributes:
filecompas_ifc.file.IFCFile

The IFC file object.

schemaifcopenshell.schema.Schema

The IFC schema object.

schema_namestr

The name of the IFC schema.

entitiesGenerator[compas_ifc.entities.base.Base, None, None]

A generator of all entities in the IFC file.

projectcompas_ifc.entities.generated.IFC4.IfcProject

The project entity.

siteslist[compas_ifc.entities.generated.IFC4.IfcSite]

A list of all site entities.

buildingslist[compas_ifc.entities.generated.IFC4.IfcBuilding]

A list of all building entities.

building_storeyslist[compas_ifc.entities.generated.IFC4.IfcBuildingStorey]

A list of all building storey entities.

building_elementslist[compas_ifc.entities.generated.IFC4.IfcBuildingElement]

A list of all building element entities.

unitstr

The unit of the IFC file. Can be “mm”, “cm”, or “m”.

Methods

__init__

Construct the Model object.

create

Create an entity in this model.

create_beam

Create a beam in this model.

create_column

Create a column in this model.

create_default_project

Create a default project in this model if one does not exist.

create_door

Create a door in this model.

create_railing

Create a railing in this model.

create_roof

Create a roof in this model.

create_slab

Create a slab in this model.

create_stair

Create a stair in this model.

create_value

create_wall

Create a wall in this model.

create_window

Create a window in this model.

export

Export a subset of the IFC file to a new IFC file.

get_entities_by_name

Get entities by name

get_entities_by_type

Get entities by type name

get_entity_by_global_id

Get an entity by global ID

get_entity_by_id

Get an entity by ID

print_spatial_hierarchy

Print the spatial hierarchy of the IFC file.

print_summary

Print a summary of the IFC file.

remove

Remove an entity from this model.

save

Save the IFC file.

search_ifc_classes

Search for IFC classes by name

show

Show the IFC file in a viewer, either the entire project or a single entity.

template

Create a template model with a default project, site, building, and storey.

Inherited Methods

ToString

Converts the instance to a string.

copy

Make an independent copy of the data object.

from_json

Construct an object of this type from a JSON file.

from_jsonstring

Construct an object of this type from a JSON string.

sha256

Compute a hash of the data for comparison during version control using the sha256 algorithm.

to_json

Convert an object to its native data representation and save it to a JSON file.

to_jsonstring

Convert an object to its native data representation and save it to a JSON string.

validate_data

Validate the data against the object's data schema.