* Parse more import syntax Signed-off-by: Nick Cameron <nrc@ncameron.org> * Remove unnecessary Vec from VariableDeclaration Signed-off-by: Nick Cameron <nrc@ncameron.org> * Parse export import Signed-off-by: Nick Cameron <nrc@ncameron.org> * Factor out an execution module Signed-off-by: Nick Cameron <nrc@ncameron.org> * imports: constants, globs, export import Signed-off-by: Nick Cameron <nrc@ncameron.org> * test fixups Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
485 KiB
485 KiB
title, excerpt, layout
title | excerpt | layout |
---|---|---|
import | Import a CAD file. | manual |
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.
For importing KCL functions using the import
statement, see the docs on KCL modules.
import(file_path: String, options?: ImportFormat) -> ImportedGeometry
Arguments
Name | Type | Description | Required |
---|---|---|---|
file_path |
String |
Yes | |
options |
ImportFormat |
Import format specifier | No |
Returns
ImportedGeometry
- Data for an imported geometry.
Examples
model = import("tests/inputs/cube.obj")
model = import("tests/inputs/cube.obj", { format = "obj", units = "m" })
model = import("tests/inputs/cube.gltf")
model = import("tests/inputs/cube.sldprt")
model = import("tests/inputs/cube.step")
import height, buildSketch from "common.kcl"
plane = 'XZ'
margin = 2
s1 = buildSketch(plane, [0, 0])
s2 = buildSketch(plane, [0, height() + margin])