Skip to content

File Controller

Interchange with external 3D and CAD file formats.

Handles import and export of geometry between cadwork and third-party formats (3DC, STEP, SAT, Rhino, BTL, BXF, DXF, DSTV, FBX, OBJ, STL, GLB, WebGL, variants, ...). Concerned only with neutral-format data exchange — BIM-specific (IFC) workflows live in bim_controller, and shop-drawing 2D exports live in shop_drawing_controller.

clear_errors() -> None

Clears all errors.

export_3d_file(element_id_list: list[ElementId], file_path: str) -> bool

Exports a 3D file.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required
file_path str

The output file path.

required

Examples:

1
2
>>> import element_controller as ec
>>> import file_controller as fc
1
2
3
4
5
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> output_path = r"C:/exports/model.3d"
>>> success = fc.export_3d_file(selected_elements, output_path)
>>> if success:
>>>     print("3D file export completed successfully")

Returns:

Type Description
bool

True on successful export, false otherwise.

export_3dc_file(element_id_list: list[ElementId], file_path: str) -> None

Exports a 3D file.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required
file_path str

The output file path.

required

Examples:

1
2
>>> import element_controller as ec
>>> import file_controller as fc
1
2
3
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> output_path = r"C:/exports/model.3dc"
>>> fc.export_3dc_file(selected_elements, output_path)

export_btl_file_for_nesting(file_path: str) -> None

Exports a BTL file for nesting.

Parameters:

Name Type Description Default
file_path str

The output file path.

required

Examples:

1
>>> import file_controller as fc
1
2
>>> output_path = r"C:/exports/nesting_project.btl"
>>> fc.export_btl_file_for_nesting(output_path)

export_dstv_file(file_path: str) -> bool

Exports active elements in the scene to a DSTV (.stp) file.

Parameters:

Name Type Description Default
file_path str

The output file path.

required

Returns:

Type Description
bool

True on successful export, false otherwise.

export_dxf_file(file_path: str, dxf_layer_format_type: dxf_layer_format_type, dxf_export_version: dxf_export_version) -> bool

Exports visible elements in the scene to a DXF file.

Parameters:

Name Type Description Default
file_path str

The output file path.

required
dxf_layer_format_type dxf_layer_format_type

The format type of how to organize layers.

required
dxf_export_version dxf_export_version

The dxf version to use for the export.

required

Returns:

Type Description
bool

True on successful export, false otherwise.

export_fbx_file(element_id_list: list[ElementId], file_path: str, fbx_format: int) -> None

Exports a FBX file.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required
file_path str

The output file path.

required
fbx_format int

The FBX format.

Available values :

  • 1 = "FBX binary(*.fbx)";
  • 2 = "FBX ascii(*.fbx)";
  • 3 = "FBX encrypted(*.fbx)";
  • 4 = "FBX 6.0 binary(*.fbx)";
  • 5 = "FBX 6.0 ascii(*.fbx)";
  • 6 = "FBX 6.0 encrypted(*.fbx)";
required

Examples:

1
2
>>> import element_controller as ec
>>> import file_controller as fc
1
2
3
4
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> output_path = r"C:/exports/model.fbx"
>>> fbx_format = 1  # FBX binary format
>>> fc.export_fbx_file(selected_elements, output_path, fbx_format)
1
2
3
>>> # Export as ASCII format
>>> fbx_format = 2  # FBX ascii format
>>> fc.export_fbx_file(selected_elements, output_path, fbx_format)

export_glb_file(element_id_list: list[ElementId], file_path: str) -> None

Exports a GLB File.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required
file_path str

The output file path.

required

Examples:

1
2
>>> import element_controller as ec
>>> import file_controller as fc
1
2
3
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> output_path = r"C:/exports/model.glb"
>>> fc.export_glb_file(selected_elements, output_path)

export_obj_file(element_id_list: list[ElementId], file_path: str) -> None

Exports a OBJ file.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required
file_path str

The output file path.

required

