Skip to content

IFC import & export

Allplan Python API offers two classes with methods for handling IFC files:

Each of them works in a slightly different way and return different kind of objects. Choosing the most suitable will often depend on the use case.

IFC import

Using Cad Data File Reader

The static method ReadIFC can read the data from an IFC file. It only reads the IFC data and returns it organized into groups represented by tuples containing:

  • the group name and
  • list of ModelElement3D objects belonging to this group
ifc_data = AllplanBaseElements.CadDataFileReader.ReadIFC(document_adapter, ifc_file_path)
model_element_list = [model_element for group_name, model_element_group in ifc_data for model_element in model_element_group] #(1)!
  1. We can flatten the data structure returned by the ReadIFC method to just one simple list containing all ModelElement3D objects from the IFC file by a two-step list comprehension.


Note, that the method ReadIFC only reads the data and returns the ModelElement3D objects, without creating them in the DF. The objects can be processed further e.g. be added to a PythonPart and placed at a point, along a path or in a grid. This makes it the best import method for IFC files containing subordinate objects, like fixtures.


For a complete usage of CadDataFileReader class, see the example PythonPart located in:

  • …\etc\Examples\PythonParts\BasisExamples\ExportImport\CadDataFileReader.pyp
  • …\etc\PythonPartsExampleScripts\BasisExamples\ExportImport\

Using Import Export Service

The method ImportIFC reads the data from IFC file and directly creates model elements in the specified DF. It also returns the BaseElementAdapterList with adapters to the created objects, so that they still can be accessed later in the script.

export_import_service = AllplanBaseElements.ExportImportService() #(1)!

imported_elements = export_import_service.ImportIFC( \
    doc=        document_adapter,
    fileNumber= drawing_file_number,
    fileName=   ifc_file_path)
  1. Note that you must instantiate the service first.


This method can be considered as the equivalent for the Allplan feature Import IFC data. It is the best method to IFC file containing an entire AEC project e.g., a whole building structure.

IFC export

The method ExportIFC can be used to export IFC data from specified DFs and save it as IFC file into a desired location. The function call look like this:

export_import_service = AllplanBaseElements.ExportImportService() #(1)!

export_import_service.ExportIFC( \
    doc=                document_adapter, 
    fileNumbers=        export_file_numbers,
    ifcVersion=         AllplanBaseElements.IFC_Version.Ifc_4, #(2)!
    fileName=           ifc_file_path,
    ifcThemeFileName=   ifc_export_theme_file) #(3)!
  1. Note that you must instantiate the service first.
  2. See the enumeration class IFC_Version for more options.
  3. Path to a theme file may optionally be provided. A theme file has a .nth extension and contains all settings for an IFC export. It can be created directly in Allplan, using Export IFC data. Default files are provided in ...\etc\Favorites - standard\Ifc\


For a complete usage of ExportIFC, see the example located in:

  • …\etc\Examples\PythonParts\BasisExamples\ExportImport\ IfcExportImport.pyp
  • …\etc\PythonPartsExampleScripts\BasisExamples\ExportImport\