Files
modeling-app/docs/kcl/import.md
Nick Cameron e8feb0309b Automatic fixing of deprecations and use non-quoted default planes by default (#5902)
* Automatic fixing of deprecations and use non-quoted default planes by default

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-21 09:39:12 +00:00

486 KiB

title, excerpt, layout
title excerpt layout
import Import a CAD file. manual

WARNING: This function is deprecated.

Import a CAD file.

DEPRECATED Prefer to use import statements.

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(
  filePath: String,
  options?: ImportFormat,
): ImportedGeometry

Arguments

Name Type Description Required
filePath String Yes
options ImportFormat Import format specifier No

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", { format = "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

import height, buildSketch from "common.kcl"

plane = XZ
margin = 2
s1 = buildSketch(plane, [0, 0])
s2 = buildSketch(plane, [0, height() + margin])

Rendered example of import 5