Examples:

1
2
>>> import element_controller as ec
>>> import file_controller as fc
1
2
3
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> output_path = r"C:/exports/model.obj"
>>> fc.export_obj_file(selected_elements, output_path)

export_rhino_file(element_id_list: list[ElementId], file_path: str, version: int, use_default_assignment: bool, write_standard_attributes: bool) -> None

Exports a 3dm rhino file.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required
file_path str

The output file path.

required
version int

The rhino version :

  • 5 = V5.0,
  • 6 = V6.0,
  • 7 = V7.0,
  • 8 = V8.0
required
use_default_assignment bool

True if default assignment is used. False if no attributes are exported.

required
write_standard_attributes bool

True if exported with standard attribute, false otherwise.

required

Examples:

1
2
>>> import element_controller as ec
>>> import file_controller as fc
1
2
3
4
5
6
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> output_path = r"C:/exports/model.3dm"
>>> version = 8  # Rhino version
>>> use_default_assignment = True
>>> write_standard_attributes = False
>>> fc.export_rhino_file(selected_elements, output_path, version, use_default_assignment, write_standard_attributes)

export_rhino_file_with_options(element_id_list: list[ElementId], file_path: str, version: int, use_default_assignment: bool, write_standard_attributes: bool, rhino_options: None) -> None

Exports elements to a rhino 3dm file based on the export options.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required
file_path str

The output file path.

required
version int

The rhino version :

  • 5 = V5.0,
  • 6 = V6.0,
  • 7 = V7.0,
  • 8 = V8.0
required
use_default_assignment bool

True if default assignment is used. False if no attributes are exported.

required
write_standard_attributes bool

True if exported with standard attribute, false otherwise.

required
rhino_options None

The Rhino export option.

required

Examples:

1
2
>>> import element_controller as ec
>>> import file_controller as fc
1
2
3
4
5
6
7
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> output_path = r"C:/exports/model.3dm"
>>> version = 8  # Rhino version
>>> use_default_assignment = True
>>> write_standard_attributes = False
>>> rhino_options = None  # Use default options
>>> fc.export_rhino_file_with_options(selected_elements, output_path, version, use_default_assignment, write_standard_attributes, rhino_options)

export_sat_file(element_id_list: list[ElementId], file_path: str, scale_factor: float, binary: bool, version: int) -> None

Exports a SAT File.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required
file_path str

The output file path.

required
scale_factor float

The file scale factor.

required
binary bool

Whether to write the SAT file in binary or a human readable format.

required
version int

The ACIS version to use :

  • 3400 = v34.0
  • 3200 = v32.0
  • 2100 = v21.0
required

Examples:

1
2
>>> import element_controller as ec
>>> import file_controller as fc
1
2
3
4
5
6
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> output_path = r"C:/exports/model.sat"
>>> scale_factor = 1.0
>>> binary_format = True
>>> version = 25000  # SAT version
>>> fc.export_sat_file(selected_elements, output_path, scale_factor, binary_format, version)

export_sat_file_cut_drillings(element_id_list: list[ElementId], file_path: str, scale_factor: float, binary: bool, version: int) -> None

Exports a SAT File with extruded drillings (cut drilling holes into bodies).

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required
file_path str

The output file path.

required
scale_factor float

The file scale factor.

required
binary bool

Whether to write the SAT file in binary or a human readable format.

required
version int

The ACIS version to use :

  • 3400 = v34.0
  • 3200 = v32.0
  • 2100 = v21.0
required

export_step_file(element_id_list: list[ElementId], file_path: str, scale_factor: float, version: int, text_mode: bool) -> None

Exports a STEP file.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required
file_path str

The output file path.

required
scale_factor float

The file scale factor.

required
version int

The file export version : - 214 = STEP AP214 - 203 = STEP AP203 (default value)

required
text_mode bool

Use text mode. PARAMETER UNUSED

required

Examples:

