kcl

import

Import a CAD file.

For formats lacking unit data (such as STL, OBJ, or PLY files), the default unit of measurement is millimeters. Alternatively you may specify the unit by passing your desired measurement unit in the options parameter. When importing a GLTF file, the bin file will be imported as well. Import paths are relative to the current project directory.

Note: The import command currently only works when using the native Modeling App.

import(file_path: String, options?: ImportFormat) -> ImportedGeometry

Arguments

NameTypeDescriptionRequired
file_pathStringYes
optionsImportFormatImport format specifierNo

Returns

ImportedGeometry - Data for an imported geometry.

Examples

model = import("tests/inputs/cube.obj")

Rendered example of import 0

model = import("tests/inputs/cube.obj", { type: "obj", units: "m" })

Rendered example of import 1

model = import("tests/inputs/cube.gltf")

Rendered example of import 2

model = import("tests/inputs/cube.sldprt")

Rendered example of import 3

model = import("tests/inputs/cube.step")

Rendered example of import 4