ifcopenshell#

The entry module for IfcOpenShell

Typically used for opening an IFC via a filepath, or accessing one of the submodules.

Example:

import ifcopenshell
print(ifcopenshell.version) # v0.7.0-1b1fd1e6
model = ifcopenshell.open("/path/to/model.ifc")

Subpackages#

Submodules#

Package Contents#

ifcopenshell.NO_HEADER#
ifcopenshell.READ_ERROR#
ifcopenshell.UNSUPPORTED_SCHEMA#
ifcopenshell.platform_architecture = 32bit#
ifcopenshell.platform_system#
ifcopenshell.python_distribution#
ifcopenshell.python_version_tuple#
exception ifcopenshell.Error#

Bases: Exception

Error used when a generic problem occurs

Initialize self. See help(type(self)) for accurate signature.

exception ifcopenshell.SchemaError#

Bases: Error

Error used when an IFC schema related problem occurs

Initialize self. See help(type(self)) for accurate signature.

ifcopenshell.create_entity(type, schema='IFC4', *args, **kwargs)#

Creates a new IFC entity that does not belong to an IFC file object

Note that it is more common to create entities within a existing file object. See ifcopenshell.file.file.create_entity().

Parameters
  • type (string) – Case insensitive name of the IFC class

  • schema (string) – The IFC schema identifier

  • args – The positional arguments of the IFC class

  • kwargs – The keyword arguments of the IFC class

Returns

An entity instance

Return type

ifcopenshell.entity_instance.entity_instance

Example:

person = ifcopenshell.create_entity("IfcPerson") # #0=IfcPerson($,$,$,$,$,$,$,$)
model = ifcopenshell.file()
model.add(person) # #1=IfcPerson($,$,$,$,$,$,$,$)
ifcopenshell.open(path: os.PathLike | str, format: str = None, should_stream: bool = False) file.file#

Loads an IFC dataset from a filepath

You can specify a file format. If no format is given, it is guessed from its extension. Currently supported specified format : .ifc | .ifcZIP | .ifcXML

Examples:

model = ifcopenshell.open(“/path/to/model.ifc”) model = ifcopenshell.open(“/path/to/model.ifcXML”) model = ifcopenshell.open(“/path/to/model.any_extension”, “.ifc”)

ifcopenshell.register_schema(schema)#

Registers a custom IFC schema

Parameters

schema (ifcopenshell.express.schema_class.SchemaClass) – A schema object

Example:

schema = ifcopenshell.express.parse("/path/to/ifc-custom.exp")
ifcopenshell.register_schema(schema)
ifcopenshell.file(schema="IFC_CUSTOM")
ifcopenshell.schema_by_name(schema=None, schema_version=None)#

Returns an object allowing you to query the IFC schema itself

Parameters
  • schema (string) – Which IFC schema to use, chosen from “IFC2X3”, “IFC4”, or “IFC4X3”. These refer to the ISO approved versions of IFC.

  • schema_version (tuple[int]) – If you want to specify an exact version of IFC that may not be an ISO approved version, use this argument instead of schema. IFC versions on technical.buildingsmart.org are described using 4 integers representing the major, minor, addendum, and corrigendum number. For example, (4, 0, 2, 1) refers to IFC4 ADD2 TC1, which is the official version approved by ISO when people refer to “IFC4”. Generally you should not use this argument unless you are testing non-ISO IFC releases.