1
2
>>> import element_controller as ec
>>> import file_controller as fc
1
2
3
4
5
6
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> output_path = r"C:/exports/model.stp"
>>> scale_factor = 1_000.0
>>> version = 214  # STEP version
>>> text_mode = False
>>> fc.export_step_file(selected_elements, output_path, scale_factor, version, text_mode)

export_step_file_cut_drillings(element_id_list: list[ElementId], file_path: str, scale_factor: float, version: int, text_mode: bool, imperial_units: bool) -> None

Exports a STEP file with extruded drillings.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required
file_path str

The output file path.

required
scale_factor float

The file scale factor.

required
version int

The file export version : - 214 = STEP AP214 - 203 = STEP AP203 (default value)

required
text_mode bool

Use text mode. PARAMETER UNUSED

required
imperial_units bool

Use imperial units.

required

Examples:

1
2
>>> import element_controller as ec
>>> import file_controller as fc
1
2
3
4
5
6
7
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> output_path = r"C:/exports/model_cut_drillings.step"
>>> scale_factor = 1.0
>>> version = 214  # STEP version
>>> text_mode = False
>>> imperial_units = False
>>> fc.export_step_file_cut_drillings(selected_elements, output_path, scale_factor, version, text_mode, imperial_units)

export_step_file_extrude_drillings(element_id_list: list[ElementId], file_path: str, scale_factor: float, version: int, text_mode: bool, imperial_units: bool) -> None

Exports a STEP file with extruded drillings.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required
file_path str

The output file path.

required
scale_factor float

The file scale factor.

required
version int

The file export version : - 214 = STEP AP214 - 203 = STEP AP203 (default value)

required
text_mode bool

Use text mode. PARAMETER UNUSED

required
imperial_units bool

Use imperial units.

required

Examples:

1
2
>>> import element_controller as ec
>>> import file_controller as fc
1
2
3
4
5
6
7
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> output_path = r"C:/exports/model_with_drillings.step"
>>> scale_factor = 1.0
>>> version = 214  # STEP version
>>> text_mode = False
>>> imperial_units = False
>>> fc.export_step_file_extrude_drillings(selected_elements, output_path, scale_factor, version, text_mode, imperial_units)

export_stl_file(element_id_list: list[ElementId], file_path: str) -> None

Exports an STL file.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required
file_path str

The output file path.

required

Examples:

1
2
>>> import element_controller as ec
>>> import file_controller as fc
1
2
3
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> output_path = r"C:/exports/model.stl"
>>> fc.export_stl_file(selected_elements, output_path)

export_webgl(element_id_list: list[ElementId], file_path: str) -> bool

Exports a WebGL file.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required
file_path str

The output file path.

required

Examples:

1
2
>>> import element_controller as ec
>>> import file_controller as fc
1
2
3
4
5
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> output_path = r"C:/exports/model.html"
>>> success = fc.export_webgl(selected_elements, output_path)
>>> if success:
>>>     print("WebGL export completed successfully")

Returns:

Type Description
bool

True on successful export, false otherwise.

get_blum_export_path() -> str

Gets the path of the Blum export.

Returns:

Type Description
str

The path of the Blum export.

get_import_3dc_options() -> import_3dc_options

Get the 3dc import options.

Returns:

Type Description
import_3dc_options

The 3dc import options.

import_3dc_file(file_path: str) -> list[ElementId]

Imports a 3DC file.

Parameters:

Name Type Description Default
file_path str

The input file path.

required

Returns:

Type Description
list[ElementId]

The imported list of element id.

import_3dc_file_with_glide(file_path: str) -> list[ElementId]

Imports a 3DC file with glide.

Parameters:

Name Type Description Default
file_path str

The input file path.

required

Returns:

Type Description
list[ElementId]

The imported list of element id.

import_3dc_file_with_options(file_path: str, import_3dc_options: import_3dc_options) -> list[ElementId]

Imports a 3d or a 3dc file depending on the import options.

Parameters:

Name Type Description Default
file_path str

The input file path.

