IFCFile

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

Bases: object

The IFCFile class is a wrapper around an ifcopenshell file object. It provides low-level access to the IFC data.

Attributes:
filepathstr, optional

The path to the IFC file.

modelcompas_ifc.model.Model

The model object.

use_occbool

Whether to use OCC for geometry processing.

load_geometriesbool

Load all the geometries of the IFC file using a fast multithreaded iterator.

verbosebool

Whether to print verbose output.

extensionsdict, optional

A dictionary of custom extensions to be used with the IFC file.

schemaifcopenshell.schema.Schema

The IFC schema object.

schema_namestr

The name of the IFC schema.

classeslist[compas_ifc.entities.base.Base]

A list of all the classes for this schema version.

default_projectcompas_ifc.entities.generated.IFC4.IfcProject

The default project in this file. Will be created if it does not exist.

default_unitscompas_ifc.entities.generated.IFC4.IfcUnitAssignment

The default units in this file. Will be created if it does not exist.

default_owner_historycompas_ifc.entities.generated.IFC4.IfcOwnerHistory

The default owner history in this file. Will be created if it does not exist.

default_contextcompas_ifc.entities.generated.IFC4.IfcContext

The default context in this file. Will be created if it does not exist.

default_body_contextcompas_ifc.entities.generated.IFC4.IfcContext

The default body context in this file. Will be created if it does not exist.

Methods

__init__

Construct the IFCFile object.

create

Create an entity in this model.

create_relationship

Create the correct relationship between two entities based on their types.

create_value

Create corresponding IfcValue from a Python value.

ensure_classes_generated

Check if the IFC classes are generated and generate them if not.

export

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

file_size

Get the size of the IFC file in MB.

from_entity

Convert an ifcopenshell entity to a compas_ifc entity.

get_entities_by_name

Get all entities with a given name.

get_entities_by_type

Get all entities of a given type.

get_entity_by_global_id

Get an entity by its global ID.

get_entity_by_id

Get an entity by its file ID.

get_preloaded_geometry

Get the preloaded geometry of an entity.

get_preloaded_style

Get the preloaded style of an entity.

load_geometries

Load all the geometries of the IFC file using a fast multithreaded iterator.

remove

Remove an entity from this model.

save

Save the IFC file to a given path.

search_ifc_classes

Search for IFC classes by name