* Show more info on hover for variables Signed-off-by: Nick Cameron <nrc@ncameron.org> * Move hover impls to lsp module Signed-off-by: Nick Cameron <nrc@ncameron.org> * Make hover work on names inside calls, fix doc line breaking, trim docs in tool tips Signed-off-by: Nick Cameron <nrc@ncameron.org> * Test the new hovers; fix signature syntax Signed-off-by: Nick Cameron <nrc@ncameron.org> * Hover tips for kwargs Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
81 lines
486 KiB
Markdown
81 lines
486 KiB
Markdown
---
|
|
title: "import"
|
|
excerpt: "Import a CAD file."
|
|
layout: 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.
|
|
|
|
```js
|
|
import(
|
|
filePath: String,
|
|
options?: ImportFormat,
|
|
): ImportedGeometry
|
|
```
|
|
|
|
|
|
### Arguments
|
|
|
|
| Name | Type | Description | Required |
|
|
|----------|------|-------------|----------|
|
|
| `filePath` | `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
|
|
model = import("tests/inputs/cube.obj")
|
|
```
|
|
|
|

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

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

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

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

|
|
|
|
```js
|
|
import height, buildSketch from "common.kcl"
|
|
|
|
plane = 'XZ'
|
|
margin = 2
|
|
s1 = buildSketch(plane, [0, 0])
|
|
s2 = buildSketch(plane, [0, height() + margin])
|
|
```
|
|
|
|

|
|
|
|
|