* fix docs paths for website Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix docs paths for website Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
62 lines
453 KiB
Markdown
62 lines
453 KiB
Markdown
---
|
|
title: "import"
|
|
excerpt: "Import a CAD file."
|
|
layout: 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.
|
|
|
|
```js
|
|
import(file_path: String, options?: ImportFormat) -> ImportedGeometry
|
|
```
|
|
|
|
|
|
### Arguments
|
|
|
|
| Name | Type | Description | Required |
|
|
|----------|------|-------------|----------|
|
|
| `file_path` | `String` | | Yes |
|
|
| `options` | [`ImportFormat`](/docs/kcl/types/ImportFormat) | Import format specifier | No |
|
|
|
|
### Returns
|
|
|
|
[`ImportedGeometry`](/docs/kcl/types/ImportedGeometry) - Data for an imported geometry.
|
|
|
|
|
|
### Examples
|
|
|
|
```js
|
|
const model = import("tests/inputs/cube.obj")
|
|
```
|
|
|
|

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

|
|
|
|
```js
|
|
const model = import("tests/inputs/cube.gltf")
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
const model = import("tests/inputs/cube.sldprt")
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
const model = import("tests/inputs/cube.step")
|
|
```
|
|
|
|

|
|
|
|
|