required
import_3dc_options import_3dc_options

The 3dc import options.

required

Returns:

Type Description
list[ElementId]

The imported list of element id.

import_3dz_file(file_path: str) -> None

Imports a 3DZ file.

Parameters:

Name Type Description Default
file_path str

The input file path.

required

import_btl_file(file_path: str) -> None

Imports a BTL file.

Parameters:

Name Type Description Default
file_path str

The input file path.

required

import_btl_file_for_nesting(file_path: str) -> None

Imports a BTL file for nesting.

Parameters:

Name Type Description Default
file_path str

The input file path.

required

import_bxf_file(file_path: str, insert_position: point_3d) -> list[ElementId]

Imports a BXF file.

Parameters:

Name Type Description Default
file_path str

The import file path.

required
insert_position point_3d

The position where the imported elements will be inserted.

required

Returns:

Type Description
list[ElementId]

The list of IDs of the imported elements.

import_element_light(file_path: str, insert_position: point_3d) -> int

Imports a light element from a file.

Parameters:

Name Type Description Default
file_path str

The import file path.

required
insert_position point_3d

The position where the imported light element will be inserted.

required

Returns:

Type Description
int

The ID of the imported light element.

import_rhino_file(file_path: str, without_dialog: bool) -> list[ElementId]

Imports a Rhino file.

Parameters:

Name Type Description Default
file_path str

The input file path.

required
without_dialog bool

Import without dialog?

required

Returns:

Type Description
list[ElementId]

The imported list of element id.

import_sat_file(file_path: str, scale_factor: float, binary: bool) -> list[ElementId]

Imports an SAT file.

Parameters:

Name Type Description Default
file_path str

The input file path.

required
scale_factor float

The scale factor.

required
binary bool

Is the import file binary.

required

Returns:

Type Description
list[ElementId]

The imported list of element id.

import_sat_file_silently(file_path: str, scale_factor: float, binary: bool) -> list[ElementId]

Imports a SAT File without messages.

Parameters:

Name Type Description Default
file_path str

The input file path.

required
scale_factor float

The scale factor.

required
binary bool

Is the import file binary.

required

Returns:

Type Description
list[ElementId]

The imported list of element id.

import_step_file(file_path: str, scale_factor: float) -> list[ElementId]

Imports a STEP file.

Parameters:

Name Type Description Default
file_path str

The input file path.

required
scale_factor float

The file scale factor.

required

Returns:

Type Description
list[ElementId]

The imported list of element id.

import_step_file_with_message_option(file_path: str, scale_factor: float, hide_message: bool) -> list[ElementId]

Imports a STEP file with message option.

Parameters:

Name Type Description Default
file_path str

The input file path.

required
scale_factor float

The file scale factor.

required
hide_message bool

Hide message.

required

Returns:

Type Description
list[ElementId]

The imported list of element id.

import_variant_file(file_path: str, insert_position: point_3d) -> list[ElementId]

Imports a variant (.val-File).

Parameters:

Name Type Description Default
file_path str

The import file path.

required
insert_position point_3d

The position where the imported variant elements will be inserted.

required

Returns:

Type Description
list[ElementId]

The imported list of element id.

load_webgl_preset_file(file_path: str) -> None

Loads a preset file for the WebGl export.

Parameters:

Name Type Description Default
file_path str

The preset file path.

required

set_blum_export_path(path: str) -> None

Sets the path of the Blum export.

Parameters:

Name Type Description Default
path str

The new path for the Blum export.

required

set_webgl_hierarchy(stage: int, attribute: display_attribute) -> None

Sets the WebGL hierarchy based on the given stage and attribute.

Parameters:

Name Type Description Default
stage int

The hierarchy stage to set.

required
attribute display_attribute

The display attribute to use for the hierarchy.

required

Exports the elements to BIMteam and creates a share link.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element id to export.

required

Returns:

Type Description
bim_team_upload_result

The result object with a result code and a share link. If the code is not ok (0), the share link string is empty.