Compare commits

...

22 Commits

Author SHA1 Message Date
c2dd4d1d2e Same hotkey for center rect and center circle (#6642)
Removed hotkey on center rectangle, seems less common than corner rectangle. Happy to be chalenged. Fixes #6634.
2025-05-02 04:59:33 -04:00
6866c9d418 Fix bad links in docs code blocks (#6649)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-02 16:00:27 +12:00
819ee23565 Fix to cache correct PathToNode in artifact graph (#6632)
* Add NodePath to artifact graph

Since this is cached, this should make PathToNode computation correct
even when code is formatted, whitespace changes, and source ranges
are different.

* Remove dead code

* Add unit tests

* Add tests for PathToNode conversion

* Remove unused parameter

* Add missing PathToNode cases

* Fix to handle unlabeled arg

* Cherry pick unlabeled arg fix

* Change PathToNode comment to match TS implementation
2025-05-01 23:55:12 -04:00
02a37e207f Rust ci uses dev (#6643)
* point rust tests at dev too

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* point python tests at dev

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-05-02 00:13:16 +00:00
7356af556a add million lint in dev mode (#6162)
add million lint

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-05-01 22:35:55 +00:00
88288c3979 Fix layout shift on home page, fix narrow screen layout (#6631)
* Fix layout shift on home page, fix narrow screen layout

* LINTS
2025-05-01 21:41:13 +00:00
763b05e2e6 Fix the generate docs action (#6638)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-01 21:28:47 +00:00
39351aed58 Wrong case in no-projects copy on homepage (#6636)
Fixes #6635
2025-05-01 18:51:12 +00:00
e8e7c22b95 #6457 Disable sharing for multi-file AST (#6583)
* disable ShareButton if AST uses import statement

* remove unused code

* add e2e test for ShareButton disabled in multi-file projects
2025-05-01 14:01:08 -04:00
ad975152c1 Update readme logo (#6573)
* pierremtb/adhoc/readme-logo-update

* Change to just cropping
2025-05-01 13:43:09 -04:00
ed406734a7 [Feature]: Initialize engine with view_isometric as a user. (#6604)
* feature: initialize system to view_isometric, playwright(e2e) does zoom_to_fit

* fix: PR fixes

* fix: removing testing code

* fix: I definitely bricked my .spacemacs config and it is using the wrong eslint when I save files :(

* fix: typo

* fix: typoos

* fix: fuking hack

* chore: move exported var from e2e to src then reimport

* fix: got em

* fix: remove console log

* fix: how did this get in that file?? moved it

* fix: location for scene empty check zzz:

* fix: removed debugging code

* fix: forgot the hack for the load view without geometry workflow

* fix: copy
2025-05-01 13:42:44 -04:00
89bae66257 KCL: User-defined KCL functions in examples etc now use keywords (#6603)
Preparing for the removal of positional functions from the language. The first big step is to change all our KCL code examples, test code, public samples etc to all use keyword functions.

Apologies for how large this PR is. Most of it is:

- Changing example KCL that defined its own functions, so the functions now use keyword arguments rather than positional arguments. E.g. change `cube([20, 20])` to be `cube(center = [20, 20])`.
- Some parts of the code assumed positional code and didn't handle keyword calls, e.g. the linter would only check for positional calls to startSketchOn. Now they should work with either positional or keyword.
- Update all the artifacts

This does _not_ remove support for positional calls. That will be in a follow-up PR.
2025-05-01 12:36:51 -04:00
16f5d9c284 Docs improvements (#6615)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-01 08:56:27 -07:00
00148d84d8 Ignore the new Debug message (#6627)
Ignore the new Debug message
2025-05-01 08:55:52 -07:00
390cedf79f Update dependabot config (#6616)
Update dependabot config from KittyCAD/ciso
2025-05-01 15:32:02 +02:00
b686c79b49 More lsp endpoints we were missing (#6612)
* add prepare rename

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* add document color

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>
2025-05-01 02:47:36 +00:00
2d77aa0d36 Revert "Make onboarding optional, able to be ignored on desktop" (#6610)
Revert "Make onboarding optional, able to be ignored on desktop (#6564)"

This reverts commit 820082d7f2.
2025-04-30 21:58:11 -04:00
012102fe86 enhance the signature help (#6606)
update with test

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-04-30 20:58:46 +00:00
1a6b147107 Fix to not double import math in the prelude (#6605) 2025-04-30 19:49:55 +00:00
2978b34b7b Skip TAB-disabled tests locally by default (#6601) 2025-04-30 15:32:37 -04:00
dee77e814a remove rust bw compatible settings (#6085)
regenerate the settings docs



cleanup

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-04-30 19:00:37 +00:00
820082d7f2 Make onboarding optional, able to be ignored on desktop (#6564)
* Remove unused `telemetryLoader`

* Remove onboarding redirect behavior

* Allow subRoute to be passed to navigateToProject

* Replace warning dialog routes with toasts

* Wire up new utilities and toasts to UI components

* Add home sidebar buttons for tutorial flow

* Rename menu item

* Add flex-1 so home-layout fills available space

* Remove onboarding avatar tests, they are becoming irrelevant

* Consolidate onboarding tests to one longer one

and update it to not use pixel color checks, and use fixtures.

* Shorten warning toast button text

* tsc, lint, and circular deps

* Update circular dep file

* Fix mistakes made in circular update tweaking

* One more dumb created circular dep

* Update src/routes/Onboarding/utils.tsx

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>

* Fix narrow screen home layout breaking

* fix: kevin, navigation routes fixed

* fix: filename parsing is correct now for onboarding with the last file sep

* Fix e2e test state checks that are diff on Linux

* Create onboarding project entirely through systemIOMachine

* Fix Windows path construction

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Kevin Nadro <kevin@zoo.dev>
2025-04-30 14:43:51 -04:00
582 changed files with 38507 additions and 25351 deletions

View File

@ -7,11 +7,11 @@ if [[ ! -f "test-results/.last-run.json" ]]; then
# If no last run artifact, than run Playwright normally
echo "run playwright normally"
if [[ "$3" == *ubuntu* ]]; then
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:playwright:electron:ubuntu -- --shard=$1/$2 || true
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:playwright:electron -- --shard=$1/$2 || true
elif [[ "$3" == *windows* ]]; then
npm run test:playwright:electron:windows -- --shard=$1/$2 || true
npm run test:playwright:electron -- --grep=@windows --shard=$1/$2 || true
elif [[ "$3" == *macos* ]]; then
npm run test:playwright:electron:macos -- --shard=$1/$2 || true
npm run test:playwright:electron -- --grep=@macos --shard=$1/$2 || true
else
echo "Do not run Playwright. Unable to detect os runtime."
exit 1
@ -31,11 +31,11 @@ while [[ $retry -le $max_retries ]]; do
echo "retried=true" >>$GITHUB_OUTPUT
echo "run playwright with last failed tests and retry $retry"
if [[ "$3" == *ubuntu* ]]; then
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:playwright:electron:ubuntu -- --last-failed || true
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:playwright:electron -- --last-failed || true
elif [[ "$3" == *windows* ]]; then
npm run test:playwright:electron:windows -- --last-failed || true
npm run test:playwright:electron -- --grep=@windows --last-failed || true
elif [[ "$3" == *macos* ]]; then
npm run test:playwright:electron:macos -- --last-failed || true
npm run test:playwright:electron -- --grep=@macos --last-failed || true
else
echo "Do not run playwright. Unable to detect os runtime."
exit 1

441
.github/dependabot.yml vendored
View File

@ -16,9 +16,12 @@ updates:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
@ -49,9 +52,408 @@ updates:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: cargo
directory: /rust/kcl-python-bindings
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: cargo
directory: /rust/kcl-to-core
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: cargo
directory: /rust/kcl-language-server-release
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: cargo
directory: /rust/kcl-wasm-lib
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: cargo
directory: /rust/kcl-derive-docs
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: cargo
directory: /rust/kcl-bumper
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: cargo
directory: /rust/kcl-language-server
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: cargo
directory: /rust/kcl-lib
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: cargo
directory: /rust/kcl-lib/fuzz
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: cargo
directory: /rust/kcl-test-server
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: cargo
directory: /rust/kcl-directory-test-macro
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
@ -82,9 +484,12 @@ updates:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
@ -115,9 +520,12 @@ updates:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
@ -148,9 +556,12 @@ updates:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
@ -181,9 +592,12 @@ updates:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
@ -214,9 +628,12 @@ updates:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
@ -247,9 +664,12 @@ updates:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:
@ -280,9 +700,12 @@ updates:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
security-major:
applies-to: security-updates
update-types:
- major
patch:
applies-to: version-updates
update-types:

View File

@ -86,7 +86,8 @@ jobs:
cd rust
cargo nextest run --workspace --features artifact-graph --retries=2 --no-fail-fast --profile ci simulation_tests::kcl_samples 2>&1 | tee /tmp/github-actions.log
env:
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN_DEV}}
ZOO_HOST: https://api.dev.zoo.dev
RUST_BACKTRACE: full
- name: Commit differences
if: steps.path-changes.outputs.outside-kcl-samples == 'false' && steps.cargo-test-kcl-samples.outcome == 'failure'
@ -116,7 +117,8 @@ jobs:
env:
# The default is auto, and insta behaves differently in CI vs. not.
INSTA_UPDATE: always
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN_DEV}}
ZOO_HOST: https://api.dev.zoo.dev
# Configure nextest when it's run by insta (via just).
NEXTEST_PROFILE: ci
RUST_BACKTRACE: full
@ -182,5 +184,6 @@ jobs:
--partition count:${{ matrix.partitionIndex}}/${{ matrix.partitionTotal }} \
2>&1 | tee /tmp/github-actions.log
env:
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN_DEV}}
ZOO_HOST: https://api.dev.zoo.dev

View File

@ -40,13 +40,15 @@ jobs:
# cleanup old
rm -rf documentation/content/pages/docs/kcl/*.md
rm -rf documentation/content/pages/docs/kcl/types
rm -rf documentation/content/pages/docs/kcl/settings
rm -rf documentation/content/pages/docs/kcl/functions
rm -rf documentation/content/pages/docs/kcl/consts
# move new
mv -f docs/kcl/*.md documentation/content/pages/docs/kcl/
mv -f docs/kcl/types documentation/content/pages/docs/kcl/
mv -f docs/kcl/settings documentation/content/pages/docs/kcl/
mv -f docs/kcl/functions documentation/content/pages/docs/kcl/
mv -f docs/kcl/consts documentation/content/pages/docs/kcl/
# We don't need the README
rm documentation/content/pages/docs/kcl/README.md
- name: move kcl-samples
shell: bash
run: |

View File

@ -125,7 +125,8 @@ jobs:
just setup-uv
just test
env:
KITTYCAD_API_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN }}
KITTYCAD_API_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
ZOO_HOST: https://api.dev.zoo.dev
sdist:
runs-on: ubuntu-latest

1
.gitignore vendored
View File

@ -85,3 +85,4 @@ venv
.vscode-test
.biome/
.million

View File

@ -0,0 +1,26 @@
---
title: "KCL Known Issues"
excerpt: "Known issues with the KCL standard library for the Zoo Design Studio."
layout: manual
---
The following are bugs that are not in modeling-app or kcl itself. These bugs
once fixed in engine will just start working here with no language changes.
- **Sketch on Face**: If your sketch is outside the edges of the face (on which you
are sketching) you will get multiple models returned instead of one single
model for that sketch and its underlying 3D object.
If you see a red line around your model, it means this is happening.
- **Import**: Right now you can import a file, even if that file has brep data
you cannot edit it, after v1, the engine will account for this.
- **Fillets**: Fillets cannot intersect, you will get an error. Only simple fillet
cases work currently.
- **Chamfers**: Chamfers cannot intersect, you will get an error. Only simple
chamfer cases work currently.
- **Appearance**: Changing the appearance on a loft does not work.
- **CSG Booleans**: Coplanar (bodies that share a plane) unions, subtractions, and intersections are not currently supported.

365
docs/kcl-src/modules.md Normal file
View File

@ -0,0 +1,365 @@
---
title: "KCL Modules"
excerpt: "Documentation of modules for the KCL language for the Zoo Design Studio."
layout: manual
---
`KCL` allows splitting code up into multiple files. Each file is somewhat
isolated from other files as a separate module.
When you define a function, you can use `export` before it to make it available
to other modules.
```kcl
// util.kcl
export fn increment(@x) {
return x + 1
}
```
Other files in the project can now import functions that have been exported.
This makes them available to use in another file.
```norun
// main.kcl
import increment from "util.kcl"
answer = increment(41)
```
Imported files _must_ be in the same project so that units are uniform across
modules. This means that it must be in the same directory.
Import statements must be at the top-level of a file. It is not allowed to have
an `import` statement inside a function or in the body of an ifelse.
Multiple functions can be exported in a file.
```kcl
// util.kcl
export fn increment(@x) {
return x + 1
}
export fn decrement(@x) {
return x - 1
}
```
When importing, you can import multiple functions at once.
```norun
import increment, decrement from "util.kcl"
```
Imported symbols can be renamed for convenience or to avoid name collisions.
```norun
import increment as inc, decrement as dec from "util.kcl"
```
---
## Functions vs `clone`
There are two common patterns for reusing geometry:
1. **Wrap the construction in a function** flexible and fully parametric.
2. **Duplicate an existing object with `clone`** lightningfast, but an exact
duplicate.
### Parametric function example
```kcl
fn cube(center) {
return startSketchOn(XY)
|> startProfile(at = [center[0] - 10, center[1] - 10])
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
|> line(endAbsolute = [center[0] - 10, center[1] + 10])
|> close()
|> extrude(length = 10)
}
myCube = cube(center = [0, 0])
```
*Pros*
- Any argument can be a parameter size, position, appearance, etc.
- Works great inside loops, arrays, or optimisation sweeps.
*Cons*
- Every invocation rebuilds the entire feature tree.
- **Slower** than a straight duplicate each call is its own render job.
### `clone` example
```kcl
sketch001 = startSketchOn(-XZ)
|> circle(center = [0, 0], radius = 10)
|> extrude(length = 5)
|> appearance(color = "#ff0000", metalness = 90, roughness = 90)
sketch002 = clone(sketch001) // ✓ instant copy
```
*Pros*
- Roughly an O(1) operation we just duplicate the underlying engine handle.
- Perfect when you need ten identical bolts or two copies of the same imported STEP file.
*Cons*
- **Not parametric** the clone is exactly the same shape as the source.
- If you need to tweak dimensions perinstance, youre back to a function.
> **Rule of thumb** Reach for `clone` when the geometry is already what you want. Reach for a function when you need customisation.
---
## Modulelevel parallelism
Under the hood, the Design Studio runs **every module in parallel** where it can. This means:
- The toplevel code of `foo.kcl`, `bar.kcl`, and `baz.kcl` all start executing immediately and concurrently.
- Imports that read foreign files (STEP/OBJ/…) overlap their I/O and background render.
- CPUbound calculations in separate modules get their own worker threads.
### Why modules beat onebigfile
If you shoehorn everything into `main.kcl`, each statement runs sequentially:
```norun
import "big.step" as gizmo // blocks main while reading
gizmo |> translate(x=50) // blocks again while waiting for render
```
Split `gizmo` into its own file and the read/render can overlap whatever else `main.kcl` is doing.
```norun
// gizmo.kcl (worker A)
import "big.step"
// main.kcl (worker B)
import "gizmo.kcl" as gizmo // nonblocking
// ... other setup ...
gizmo |> translate(x=50) // only blocks here
```
### Gotcha: defining but **not** calling functions
Defining a function inside a module is instantaneous we just record the bytecode. The heavy lifting happens when the function is **called**. So:
```norun
// util.kcl
export fn makeBolt(size) { /* … expensive CAD … */ }
```
If `main.kcl` waits until the very end to call `makeBolt`, *none* of that work was parallelised youve pushed the cost back onto the serial tail of your script.
**Better:** call it early or move the invocation into another module.
```norun
// bolt_instance.kcl
import makeBolt from "util.kcl"
bolt = makeBolt(5) // executed in parallel
bolt
```
Now `main.kcl` can `import "bolt_instance.kcl" as bolt` and get the result that was rendered while it was busy doing other things.
---
## Whole module import
You can also import the whole module. This is useful if you want to use the
result of a module as a variable, like a part.
```norun
import "tests/inputs/cube.kcl" as cube
cube
|> translate(x=10)
```
This imports the whole module and makes it available as `cube`. You can then
use it like any other object. The `cube` variable is now a reference to the
result of the module. This means that if you change the module, the `cube`
variable will change as well.
In `cube.kcl`, you cannot have multiple objects. It has to be a single part. If
you have multiple objects, you will get an error. This is because the module is
expected to return a single object that can be used as a variable.
The last expression or variable definition becomes the module's return value.
The module is expected to return a single object that can be used as a variable
by whatever imports it.
So for example, this is allowed:
```norun
... a bunch of code to create cube and cube2 ...
myUnion = union([cube, cube2])
```
You can also do this:
```norun
... a bunch of code to create cube and cube2 ...
union([cube, cube2])
```
Either way, the last line will return the union of the two objects.
Or what you could do instead is:
```norun
... a bunch of code to create cube and cube2 ...
myUnion = union([cube, cube2])
myUnion
```
This will assign the union of the two objects to a variable, and then return it
on the last statement. It's simply another way of doing the same thing.
The final statement is what's important because it's the return value of the
entire module. The module is expected to return a single object that can be used
as a variable by the file that imports it.
---
## Multiple instances of the same import
Whether you are importing a file from another CAD system or a KCL file, that
file represents object(s) in memory. If you import the same file multiple times,
it will only be rendered once.
If you want to have multiple instances of the same object, you can use the
[`clone`](/docs/kcl/clone) function. This will render a new instance of the object in memory.
```norun
import cube from "tests/inputs/cube.kcl"
cube
|> translate(x=10)
clone(cube)
|> translate(x=20)
```
In the sample above, the `cube` object is imported from a KCL file. The first
instance is translated 10 units in the x direction. The second instance is
cloned and translated 20 units in the x direction. The two instances are now
separate objects in memory, and can be manipulated independently.
Here is an example with a file from another CAD system:
```kcl
import "tests/inputs/cube.step" as cube
cube
|> translate(x=10)
clone(cube)
|> translate(x=20)
```
---
## Importing files from other CAD systems
`import` can also be used to import files from other CAD systems. The format of the statement is the
same as for KCL files. You can only import the whole file, not items from it. E.g.,
```norun
import "tests/inputs/cube.obj"
// Use `cube` just like a KCL object.
```
```kcl
import "tests/inputs/cube.sldprt" as cube
// Use `cube` just like a KCL object.
```
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 using an attribute. Likewise, you can also specify a coordinate system. E.g.,
```kcl
@(lengthUnit = ft, coords = opengl)
import "tests/inputs/cube.obj"
```
When importing a GLTF file, the bin file will be imported as well.
Import paths are relative to the current project directory. Imports currently only work when
using the native Design Studio, not in the browser.
### Supported values
File formats: `fbx`, `gltf`/`glb`, `obj`+, `ply`+, `sldprt`, `step`/`stp`, `stl`+. (Those marked with a
'+' support customising the length unit and coordinate system).
Length units: `mm` (the default), `cm`, `m`, `inch`, `ft`, `yd`.
Coordinate systems:
- `zoo` (the default), forward: -Y, up: +Z, handedness: right
- `opengl`, forward: +Z, up: +Y, handedness: right
- `vulkan`, forward: +Z, up: -Y, handedness: left
---
## Performance deepdive for foreignfile imports
Parallelized foreignfile imports now let you overlap file reads, initialization,
and rendering. To maximize throughput, you need to understand the three distinct
stages—reading, initializing (background render start), and invocation (blocking)
—and structure your code to defer blocking operations until the end.
### Foreign import execution stages
1. **Import (Read / Initialization) Stage**
```kcl
import "tests/inputs/cube.step" as cube
```
- Reads the file from disk and makes its API available.
- Starts engine rendering but **does not block** your script.
- This kickstarts the render pipeline while you keep executing other code.
2. **Invocation (Blocking) Stage**
```kcl
import "tests/inputs/cube.step" as cube
cube
|> translate(z=10) // ← blocks here only
```
- Any method call (e.g., `translate`, `scale`, `rotate`) waits for the background render to finish before applying transformations.
### Best practices
#### 1. Defer blocking calls
```kcl
import "tests/inputs/cube.step" as cube // 1) Read / Background render starts
// --- perform other operations and calculations here ---
cube
|> translate(z=10) // 2) Blocks only here
```
#### 2. Split heavy work into separate modules
Place computationally expensive or IOheavy work into its own module so it can render in parallel while `main.kcl` continues.
#### Future improvements
Upcoming releases will autoanalyse dependencies and only block when truly necessary. Until then, explicit deferral will give you the best performance.

45
docs/kcl-src/settings.md Normal file
View File

@ -0,0 +1,45 @@
---
title: "KCL Settings"
excerpt: "Documentation of settings for the KCL language and Zoo Design Studio."
layout: manual
---
# KCL Settings
There are three levels of settings available in Zoo Design Studio:
1. [User Settings](/docs/kcl/settings-user): Global settings that apply to all projects, stored in `user.toml`
2. [Project Settings](/docs/kcl/settings-project): Settings specific to a project, stored in `project.toml`
3. Per-file Settings: Settings that apply to a single KCL file, specified using the `@settings` attribute
## Configuration Files
Zoo Design Studio uses TOML files for configuration:
* **User Settings**: `user.toml` - See [complete documentation](/docs/kcl/settings-user)
* **Project Settings**: `project.toml` - See [complete documentation](/docs/kcl/settings-project)
## Per-file settings
Settings which affect a single file are configured using the settings attribute.
This must be at the top of the KCL file (comments before the attribute are permitted).
For example:
```kcl
// The settings attribute.
@settings(defaultLengthUnit = in)
// The rest of your KCL code goes below...
x = 42 // Represents 42 inches.
```
The settings attribute may contain multiple properties separated by commas.
Valid properties are:
- `defaultLengthUnit`: the default length unit to use for numbers declared in this file.
- Accepted values: `mm`, `cm`, `m`, `in` (inches), `ft` (feet), `yd` (yards).
- `defaultAngleUnit`: the default angle unit to use for numbers declared in this file.
- Accepted values: `deg` (degrees), `rad` (radians).
These settings override any project-wide settings (configured in project.toml or via the UI).

299
docs/kcl-src/types.md Normal file
View File

@ -0,0 +1,299 @@
---
title: "KCL Types"
excerpt: "Documentation of types for the KCL standard library for the Zoo Design Studio."
layout: manual
---
`KCL` defines the following types and keywords the language.
All these types can be nested in various forms where nesting applies. Like
arrays can hold objects and vice versa.
## Constant declaration
Constants are defined with a name and a value, like so:
```
myBool = false
```
Currently you cannot redeclare a constant.
## Arrays
An array is defined with `[]` braces. What is inside the brackets can
be of any type. For example, the following is completely valid:
```
myArray = ["thing", 2, false]
```
If you want to get a value from an array you can use the index like so:
`myArray[0]`.
## Objects
An object is defined with `{}` braces. Here is an example object:
```
myObj = { a = 0, b = "thing" }
```
We support two different ways of getting properties from objects, you can call
`myObj.a` or `myObj["a"]` both work.
## `ImportedGeometry`
Using `import` you can import geometry defined using other CAD software. In KCL,
these objects have type `ImportedGeometry` and can mostly be treated like any
other solid (they can be rotated, scaled, etc.), although there is no access to
their internal components. See the [modules and imports docs](modules) for more
detail on importing geometry.
## Binary expressions
You can also do math! Let's show an example below:
```
myMathExpression = 3 + 1 * 2 / 3 - 7
```
You can nest expressions in parenthesis as well:
```
myMathExpression = 3 + (1 * 2 / (3 - 7))
```
## Functions
We also have support for defining your own functions. Functions can take in any
type of argument. Below is an example of the syntax:
```
fn myFn(x) {
return x
}
```
As you can see above `myFn` just returns whatever it is given.
KCL's early drafts used positional arguments, but we now use keyword arguments:
```
// If you declare a function like this
fn add(left, right) {
return left + right
}
// You can call it like this:
total = add(left = 1, right = 2)
```
Functions can also declare one *unlabeled* arg. If you do want to declare an unlabeled arg, it must
be the first arg declared.
```
// The @ indicates an argument can be used without a label.
// Note that only the first argument can use @.
fn increment(@x) {
return x + 1
}
fn add(@x, delta) {
return x + delta
}
two = increment(1)
three = add(1, delta = 2)
```
## Pipelines
It can be hard to read repeated function calls, because of all the nested brackets.
```norun
i = 1
x = h(g(f(i)))
```
You can make this easier to read by breaking it into many declarations, but that is a bit annoying.
```norun
i = 1
x0 = f(i)
x1 = g(x0)
x = h(x1)
```
Instead, you can use the pipeline operator (`|>`) to simplify this.
Basically, `x |> f(%)` is a shorthand for `f(x)`. The left-hand side of the `|>` gets put into
the `%` in the right-hand side.
So, this means `x |> f(%) |> g(%)` is shorthand for `g(f(x))`. The code example above, with its
somewhat-clunky `x0` and `x1` constants could be rewritten as
```norun
i = 1
x = i
|> f(%)
|> g(%)
|> h(%)
```
This helps keep your code neat and avoid unnecessary declarations.
## Pipelines and keyword arguments
Say you have a long pipeline of sketch functions, like this:
```norun
startSketchOn(XZ)
|> line(%, end = [3, 4])
|> line(%, end = [10, 10])
|> line(%, end = [-13, -14])
|> close(%)
```
In this example, each function call outputs a sketch, and it gets put into the next function call via
the `%`, into the first (unlabeled) argument.
If a function call uses an unlabeled first parameter, it will default to `%` if it's not given. This
means that `|> line(%, end = [3, 4])` and `|> line(end = [3, 4])` are equivalent! So the above
could be rewritten as
```norun
startSketchOn(XZ)
|> line(end = [3, 4])
|> line(end = [10, 10])
|> line(end = [-13, -14])
|> close()
```
Note that we are still in the process of migrating KCL's standard library to use keyword arguments. So some
functions are still unfortunately using positional arguments. We're moving them over, so keep checking back.
Some functions are still using the old positional argument syntax.
Check the docs page for each function and look at its examples to see.
## Tags
Tags are used to give a name (tag) to a specific path.
### `TagDeclarator`
The syntax for declaring a tag is `$myTag` you would use it in the following
way:
```norun
startSketchOn(XZ)
|> startProfile(at = origin)
|> angledLine(angle = 0, length = 191.26, tag = $rectangleSegmentA001)
|> angledLine(
angle = segAng(rectangleSegmentA001) - 90,
length = 196.99,
tag = $rectangleSegmentB001,
)
|> angledLine(
angle = segAng(rectangleSegmentA001),
length = -segLen(rectangleSegmentA001),
tag = $rectangleSegmentC001,
)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
```
### `TagIdentifier`
As per the example above you can use the tag identifier to get a reference to the
tagged object. The syntax for this is `myTag`.
In the example above we use the tag identifier to get the angle of the segment
`segAng(rectangleSegmentA001, %)`.
### `Start`
There is a special tag, `START` (with type `Start`, although under the cover, it's a string)
for identifying the face of a solid which was the start of an extrusion (i.e., the surface which
is extruded).
### `End`
There is a special tag, `END` (with type `End`, although under the cover, it's a string)
for identifying the face of a solid which was finishes an extrusion.
### Tag Scope
Tags are scoped globally if in the root context meaning in this example you can
use the tag `rectangleSegmentA001` in any function or expression in the file.
However if the code was written like this:
```norun
fn rect(origin) {
return startSketchOn(XZ)
|> startProfile(at = origin)
|> angledLine(angle = 0, length = 191.26, tag = $rectangleSegmentA001)
|> angledLine(
angle = segAng(rectangleSegmentA001) - 90,
length = 196.99,
tag = $rectangleSegmentB001,
)
|> angledLine(
angle = segAng(rectangleSegmentA001),
length = -segLen(rectangleSegmentA001),
tag = $rectangleSegmentC001,
)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
}
rect(origin = [0, 0])
rect(origin = [20, 0])
```
Those tags would only be available in the `rect` function and not globally.
However you likely want to use those tags somewhere outside the `rect` function.
Tags are accessible through the sketch group they are declared in.
For example the following code works.
```norun
fn rect(origin) {
return startSketchOn(XZ)
|> startProfile(at = origin)
|> angledLine(angle = 0, length = 191.26, tag = $rectangleSegmentA001)
|> angledLine(
angle = segAng(rectangleSegmentA001) - 90,
length = 196.99,
tag = $rectangleSegmentB001,
)
|> angledLine(
angle = segAng(rectangleSegmentA001),
length = -segLen(rectangleSegmentA001),
tag = $rectangleSegmentC001,
)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
}
rect(origin = [0, 0])
myRect = rect(origin = [20, 0])
myRect
|> extrude(length = 10)
|> fillet(radius = 0.5, tags = [myRect.tags.rectangleSegmentA001])
```
See how we use the tag `rectangleSegmentA001` in the `fillet` function outside
the `rect` function. This is because the `rect` function is returning the
sketch group that contains the tags.
---
If you find any issues using any of the above expressions or syntax,
please file an issue with the `ast` label on the [modeling-app
repo](https://github.com/KittyCAD/modeling-app/issues/new).

5
docs/kcl/README.md Normal file
View File

@ -0,0 +1,5 @@
# Autogenerated docs
Everything in this directory and its subdirectories (except this file) is automatically generated. Do not edit anything in this directory directly, your changes will be lost.
The directory contents are generated by running the `test_generate_stdlib_markdown_docs` test in `/rust/kcl-lib/src/docs/gen_std_tests.rs`. Files are generated from the standard library declared in KCL (`/rust/kcl-lib/std`) and in Rust (`/rust/kcl-lib/src/std`), and by copying files from `../kcl-src`.

View File

@ -10,15 +10,15 @@ Draw a line segment relative to the current origin using the polar measure of so
```kcl
angledLine(
sketch: [Sketch](/docs/kcl/types/Sketch),
angle: [number](/docs/kcl/types/number),
length?: [number](/docs/kcl/types/number),
lengthX?: [number](/docs/kcl/types/number),
lengthY?: [number](/docs/kcl/types/number),
endAbsoluteX?: [number](/docs/kcl/types/number),
endAbsoluteY?: [number](/docs/kcl/types/number),
tag?: [TagDeclarator](/docs/kcl/types#tag-declaration),
): [Sketch](/docs/kcl/types/Sketch)
sketch: Sketch,
angle: number,
length?: number,
lengthX?: number,
lengthY?: number,
endAbsoluteX?: number,
endAbsoluteY?: number,
tag?: TagDeclarator,
): Sketch
```
@ -26,18 +26,18 @@ angledLine(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `angle` | [`number`](/docs/kcl/types/number) | Which angle should the line be drawn at? | Yes |
| `length` | [`number`](/docs/kcl/types/number) | Draw the line this distance along the given angle. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `lengthX` | [`number`](/docs/kcl/types/number) | Draw the line this distance along the X axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `lengthY` | [`number`](/docs/kcl/types/number) | Draw the line this distance along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `endAbsoluteX` | [`number`](/docs/kcl/types/number) | Draw the line along the given angle until it reaches this point along the X axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `endAbsoluteY` | [`number`](/docs/kcl/types/number) | Draw the line along the given angle until it reaches this point along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
| `sketch` | [`Sketch`](/docs/kcl/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
| `angle` | [`number`](/docs/kcl/types/std-types-number) | Which angle should the line be drawn at? | Yes |
| `length` | [`number`](/docs/kcl/types/std-types-number) | Draw the line this distance along the given angle. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `lengthX` | [`number`](/docs/kcl/types/std-types-number) | Draw the line this distance along the X axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `lengthY` | [`number`](/docs/kcl/types/std-types-number) | Draw the line this distance along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `endAbsoluteX` | [`number`](/docs/kcl/types/std-types-number) | Draw the line along the given angle until it reaches this point along the X axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `endAbsoluteY` | [`number`](/docs/kcl/types/std-types-number) | Draw the line along the given angle until it reaches this point along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| [`tag`](/docs/kcl/types/std-types-tag) | [`TagDeclarator`](/docs/kcl/types#TagDeclarator) | Create a new tag which refers to this line | No |
### Returns
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl/types/std-types-Sketch)
### Examples

View File

@ -10,12 +10,12 @@ Draw an angled line from the current origin, constructing a line segment such th
```kcl
angledLineThatIntersects(
sketch: [Sketch](/docs/kcl/types/Sketch),
angle: [number](/docs/kcl/types/number),
intersectTag: [TagIdentifier](/docs/kcl/types#tag-identifier),
offset?: [number](/docs/kcl/types/number),
tag?: [TagDeclarator](/docs/kcl/types#tag-declaration),
): [Sketch](/docs/kcl/types/Sketch)
sketch: Sketch,
angle: number,
intersectTag: TagIdentifier,
offset?: number,
tag?: TagDeclarator,
): Sketch
```
@ -23,15 +23,15 @@ angledLineThatIntersects(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `angle` | [`number`](/docs/kcl/types/number) | Which angle should the line be drawn at? | Yes |
| `intersectTag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The tag of the line to intersect with | Yes |
| `offset` | [`number`](/docs/kcl/types/number) | The offset from the intersecting line. Defaults to 0. | No |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
| `sketch` | [`Sketch`](/docs/kcl/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
| `angle` | [`number`](/docs/kcl/types/std-types-number) | Which angle should the line be drawn at? | Yes |
| `intersectTag` | [`TagIdentifier`](/docs/kcl/types#TagIdentifier) | The tag of the line to intersect with | Yes |
| `offset` | [`number`](/docs/kcl/types/std-types-number) | The offset from the intersecting line. Defaults to 0. | No |
| [`tag`](/docs/kcl/types/std-types-tag) | [`TagDeclarator`](/docs/kcl/types#TagDeclarator) | Create a new tag which refers to this line | No |
### Returns
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl/types/std-types-Sketch)
### Examples

View File

@ -10,11 +10,11 @@ This will work on any solid, including extruded solids, revolved solids, and she
```kcl
appearance(
solids: [[Solid](/docs/kcl/types/Solid)OrImportedGeometry](/docs/kcl/types/[Solid](/docs/kcl/types/Solid)OrImportedGeometry),
color: String,
metalness?: [number](/docs/kcl/types/number),
roughness?: [number](/docs/kcl/types/number),
): [[Solid](/docs/kcl/types/Solid)OrImportedGeometry](/docs/kcl/types/[Solid](/docs/kcl/types/Solid)OrImportedGeometry)
solids: [Solid] | ImportedGeometry,
color: string,
metalness?: number,
roughness?: number,
): [Solid] | ImportedGeometry
```
@ -22,14 +22,14 @@ appearance(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `solids` | [`SolidOrImportedGeometry`](/docs/kcl/types/SolidOrImportedGeometry) | The solid(s) whose appearance is being set | Yes |
| `color` | `String` | Color of the new material, a hex string like '#ff0000' | Yes |
| `metalness` | [`number`](/docs/kcl/types/number) | Metalness of the new material, a percentage like 95.7. | No |
| `roughness` | [`number`](/docs/kcl/types/number) | Roughness of the new material, a percentage like 95.7. | No |
| `solids` | [`[Solid]`](/docs/kcl/types/std-types-Solid) or [`ImportedGeometry`](/docs/kcl/types#ImportedGeometry) | The solid(s) whose appearance is being set | Yes |
| `color` | [`string`](/docs/kcl/types/std-types-string) | Color of the new material, a hex string like '#ff0000' | Yes |
| `metalness` | [`number`](/docs/kcl/types/std-types-number) | Metalness of the new material, a percentage like 95.7. | No |
| `roughness` | [`number`](/docs/kcl/types/std-types-number) | Roughness of the new material, a percentage like 95.7. | No |
### Returns
[`SolidOrImportedGeometry`](/docs/kcl/types/SolidOrImportedGeometry) - Data for a solid or an imported geometry.
[`[Solid]`](/docs/kcl/types/std-types-Solid) or [`ImportedGeometry`](/docs/kcl/types#ImportedGeometry) - Data for a solid or an imported geometry.
### Examples
@ -72,9 +72,9 @@ fn cube(center) {
|> extrude(length = 10)
}
example0 = cube([0, 0])
example1 = cube([20, 0])
example2 = cube([40, 0])
example0 = cube(center = [0, 0])
example1 = cube(center = [20, 0])
example2 = cube(center = [40, 0])
appearance(
[example0, example1],

View File

@ -12,14 +12,14 @@ Unless this makes a lot of sense and feels like what you're looking for to const
```kcl
arc(
sketch: [Sketch](/docs/kcl/types/Sketch),
angleStart?: [number](/docs/kcl/types/number),
angleEnd?: [number](/docs/kcl/types/number),
radius?: [number](/docs/kcl/types/number),
interiorAbsolute?: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
endAbsolute?: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
tag?: [TagDeclarator](/docs/kcl/types#tag-declaration),
): [Sketch](/docs/kcl/types/Sketch)
sketch: Sketch,
angleStart?: number,
angleEnd?: number,
radius?: number,
interiorAbsolute?: Point2d,
endAbsolute?: Point2d,
tag?: TagDeclarator,
): Sketch
```
@ -27,17 +27,17 @@ arc(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `angleStart` | [`number`](/docs/kcl/types/number) | Where along the circle should this arc start? | No |
| `angleEnd` | [`number`](/docs/kcl/types/number) | Where along the circle should this arc end? | No |
| `radius` | [`number`](/docs/kcl/types/number) | How large should the circle be? | No |
| `interiorAbsolute` | [`[number]`](/docs/kcl/types/number) | Any point between the arc's start and end? Requires `endAbsolute`. Incompatible with `angleStart` or `angleEnd` | No |
| `endAbsolute` | [`[number]`](/docs/kcl/types/number) | Where should this arc end? Requires `interiorAbsolute`. Incompatible with `angleStart` or `angleEnd` | No |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
| `sketch` | [`Sketch`](/docs/kcl/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
| `angleStart` | [`number`](/docs/kcl/types/std-types-number) | Where along the circle should this arc start? | No |
| `angleEnd` | [`number`](/docs/kcl/types/std-types-number) | Where along the circle should this arc end? | No |
| `radius` | [`number`](/docs/kcl/types/std-types-number) | How large should the circle be? | No |
| `interiorAbsolute` | [`Point2d`](/docs/kcl/types/std-types-Point2d) | Any point between the arc's start and end? Requires `endAbsolute`. Incompatible with `angleStart` or `angleEnd` | No |
| `endAbsolute` | [`Point2d`](/docs/kcl/types/std-types-Point2d) | Where should this arc end? Requires `interiorAbsolute`. Incompatible with `angleStart` or `angleEnd` | No |
| [`tag`](/docs/kcl/types/std-types-tag) | [`TagDeclarator`](/docs/kcl/types#TagDeclarator) | Create a new tag which refers to this line | No |
### Returns
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl/types/std-types-Sketch)
### Examples

View File

@ -10,14 +10,14 @@ Check a value meets some expected conditions at runtime. Program terminates with
```kcl
assert(
actual: [number](/docs/kcl/types/number),
isGreaterThan?: [number](/docs/kcl/types/number),
isLessThan?: [number](/docs/kcl/types/number),
isGreaterThanOrEqual?: [number](/docs/kcl/types/number),
isLessThanOrEqual?: [number](/docs/kcl/types/number),
isEqualTo?: [number](/docs/kcl/types/number),
tolerance?: [number](/docs/kcl/types/number),
error?: String,
actual: number,
isGreaterThan?: number,
isLessThan?: number,
isGreaterThanOrEqual?: number,
isLessThanOrEqual?: number,
isEqualTo?: number,
tolerance?: number,
error?: string,
): ()
```
@ -26,14 +26,14 @@ assert(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `actual` | [`number`](/docs/kcl/types/number) | Value to check. It will be compared with one of the comparison arguments. | Yes |
| `isGreaterThan` | [`number`](/docs/kcl/types/number) | Comparison argument. If given, checks the `actual` value is greater than this. | No |
| `isLessThan` | [`number`](/docs/kcl/types/number) | Comparison argument. If given, checks the `actual` value is less than this. | No |
| `isGreaterThanOrEqual` | [`number`](/docs/kcl/types/number) | Comparison argument. If given, checks the `actual` value is greater than or equal to this. | No |
| `isLessThanOrEqual` | [`number`](/docs/kcl/types/number) | Comparison argument. If given, checks the `actual` value is less than or equal to this. | No |
| `isEqualTo` | [`number`](/docs/kcl/types/number) | Comparison argument. If given, checks the `actual` value is less than or equal to this. | No |
| `tolerance` | [`number`](/docs/kcl/types/number) | If `isEqualTo` is used, this is the tolerance to allow for the comparison. This tolerance is used because KCL's number system has some floating-point imprecision when used with very large decimal places. | No |
| `error` | `String` | If the value was false, the program will terminate with this error message | No |
| `actual` | [`number`](/docs/kcl/types/std-types-number) | Value to check. It will be compared with one of the comparison arguments. | Yes |
| `isGreaterThan` | [`number`](/docs/kcl/types/std-types-number) | Comparison argument. If given, checks the `actual` value is greater than this. | No |
| `isLessThan` | [`number`](/docs/kcl/types/std-types-number) | Comparison argument. If given, checks the `actual` value is less than this. | No |
| `isGreaterThanOrEqual` | [`number`](/docs/kcl/types/std-types-number) | Comparison argument. If given, checks the `actual` value is greater than or equal to this. | No |
| `isLessThanOrEqual` | [`number`](/docs/kcl/types/std-types-number) | Comparison argument. If given, checks the `actual` value is less than or equal to this. | No |
| `isEqualTo` | [`number`](/docs/kcl/types/std-types-number) | Comparison argument. If given, checks the `actual` value is less than or equal to this. | No |
| `tolerance` | [`number`](/docs/kcl/types/std-types-number) | If `isEqualTo` is used, this is the tolerance to allow for the comparison. This tolerance is used because KCL's number system has some floating-point imprecision when used with very large decimal places. | No |
| `error` | [`string`](/docs/kcl/types/std-types-string) | If the value was false, the program will terminate with this error message | No |
### Returns

View File

@ -10,8 +10,8 @@ Asserts that a value is the boolean value true.
```kcl
assertIs(
actual: [bool](/docs/kcl/types/bool),
error?: String,
actual: bool,
error?: string,
): ()
```
@ -20,8 +20,8 @@ assertIs(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `actual` | [`bool`](/docs/kcl/types/bool) | Value to check. If this is the boolean value true, assert passes. Otherwise it fails. | Yes |
| `error` | `String` | If the value was false, the program will terminate with this error message | No |
| `actual` | [`bool`](/docs/kcl/types/std-types-bool) | Value to check. If this is the boolean value true, assert passes. Otherwise it fails. | Yes |
| `error` | [`string`](/docs/kcl/types/std-types-string) | If the value was false, the program will terminate with this error message | No |
### Returns

View File

@ -10,12 +10,12 @@ Draw a smooth, continuous, curved line segment from the current origin to the de
```kcl
bezierCurve(
sketch: [Sketch](/docs/kcl/types/Sketch),
control1: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
control2: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
end: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
tag?: [TagDeclarator](/docs/kcl/types#tag-declaration),
): [Sketch](/docs/kcl/types/Sketch)
sketch: Sketch,
control1: Point2d,
control2: Point2d,
end: Point2d,
tag?: TagDeclarator,
): Sketch
```
@ -23,15 +23,15 @@ bezierCurve(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `control1` | [`[number]`](/docs/kcl/types/number) | First control point for the cubic | Yes |
| `control2` | [`[number]`](/docs/kcl/types/number) | Second control point for the cubic | Yes |
| `end` | [`[number]`](/docs/kcl/types/number) | How far away (along the X and Y axes) should this line go? | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
| `sketch` | [`Sketch`](/docs/kcl/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
| `control1` | [`Point2d`](/docs/kcl/types/std-types-Point2d) | First control point for the cubic | Yes |
| `control2` | [`Point2d`](/docs/kcl/types/std-types-Point2d) | Second control point for the cubic | Yes |
| `end` | [`Point2d`](/docs/kcl/types/std-types-Point2d) | How far away (along the X and Y axes) should this line go? | Yes |
| [`tag`](/docs/kcl/types/std-types-tag) | [`TagDeclarator`](/docs/kcl/types#TagDeclarator) | Create a new tag which refers to this line | No |
### Returns
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl/types/std-types-Sketch)
### Examples

View File

@ -10,12 +10,12 @@ Construct a circle derived from 3 points.
```kcl
circleThreePoint(
sketchSurfaceOrGroup: [[Sketch](/docs/kcl/types/Sketch)OrSurface](/docs/kcl/types/[Sketch](/docs/kcl/types/Sketch)OrSurface),
p1: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
p2: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
p3: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
tag?: [TagDeclarator](/docs/kcl/types#tag-declaration),
): [Sketch](/docs/kcl/types/Sketch)
sketchSurfaceOrGroup: Sketch | Plane | Face,
p1: Point2d,
p2: Point2d,
p3: Point2d,
tag?: TagDeclarator,
): Sketch
```
@ -23,15 +23,15 @@ circleThreePoint(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes |
| `p1` | [`[number]`](/docs/kcl/types/number) | 1st point to derive the circle. | Yes |
| `p2` | [`[number]`](/docs/kcl/types/number) | 2nd point to derive the circle. | Yes |
| `p3` | [`[number]`](/docs/kcl/types/number) | 3rd point to derive the circle. | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Identifier for the circle to reference elsewhere. | No |
| `sketchSurfaceOrGroup` | [`Sketch`](/docs/kcl/types/std-types-Sketch) or [`Plane`](/docs/kcl/types/std-types-Plane) or [`Face`](/docs/kcl/types/std-types-Face) | Plane or surface to sketch on. | Yes |
| `p1` | [`Point2d`](/docs/kcl/types/std-types-Point2d) | 1st point to derive the circle. | Yes |
| `p2` | [`Point2d`](/docs/kcl/types/std-types-Point2d) | 2nd point to derive the circle. | Yes |
| `p3` | [`Point2d`](/docs/kcl/types/std-types-Point2d) | 3rd point to derive the circle. | Yes |
| [`tag`](/docs/kcl/types/std-types-tag) | [`TagDeclarator`](/docs/kcl/types#TagDeclarator) | Identifier for the circle to reference elsewhere. | No |
### Returns
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl/types/std-types-Sketch)
### Examples

View File

@ -13,7 +13,7 @@ This doesn't really have much utility unless you need the equivalent of a double
Really only use this function if YOU ARE SURE you need it. In most cases you do not need clone and using a pattern with `instance = 2` is more appropriate.
```kcl
clone(geometry: [GeometryWithImportedGeometry](/docs/kcl/types/GeometryWithImportedGeometry)): [GeometryWithImportedGeometry](/docs/kcl/types/GeometryWithImportedGeometry)
clone(geometry: Solid | Sketch | ImportedGeometry): Solid | Sketch | ImportedGeometry
```
@ -21,11 +21,11 @@ clone(geometry: [GeometryWithImportedGeometry](/docs/kcl/types/GeometryWithImpor
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `geometry` | [`GeometryWithImportedGeometry`](/docs/kcl/types/GeometryWithImportedGeometry) | The sketch, solid, or imported geometry to be cloned | Yes |
| `geometry` | [`Solid`](/docs/kcl/types/std-types-Solid) or [`Sketch`](/docs/kcl/types/std-types-Sketch) or [`ImportedGeometry`](/docs/kcl/types#ImportedGeometry) | The sketch, solid, or imported geometry to be cloned | Yes |
### Returns
[`GeometryWithImportedGeometry`](/docs/kcl/types/GeometryWithImportedGeometry) - A geometry including an imported geometry.
[`Solid`](/docs/kcl/types/std-types-Solid) or [`Sketch`](/docs/kcl/types/std-types-Sketch) or [`ImportedGeometry`](/docs/kcl/types#ImportedGeometry) - A geometry including an imported geometry.
### Examples

View File

@ -10,9 +10,9 @@ Construct a line segment from the current origin back to the profile's origin, e
```kcl
close(
sketch: [Sketch](/docs/kcl/types/Sketch),
tag?: [TagDeclarator](/docs/kcl/types#tag-declaration),
): [Sketch](/docs/kcl/types/Sketch)
sketch: Sketch,
tag?: TagDeclarator,
): Sketch
```
@ -20,12 +20,12 @@ close(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | The sketch you want to close | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
| `sketch` | [`Sketch`](/docs/kcl/types/std-types-Sketch) | The sketch you want to close | Yes |
| [`tag`](/docs/kcl/types/std-types-tag) | [`TagDeclarator`](/docs/kcl/types#TagDeclarator) | Create a new tag which refers to this line | No |
### Returns
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl/types/std-types-Sketch)
### Examples

File diff suppressed because one or more lines are too long

View File

@ -10,13 +10,13 @@ You can provide more than one sketch to extrude, and they will all be extruded i
```kcl
extrude(
sketches: [[[Sketch](/docs/kcl/types/Sketch)]](/docs/kcl/types/[Sketch](/docs/kcl/types/Sketch)),
length: [number](/docs/kcl/types/number),
symmetric?: [bool](/docs/kcl/types/bool),
bidirectionalLength?: [number](/docs/kcl/types/number),
tagStart?: [TagDeclarator](/docs/kcl/types#tag-declaration),
tagEnd?: [TagDeclarator](/docs/kcl/types#tag-declaration),
): [[[Solid](/docs/kcl/types/Solid)]](/docs/kcl/types/[Solid](/docs/kcl/types/Solid))
sketches: [Sketch],
length: number,
symmetric?: bool,
bidirectionalLength?: number,
tagStart?: TagDeclarator,
tagEnd?: TagDeclarator,
): [Solid]
```
@ -24,16 +24,16 @@ extrude(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | Which sketch or sketches should be extruded | Yes |
| `length` | [`number`](/docs/kcl/types/number) | How far to extrude the given sketches | Yes |
| `symmetric` | [`bool`](/docs/kcl/types/bool) | If true, the extrusion will happen symmetrically around the sketch. Otherwise, the | No |
| `bidirectionalLength` | [`number`](/docs/kcl/types/number) | If specified, will also extrude in the opposite direction to 'distance' to the specified distance. If 'symmetric' is true, this value is ignored. | No |
| `tagStart` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the start of the extrusion, i.e. the original sketch | No |
| `tagEnd` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the end of the extrusion, i.e. the new face created by extruding the original sketch | No |
| `sketches` | [`[Sketch]`](/docs/kcl/types/std-types-Sketch) | Which sketch or sketches should be extruded | Yes |
| `length` | [`number`](/docs/kcl/types/std-types-number) | How far to extrude the given sketches | Yes |
| `symmetric` | [`bool`](/docs/kcl/types/std-types-bool) | If true, the extrusion will happen symmetrically around the sketch. Otherwise, the | No |
| `bidirectionalLength` | [`number`](/docs/kcl/types/std-types-number) | If specified, will also extrude in the opposite direction to 'distance' to the specified distance. If 'symmetric' is true, this value is ignored. | No |
| `tagStart` | [`TagDeclarator`](/docs/kcl/types#TagDeclarator) | A named tag for the face at the start of the extrusion, i.e. the original sketch | No |
| `tagEnd` | [`TagDeclarator`](/docs/kcl/types#TagDeclarator) | A named tag for the face at the end of the extrusion, i.e. the new face created by extruding the original sketch | No |
### Returns
[`[Solid]`](/docs/kcl/types/Solid)
[`[Solid]`](/docs/kcl/types/std-types-Solid)
### Examples

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -10,14 +10,14 @@ Create a helix.
```kcl
helix(
revolutions: [number](/docs/kcl/types/number)(_),
angleStart: [number](/docs/kcl/types/number)(Angle),
ccw?: [bool](/docs/kcl/types/bool),
radius?: [number](/docs/kcl/types/number)(Length),
axis?: [Axis3d](/docs/kcl/types/Axis3d) | [Edge](/docs/kcl/types/Edge),
length?: [number](/docs/kcl/types/number)(Length),
cylinder?: [Solid](/docs/kcl/types/Solid),
): [Helix](/docs/kcl/types/Helix)
revolutions: number(_),
angleStart: number(Angle),
ccw?: bool,
radius?: number(Length),
axis?: Axis3d | Edge,
length?: number(Length),
cylinder?: Solid,
): Helix
```
@ -27,15 +27,15 @@ helix(
|----------|------|-------------|----------|
| `revolutions` | `number(_)` | Number of revolutions. | Yes |
| `angleStart` | `number(Angle)` | Start angle. | Yes |
| `ccw` | [`bool`](/docs/kcl/types/bool) | Is the helix rotation counter clockwise? The default is `false`. | No |
| `ccw` | [`bool`](/docs/kcl/types/std-types-bool) | Is the helix rotation counter clockwise? The default is `false`. | No |
| `radius` | `number(Length)` | Radius of the helix. | No |
| `axis` | [`Axis3d`](/docs/kcl/types/Axis3d) or [`Edge`](/docs/kcl/types/Edge) | Axis to use for the helix. | No |
| `axis` | [`Axis3d`](/docs/kcl/types/std-types-Axis3d) or [`Edge`](/docs/kcl/types/std-types-Edge) | Axis to use for the helix. | No |
| `length` | `number(Length)` | Length of the helix. This is not necessary if the helix is created around an edge. If not given the length of the edge is used. | No |
| `cylinder` | [`Solid`](/docs/kcl/types/Solid) | Cylinder to create the helix on. | No |
| `cylinder` | [`Solid`](/docs/kcl/types/std-types-Solid) | Cylinder to create the helix on. | No |
### Returns
[`Helix`](/docs/kcl/types/Helix)
[`Helix`](/docs/kcl/types/std-types-Helix)
### Examples

View File

@ -9,7 +9,7 @@ Compute the absolute value of a number.
```kcl
abs(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number)
abs(@input: number): number
```
@ -17,11 +17,11 @@ abs(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number)
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `input` | [`number`](/docs/kcl/types/number) | | Yes |
| `input` | [`number`](/docs/kcl/types/std-types-number) | | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -9,7 +9,7 @@ Compute the arccosine of a number.
```kcl
acos(@num: [number](/docs/kcl/types/number)(_)): [number](/docs/kcl/types/number)(rad)
acos(@num: number(_)): number(rad)
```

View File

@ -9,7 +9,7 @@ Compute the arcsine of a number.
```kcl
asin(@num: [number](/docs/kcl/types/number)(_)): [number](/docs/kcl/types/number)(rad)
asin(@num: number(_)): number(rad)
```

View File

@ -9,7 +9,7 @@ Compute the arctangent of a number.
Consider using `atan2()` instead for the true inverse of tangent.
```kcl
atan(@num: [number](/docs/kcl/types/number)(_)): [number](/docs/kcl/types/number)(rad)
atan(@num: number(_)): number(rad)
```

View File

@ -10,9 +10,9 @@ Compute the four quadrant arctangent of Y and X.
```kcl
atan2(
y: [number](/docs/kcl/types/number)(Length),
x: [number](/docs/kcl/types/number)(Length),
): [number](/docs/kcl/types/number)(rad)
y: number(Length),
x: number(Length),
): number(rad)
```

View File

@ -9,7 +9,7 @@ Compute the smallest integer greater than or equal to a number.
```kcl
ceil(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number)
ceil(@input: number): number
```
@ -17,11 +17,11 @@ ceil(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number)
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `input` | [`number`](/docs/kcl/types/number) | | Yes |
| `input` | [`number`](/docs/kcl/types/std-types-number) | | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -9,7 +9,7 @@ Compute the cosine of a number.
```kcl
cos(@num: [number](/docs/kcl/types/number)(Angle)): [number](/docs/kcl/types/number)(_)
cos(@num: number(Angle)): number(_)
```

View File

@ -9,7 +9,7 @@ Compute the largest integer less than or equal to a number.
```kcl
floor(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number)
floor(@input: number): number
```
@ -17,11 +17,11 @@ floor(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `input` | [`number`](/docs/kcl/types/number) | | Yes |
| `input` | [`number`](/docs/kcl/types/std-types-number) | | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -9,7 +9,7 @@ Compute the natural logarithm of the number.
```kcl
ln(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number)
ln(@input: number): number
```
@ -17,11 +17,11 @@ ln(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number)
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `input` | [`number`](/docs/kcl/types/number) | | Yes |
| `input` | [`number`](/docs/kcl/types/std-types-number) | | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -12,9 +12,9 @@ and `log10` can produce more accurate results for base 10.
```kcl
log(
@input: [number](/docs/kcl/types/number),
base: [number](/docs/kcl/types/number)(_),
): [number](/docs/kcl/types/number)
@input: number,
base: number(_),
): number
```
@ -22,12 +22,12 @@ log(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `input` | [`number`](/docs/kcl/types/number) | The number to compute the logarithm of. | Yes |
| `input` | [`number`](/docs/kcl/types/std-types-number) | The number to compute the logarithm of. | Yes |
| `base` | `number(_)` | The base of the logarithm. | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -9,7 +9,7 @@ Compute the base 10 logarithm of the number.
```kcl
log10(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number)
log10(@input: number): number
```
@ -17,11 +17,11 @@ log10(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `input` | [`number`](/docs/kcl/types/number) | | Yes |
| `input` | [`number`](/docs/kcl/types/std-types-number) | | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -9,7 +9,7 @@ Compute the base 2 logarithm of the number.
```kcl
log2(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number)
log2(@input: number): number
```
@ -17,11 +17,11 @@ log2(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number)
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `input` | [`number`](/docs/kcl/types/number) | | Yes |
| `input` | [`number`](/docs/kcl/types/std-types-number) | | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -9,7 +9,7 @@ Compute the maximum of the given arguments.
```kcl
max(@input: [[number](/docs/kcl/types/number); 1+]): [number](/docs/kcl/types/number)
max(@input: [number; 1+]): number
```
@ -17,11 +17,11 @@ max(@input: [[number](/docs/kcl/types/number); 1+]): [number](/docs/kcl/types/nu
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `input` | `[number; 1+]` | An array of numbers to compute the maximum of. | Yes |
| `input` | [`[number; 1+]`](/docs/kcl/types/std-types-number) | An array of numbers to compute the maximum of. | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -9,7 +9,7 @@ Compute the minimum of the given arguments.
```kcl
min(@input: [[number](/docs/kcl/types/number); 1+]): [number](/docs/kcl/types/number)
min(@input: [number; 1+]): number
```
@ -17,11 +17,11 @@ min(@input: [[number](/docs/kcl/types/number); 1+]): [number](/docs/kcl/types/nu
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `input` | `[number; 1+]` | An array of numbers to compute the minimum of. | Yes |
| `input` | [`[number; 1+]`](/docs/kcl/types/std-types-number) | An array of numbers to compute the minimum of. | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -11,9 +11,9 @@ cartesian (x/y/z grid) coordinates.
```kcl
polar(
angle: [number](/docs/kcl/types/number)(rad),
length: [number](/docs/kcl/types/number)(Length),
): [Point2d](/docs/kcl/types/Point2d)
angle: number(rad),
length: number(Length),
): Point2d
```
@ -26,7 +26,7 @@ polar(
### Returns
[`Point2d`](/docs/kcl/types/Point2d)
[`Point2d`](/docs/kcl/types/std-types-Point2d)
### Examples

View File

@ -10,9 +10,9 @@ Compute the number to a power.
```kcl
pow(
@input: [number](/docs/kcl/types/number),
exp: [number](/docs/kcl/types/number)(_),
): [number](/docs/kcl/types/number)
@input: number,
exp: number(_),
): number
```
@ -20,12 +20,12 @@ pow(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `input` | [`number`](/docs/kcl/types/number) | The number to raise. | Yes |
| `input` | [`number`](/docs/kcl/types/std-types-number) | The number to raise. | Yes |
| `exp` | `number(_)` | The power to raise to. | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -11,9 +11,9 @@ If `num` is negative, the result will be too.
```kcl
rem(
@num: [number](/docs/kcl/types/number),
divisor: [number](/docs/kcl/types/number),
): [number](/docs/kcl/types/number)
@num: number,
divisor: number,
): number
```
@ -21,12 +21,12 @@ rem(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `num` | [`number`](/docs/kcl/types/number) | The number which will be divided by `divisor`. | Yes |
| `divisor` | [`number`](/docs/kcl/types/number) | The number which will divide `num`. | Yes |
| `num` | [`number`](/docs/kcl/types/std-types-number) | The number which will be divided by `divisor`. | Yes |
| `divisor` | [`number`](/docs/kcl/types/std-types-number) | The number which will divide `num`. | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -9,7 +9,7 @@ Round a number to the nearest integer.
```kcl
round(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number)
round(@input: number): number
```
@ -17,11 +17,11 @@ round(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `input` | [`number`](/docs/kcl/types/number) | | Yes |
| `input` | [`number`](/docs/kcl/types/std-types-number) | | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -9,7 +9,7 @@ Compute the sine of a number.
```kcl
sin(@num: [number](/docs/kcl/types/number)(Angle)): [number](/docs/kcl/types/number)(_)
sin(@num: number(Angle)): number(_)
```

View File

@ -9,7 +9,7 @@ Compute the square root of a number.
```kcl
sqrt(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number)
sqrt(@input: number): number
```
@ -17,11 +17,11 @@ sqrt(@input: [number](/docs/kcl/types/number)): [number](/docs/kcl/types/number)
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `input` | [`number`](/docs/kcl/types/number) | | Yes |
| `input` | [`number`](/docs/kcl/types/std-types-number) | | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -9,7 +9,7 @@ Compute the tangent of a number.
```kcl
tan(@num: [number](/docs/kcl/types/number)(Angle)): [number](/docs/kcl/types/number)(_)
tan(@num: number(Angle)): number(_)
```

View File

@ -10,10 +10,10 @@ For example, if you offset the `XZ` plane by 10, the new plane will be parallel
plane and 10 units away from it.
```kcl
offset[Plane](/docs/kcl/types/Plane)(
@plane: [Plane](/docs/kcl/types/Plane),
offset: [number](/docs/kcl/types/number)(Length),
): [Plane](/docs/kcl/types/Plane)
offsetPlane(
@plane: Plane,
offset: number(Length),
): Plane
```
@ -21,12 +21,12 @@ offset[Plane](/docs/kcl/types/Plane)(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `plane` | [`Plane`](/docs/kcl/types/Plane) | The plane (e.g. `XY`) which this new plane is created from. | Yes |
| `plane` | [`Plane`](/docs/kcl/types/std-types-Plane) | The plane (e.g. `XY`) which this new plane is created from. | Yes |
| `offset` | `number(Length)` | Distance from the standard plane this new plane will be created at. | Yes |
### Returns
[`Plane`](/docs/kcl/types/Plane)
[`Plane`](/docs/kcl/types/std-types-Plane)
### Examples

View File

@ -19,15 +19,15 @@ revolved around the same axis.
```kcl
revolve(
@sketches: [[Sketch](/docs/kcl/types/Sketch); 1+],
axis: [Axis2d](/docs/kcl/types/Axis2d) | [Edge](/docs/kcl/types/Edge),
angle?: [number](/docs/kcl/types/number)(Angle),
tolerance?: [number](/docs/kcl/types/number)(Length),
symmetric?: [bool](/docs/kcl/types/bool),
bidirectionalAngle?: [number](/docs/kcl/types/number)(Angle),
@sketches: [Sketch; 1+],
axis: Axis2d | Edge,
angle?: number(Angle),
tolerance?: number(Length),
symmetric?: bool,
bidirectionalAngle?: number(Angle),
tagStart?: tag,
tagEnd?: tag,
): [Solid](/docs/kcl/types/Solid)
): Solid
```
@ -35,18 +35,18 @@ revolve(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketches` | `[Sketch; 1+]` | The sketch or set of sketches that should be revolved | Yes |
| `axis` | [`Axis2d`](/docs/kcl/types/Axis2d) or [`Edge`](/docs/kcl/types/Edge) | Axis of revolution. | Yes |
| `sketches` | [`[Sketch; 1+]`](/docs/kcl/types/std-types-Sketch) | The sketch or set of sketches that should be revolved | Yes |
| `axis` | [`Axis2d`](/docs/kcl/types/std-types-Axis2d) or [`Edge`](/docs/kcl/types/std-types-Edge) | Axis of revolution. | Yes |
| `angle` | `number(Angle)` | Angle to revolve (in degrees). Default is 360. | No |
| `tolerance` | `number(Length)` | Tolerance for the revolve operation. | No |
| `symmetric` | [`bool`](/docs/kcl/types/bool) | If true, the extrusion will happen symmetrically around the sketch. Otherwise, the extrusion will happen on only one side of the sketch. | No |
| `symmetric` | [`bool`](/docs/kcl/types/std-types-bool) | If true, the extrusion will happen symmetrically around the sketch. Otherwise, the extrusion will happen on only one side of the sketch. | No |
| `bidirectionalAngle` | `number(Angle)` | If specified, will also revolve in the opposite direction to 'angle' to the specified angle. If 'symmetric' is true, this value is ignored. | No |
| `tagStart` | `tag` | A named tag for the face at the start of the revolve, i.e. the original sketch. | No |
| `tagEnd` | `tag` | A named tag for the face at the end of the revolve. | No |
| `tagStart` | [`tag`](/docs/kcl/types/std-types-tag) | A named tag for the face at the start of the revolve, i.e. the original sketch. | No |
| `tagEnd` | [`tag`](/docs/kcl/types/std-types-tag) | A named tag for the face at the end of the revolve. | No |
### Returns
[`Solid`](/docs/kcl/types/Solid)
[`Solid`](/docs/kcl/types/std-types-Solid)
### Examples

View File

@ -11,11 +11,11 @@ the provided (x, y) origin point.
```kcl
circle(
@sketch_or_surface: [Sketch](/docs/kcl/types/Sketch) | [Plane](/docs/kcl/types/Plane) | [Face](/docs/kcl/types/Face),
center: [Point2d](/docs/kcl/types/Point2d),
radius: [number](/docs/kcl/types/number)(Length),
@sketch_or_surface: Sketch | Plane | Face,
center: Point2d,
radius: number(Length),
tag?: tag,
): [Sketch](/docs/kcl/types/Sketch)
): Sketch
```
@ -23,14 +23,14 @@ circle(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch_or_surface` | [`Sketch`](/docs/kcl/types/Sketch) or [`Plane`](/docs/kcl/types/Plane) or [`Face`](/docs/kcl/types/Face) | Sketch to extend, or plane or surface to sketch on. | Yes |
| `center` | [`Point2d`](/docs/kcl/types/Point2d) | The center of the circle. | Yes |
| `sketch_or_surface` | [`Sketch`](/docs/kcl/types/std-types-Sketch) or [`Plane`](/docs/kcl/types/std-types-Plane) or [`Face`](/docs/kcl/types/std-types-Face) | Sketch to extend, or plane or surface to sketch on. | Yes |
| `center` | [`Point2d`](/docs/kcl/types/std-types-Point2d) | The center of the circle. | Yes |
| `radius` | `number(Length)` | The radius of the circle. | Yes |
| `tag` | `tag` | Create a new tag which refers to this circle. | No |
| [`tag`](/docs/kcl/types/std-types-tag) | [`tag`](/docs/kcl/types/std-types-tag) | Create a new tag which refers to this circle. | No |
### Returns
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl/types/std-types-Sketch)
### Examples

View File

@ -12,9 +12,9 @@ Mirror occurs around a local sketch axis rather than a global axis.
```kcl
mirror2d(
@sketches: [[Sketch](/docs/kcl/types/Sketch); 1+],
axis: [Axis2d](/docs/kcl/types/Axis2d) | [Edge](/docs/kcl/types/Edge),
): [Sketch](/docs/kcl/types/Sketch)
@sketches: [Sketch; 1+],
axis: Axis2d | Edge,
): Sketch
```
@ -22,12 +22,12 @@ mirror2d(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketches` | `[Sketch; 1+]` | The sketch or sketches to be reflected. | Yes |
| `axis` | [`Axis2d`](/docs/kcl/types/Axis2d) or [`Edge`](/docs/kcl/types/Edge) | The axis to reflect around. | Yes |
| `sketches` | [`[Sketch; 1+]`](/docs/kcl/types/std-types-Sketch) | The sketch or sketches to be reflected. | Yes |
| `axis` | [`Axis2d`](/docs/kcl/types/std-types-Axis2d) or [`Edge`](/docs/kcl/types/std-types-Edge) | The axis to reflect around. | Yes |
### Returns
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl/types/std-types-Sketch)
### Examples

View File

@ -12,11 +12,11 @@ a sharp, straight transitional edge.
```kcl
chamfer(
@solid: [Solid](/docs/kcl/types/Solid),
length: [number](/docs/kcl/types/number)(Length),
tags: [[Edge](/docs/kcl/types/Edge); 1+],
@solid: Solid,
length: number(Length),
tags: [Edge; 1+],
tag?: tag,
): [Solid](/docs/kcl/types/Solid)
): Solid
```
@ -24,14 +24,14 @@ chamfer(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | The solid whose edges should be chamfered | Yes |
| `solid` | [`Solid`](/docs/kcl/types/std-types-Solid) | The solid whose edges should be chamfered | Yes |
| `length` | `number(Length)` | The length of the chamfer | Yes |
| `tags` | `[Edge; 1+]` | The paths you want to chamfer | Yes |
| `tag` | `tag` | Create a new tag which refers to this chamfer | No |
| `tags` | [`[Edge; 1+]`](/docs/kcl/types/std-types-Edge) | The paths you want to chamfer | Yes |
| [`tag`](/docs/kcl/types/std-types-tag) | [`tag`](/docs/kcl/types/std-types-tag) | Create a new tag which refers to this chamfer | No |
### Returns
[`Solid`](/docs/kcl/types/Solid)
[`Solid`](/docs/kcl/types/std-types-Solid)
### Examples
@ -76,7 +76,7 @@ sg = startSketchOn(XY)
return sg
}
part001 = cube([0,0], 20)
part001 = cube(pos = [0,0], scale = 20)
|> close(tag = $line1)
|> extrude(length = 20)
// We tag the chamfer to reference it later.

View File

@ -12,12 +12,12 @@ will smoothly blend the transition.
```kcl
fillet(
@solid: [Solid](/docs/kcl/types/Solid),
radius: [number](/docs/kcl/types/number)(Length),
tags: [[Edge](/docs/kcl/types/Edge); 1+],
tolerance?: [number](/docs/kcl/types/number)(Length),
@solid: Solid,
radius: number(Length),
tags: [Edge; 1+],
tolerance?: number(Length),
tag?: tag,
): [Solid](/docs/kcl/types/Solid)
): Solid
```
@ -25,15 +25,15 @@ fillet(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | The solid whose edges should be filletted | Yes |
| `solid` | [`Solid`](/docs/kcl/types/std-types-Solid) | The solid whose edges should be filletted | Yes |
| `radius` | `number(Length)` | The radius of the fillet | Yes |
| `tags` | `[Edge; 1+]` | The paths you want to fillet | Yes |
| `tags` | [`[Edge; 1+]`](/docs/kcl/types/std-types-Edge) | The paths you want to fillet | Yes |
| `tolerance` | `number(Length)` | The tolerance for this fillet | No |
| `tag` | `tag` | Create a new tag which refers to this fillet | No |
| [`tag`](/docs/kcl/types/std-types-tag) | [`tag`](/docs/kcl/types/std-types-tag) | Create a new tag which refers to this fillet | No |
### Returns
[`Solid`](/docs/kcl/types/Solid)
[`Solid`](/docs/kcl/types/std-types-Solid)
### Examples

View File

@ -11,9 +11,9 @@ provided thickness remains around the exterior of the shape.
```kcl
hollow(
@solid: [Solid](/docs/kcl/types/Solid),
thickness: [number](/docs/kcl/types/number)(Length),
): [Solid](/docs/kcl/types/Solid)
@solid: Solid,
thickness: number(Length),
): Solid
```
@ -21,12 +21,12 @@ hollow(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | Which solid to hollow out | Yes |
| `solid` | [`Solid`](/docs/kcl/types/std-types-Solid) | Which solid to hollow out | Yes |
| `thickness` | `number(Length)` | The thickness of the remaining shell | Yes |
### Returns
[`Solid`](/docs/kcl/types/Solid)
[`Solid`](/docs/kcl/types/std-types-Solid)
### Examples

View File

@ -11,10 +11,10 @@ provided thickness remains, taking volume starting at the providedface, leaving
```kcl
shell(
@solids: [[Solid](/docs/kcl/types/Solid); 1+],
thickness: [number](/docs/kcl/types/number)(Length),
@solids: [Solid; 1+],
thickness: number(Length),
faces: [tag; 1+],
): [[[Solid](/docs/kcl/types/Solid)]](/docs/kcl/types/[Solid](/docs/kcl/types/Solid))
): [Solid]
```
@ -22,13 +22,13 @@ shell(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `solids` | `[Solid; 1+]` | Which solid (or solids) to shell out | Yes |
| `solids` | [`[Solid; 1+]`](/docs/kcl/types/std-types-Solid) | Which solid (or solids) to shell out | Yes |
| `thickness` | `number(Length)` | The thickness of the shell | Yes |
| `faces` | `[tag; 1+]` | The faces you want removed | Yes |
| `faces` | [`[tag; 1+]`](/docs/kcl/types/std-types-tag) | The faces you want removed | Yes |
### Returns
[`[Solid]`](/docs/kcl/types/Solid)
[`[Solid]`](/docs/kcl/types/std-types-Solid)
### Examples

View File

@ -9,7 +9,7 @@ Convert a number to centimeters from its current units.
```kcl
units::toCentimeters(@num: [number](/docs/kcl/types/number)(cm)): [number](/docs/kcl/types/number)(cm)
units::toCentimeters(@num: number(cm)): number(cm)
```

View File

@ -9,7 +9,7 @@ Converts a number to degrees from its current units.
```kcl
units::toDegrees(@num: [number](/docs/kcl/types/number)(deg)): [number](/docs/kcl/types/number)(deg)
units::toDegrees(@num: number(deg)): number(deg)
```

View File

@ -9,7 +9,7 @@ Convert a number to feet from its current units.
```kcl
units::toFeet(@num: [number](/docs/kcl/types/number)(ft)): [number](/docs/kcl/types/number)(ft)
units::toFeet(@num: number(ft)): number(ft)
```

View File

@ -9,7 +9,7 @@ Convert a number to inches from its current units.
```kcl
units::toInches(@num: [number](/docs/kcl/types/number)(in)): [number](/docs/kcl/types/number)(in)
units::toInches(@num: number(in)): number(in)
```

View File

@ -9,7 +9,7 @@ Convert a number to meters from its current units.
```kcl
units::toMeters(@num: [number](/docs/kcl/types/number)(m)): [number](/docs/kcl/types/number)(m)
units::toMeters(@num: number(m)): number(m)
```

View File

@ -9,7 +9,7 @@ Convert a number to millimeters from its current units.
```kcl
units::toMillimeters(@num: [number](/docs/kcl/types/number)(mm)): [number](/docs/kcl/types/number)(mm)
units::toMillimeters(@num: number(mm)): number(mm)
```

View File

@ -9,7 +9,7 @@ Converts a number to radians from its current units.
```kcl
units::toRadians(@num: [number](/docs/kcl/types/number)(rad)): [number](/docs/kcl/types/number)(rad)
units::toRadians(@num: number(rad)): number(rad)
```

View File

@ -9,7 +9,7 @@ Converts a number to yards from its current units.
```kcl
units::toYards(@num: [number](/docs/kcl/types/number)(yd)): [number](/docs/kcl/types/number)(yd)
units::toYards(@num: number(yd)): number(yd)
```

View File

@ -9,7 +9,7 @@ Get the shared edge between two faces.
```kcl
getCommon[Edge](/docs/kcl/types/Edge)(faces: [[TagIdentifier](/docs/kcl/types#tag-identifier)]): Uuid
getCommonEdge(faces: [TagIdentifier]): Uuid
```
@ -17,7 +17,7 @@ getCommon[Edge](/docs/kcl/types/Edge)(faces: [[TagIdentifier](/docs/kcl/types#ta
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `faces` | `[TagIdentifier]` | The tags of the faces you want to find the common edge between | Yes |
| `faces` | [`[TagIdentifier]`](/docs/kcl/types#TagIdentifier) | The tags of the faces you want to find the common edge between | Yes |
### Returns

View File

@ -9,7 +9,7 @@ Get the next adjacent edge to the edge given.
```kcl
getNextAdjacent[Edge](/docs/kcl/types/Edge)(edge: [TagIdentifier](/docs/kcl/types#tag-identifier)): Uuid
getNextAdjacentEdge(edge: TagIdentifier): Uuid
```
@ -17,7 +17,7 @@ getNextAdjacent[Edge](/docs/kcl/types/Edge)(edge: [TagIdentifier](/docs/kcl/type
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `edge` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The tag of the edge you want to find the next adjacent edge of. | Yes |
| `edge` | [`TagIdentifier`](/docs/kcl/types#TagIdentifier) | The tag of the edge you want to find the next adjacent edge of. | Yes |
### Returns

View File

@ -9,7 +9,7 @@ Get the opposite edge to the edge given.
```kcl
getOpposite[Edge](/docs/kcl/types/Edge)(edge: [TagIdentifier](/docs/kcl/types#tag-identifier)): Uuid
getOppositeEdge(edge: TagIdentifier): Uuid
```
@ -17,7 +17,7 @@ getOpposite[Edge](/docs/kcl/types/Edge)(edge: [TagIdentifier](/docs/kcl/types#ta
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `edge` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The tag of the edge you want to find the opposite edge of. | Yes |
| `edge` | [`TagIdentifier`](/docs/kcl/types#TagIdentifier) | The tag of the edge you want to find the opposite edge of. | Yes |
### Returns

View File

@ -9,7 +9,7 @@ Get the previous adjacent edge to the edge given.
```kcl
getPreviousAdjacent[Edge](/docs/kcl/types/Edge)(edge: [TagIdentifier](/docs/kcl/types#tag-identifier)): Uuid
getPreviousAdjacentEdge(edge: TagIdentifier): Uuid
```
@ -17,7 +17,7 @@ getPreviousAdjacent[Edge](/docs/kcl/types/Edge)(edge: [TagIdentifier](/docs/kcl/
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `edge` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The tag of the edge you want to find the previous adjacent edge of. | Yes |
| `edge` | [`TagIdentifier`](/docs/kcl/types#TagIdentifier) | The tag of the edge you want to find the previous adjacent edge of. | Yes |
### Returns

View File

@ -12,24 +12,10 @@ layout: manual
* [`Modules`](kcl/modules)
* [`Settings`](kcl/settings)
* [`Known Issues`](kcl/known-issues)
* [`Constants`](kcl/consts)
### Standard library
### Functions
* **Primitive types**
* [`bool`](kcl/types/bool)
* [`number`](kcl/types/number)
* [`string`](kcl/types/string)
* [`tag`](kcl/types/tag)
* **std**
* [`END`](kcl/consts/std-END)
* [`START`](kcl/consts/std-START)
* [`X`](kcl/consts/std-X)
* [`XY`](kcl/consts/std-XY)
* [`XZ`](kcl/consts/std-XZ)
* [`Y`](kcl/consts/std-Y)
* [`YZ`](kcl/consts/std-YZ)
* [`Z`](kcl/consts/std-Z)
* [`angledLine`](kcl/angledLine)
* [`angledLineThatIntersects`](kcl/angledLineThatIntersects)
* [`appearance`](kcl/appearance)
@ -45,7 +31,7 @@ layout: manual
* [`getNextAdjacentEdge`](kcl/getNextAdjacentEdge)
* [`getOppositeEdge`](kcl/getOppositeEdge)
* [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge)
* [`helix`](kcl/std-helix)
* [`helix`](kcl/functions/std-helix)
* [`intersect`](kcl/intersect)
* [`involuteCircular`](kcl/involuteCircular)
* [`lastSegX`](kcl/lastSegX)
@ -56,7 +42,7 @@ layout: manual
* [`line`](kcl/line)
* [`loft`](kcl/loft)
* [`map`](kcl/map)
* [`offsetPlane`](kcl/std-offsetPlane)
* [`offsetPlane`](kcl/functions/std-offsetPlane)
* [`patternCircular2d`](kcl/patternCircular2d)
* [`patternCircular3d`](kcl/patternCircular3d)
* [`patternLinear2d`](kcl/patternLinear2d)
@ -70,7 +56,7 @@ layout: manual
* [`profileStartY`](kcl/profileStartY)
* [`push`](kcl/push)
* [`reduce`](kcl/reduce)
* [`revolve`](kcl/std-revolve)
* [`revolve`](kcl/functions/std-revolve)
* [`rotate`](kcl/rotate)
* [`scale`](kcl/scale)
* [`segAng`](kcl/segAng)
@ -92,61 +78,90 @@ layout: manual
* [`union`](kcl/union)
* [`xLine`](kcl/xLine)
* [`yLine`](kcl/yLine)
* **std::math**
* [`abs`](kcl/functions/std-math-abs)
* [`acos`](kcl/functions/std-math-acos)
* [`asin`](kcl/functions/std-math-asin)
* [`atan`](kcl/functions/std-math-atan)
* [`atan2`](kcl/functions/std-math-atan2)
* [`ceil`](kcl/functions/std-math-ceil)
* [`cos`](kcl/functions/std-math-cos)
* [`floor`](kcl/functions/std-math-floor)
* [`ln`](kcl/functions/std-math-ln)
* [`log`](kcl/functions/std-math-log)
* [`log10`](kcl/functions/std-math-log10)
* [`log2`](kcl/functions/std-math-log2)
* [`max`](kcl/functions/std-math-max)
* [`min`](kcl/functions/std-math-min)
* [`polar`](kcl/functions/std-math-polar)
* [`pow`](kcl/functions/std-math-pow)
* [`rem`](kcl/functions/std-math-rem)
* [`round`](kcl/functions/std-math-round)
* [`sin`](kcl/functions/std-math-sin)
* [`sqrt`](kcl/functions/std-math-sqrt)
* [`tan`](kcl/functions/std-math-tan)
* **std::sketch**
* [`circle`](kcl/functions/std-sketch-circle)
* [`mirror2d`](kcl/functions/std-sketch-mirror2d)
* **std::solid**
* [`chamfer`](kcl/functions/std-solid-chamfer)
* [`fillet`](kcl/functions/std-solid-fillet)
* [`hollow`](kcl/functions/std-solid-hollow)
* [`shell`](kcl/functions/std-solid-shell)
* **std::units**
* [`units::toCentimeters`](kcl/functions/std-units-toCentimeters)
* [`units::toDegrees`](kcl/functions/std-units-toDegrees)
* [`units::toFeet`](kcl/functions/std-units-toFeet)
* [`units::toInches`](kcl/functions/std-units-toInches)
* [`units::toMeters`](kcl/functions/std-units-toMeters)
* [`units::toMillimeters`](kcl/functions/std-units-toMillimeters)
* [`units::toRadians`](kcl/functions/std-units-toRadians)
* [`units::toYards`](kcl/functions/std-units-toYards)
### Constants
* **std**
* [`END`](kcl/consts/std-END)
* [`START`](kcl/consts/std-START)
* [`X`](kcl/consts/std-X)
* [`XY`](kcl/consts/std-XY)
* [`XZ`](kcl/consts/std-XZ)
* [`Y`](kcl/consts/std-Y)
* [`YZ`](kcl/consts/std-YZ)
* [`Z`](kcl/consts/std-Z)
* **std::math**
* [`E`](kcl/consts/std-math-E)
* [`PI`](kcl/consts/std-math-PI)
* [`TAU`](kcl/consts/std-math-TAU)
* [`abs`](kcl/std-math-abs)
* [`acos`](kcl/std-math-acos)
* [`asin`](kcl/std-math-asin)
* [`atan`](kcl/std-math-atan)
* [`atan2`](kcl/std-math-atan2)
* [`ceil`](kcl/std-math-ceil)
* [`cos`](kcl/std-math-cos)
* [`floor`](kcl/std-math-floor)
* [`ln`](kcl/std-math-ln)
* [`log`](kcl/std-math-log)
* [`log10`](kcl/std-math-log10)
* [`log2`](kcl/std-math-log2)
* [`max`](kcl/std-math-max)
* [`min`](kcl/std-math-min)
* [`polar`](kcl/std-math-polar)
* [`pow`](kcl/std-math-pow)
* [`rem`](kcl/std-math-rem)
* [`round`](kcl/std-math-round)
* [`sin`](kcl/std-math-sin)
* [`sqrt`](kcl/std-math-sqrt)
* [`tan`](kcl/std-math-tan)
* **std::sketch**
* [`circle`](kcl/std-sketch-circle)
* [`mirror2d`](kcl/std-sketch-mirror2d)
* **std::solid**
* [`chamfer`](kcl/std-solid-chamfer)
* [`fillet`](kcl/std-solid-fillet)
* [`hollow`](kcl/std-solid-hollow)
* [`shell`](kcl/std-solid-shell)
* **std::turns**
* [`turns::HALF_TURN`](kcl/consts/std-turns-HALF_TURN)
* [`turns::QUARTER_TURN`](kcl/consts/std-turns-QUARTER_TURN)
* [`turns::THREE_QUARTER_TURN`](kcl/consts/std-turns-THREE_QUARTER_TURN)
* [`turns::ZERO`](kcl/consts/std-turns-ZERO)
### Types
See also the [types overview](types)
* **Primitive types**
* [`End`](kcl/types.md#End)
* [`ImportedGeometry`](kcl/types.md#ImportedGeometry)
* [`Start`](kcl/types.md#Start)
* [`TagDeclarator`](kcl/types.md#TagDeclarator)
* [`TagIdentifier`](kcl/types.md#TagIdentifier)
* [`any`](kcl/types/std-types-any)
* [`bool`](kcl/types/std-types-bool)
* [`number`](kcl/types/std-types-number)
* [`string`](kcl/types/std-types-string)
* [`tag`](kcl/types/std-types-tag)
* **std::types**
* [`Axis2d`](kcl/types/Axis2d)
* [`Axis3d`](kcl/types/Axis3d)
* [`Edge`](kcl/types/Edge)
* [`Face`](kcl/types/Face)
* [`Helix`](kcl/types/Helix)
* [`Plane`](kcl/types/Plane)
* [`Point2d`](kcl/types/Point2d)
* [`Point3d`](kcl/types/Point3d)
* [`Sketch`](kcl/types/Sketch)
* [`Solid`](kcl/types/Solid)
* **std::units**
* [`units::toCentimeters`](kcl/std-units-toCentimeters)
* [`units::toDegrees`](kcl/std-units-toDegrees)
* [`units::toFeet`](kcl/std-units-toFeet)
* [`units::toInches`](kcl/std-units-toInches)
* [`units::toMeters`](kcl/std-units-toMeters)
* [`units::toMillimeters`](kcl/std-units-toMillimeters)
* [`units::toRadians`](kcl/std-units-toRadians)
* [`units::toYards`](kcl/std-units-toYards)
* [`Axis2d`](kcl/types/std-types-Axis2d)
* [`Axis3d`](kcl/types/std-types-Axis3d)
* [`Edge`](kcl/types/std-types-Edge)
* [`Face`](kcl/types/std-types-Face)
* [`Helix`](kcl/types/std-types-Helix)
* [`Plane`](kcl/types/std-types-Plane)
* [`Point2d`](kcl/types/std-types-Point2d)
* [`Point3d`](kcl/types/std-types-Point3d)
* [`Sketch`](kcl/types/std-types-Sketch)
* [`Solid`](kcl/types/std-types-Solid)

File diff suppressed because one or more lines are too long

View File

@ -10,9 +10,9 @@ Intersect computes the geometric intersection of multiple solid bodies, returnin
```kcl
intersect(
solids: [[[Solid](/docs/kcl/types/Solid)]](/docs/kcl/types/[Solid](/docs/kcl/types/Solid)),
tolerance?: [number](/docs/kcl/types/number),
): [[[Solid](/docs/kcl/types/Solid)]](/docs/kcl/types/[Solid](/docs/kcl/types/Solid))
solids: [Solid],
tolerance?: number,
): [Solid]
```
@ -20,12 +20,12 @@ intersect(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `solids` | [`[Solid]`](/docs/kcl/types/Solid) | The solids to intersect. | Yes |
| `tolerance` | [`number`](/docs/kcl/types/number) | The tolerance to use for the intersection operation. | No |
| `solids` | [`[Solid]`](/docs/kcl/types/std-types-Solid) | The solids to intersect. | Yes |
| `tolerance` | [`number`](/docs/kcl/types/std-types-number) | The tolerance to use for the intersection operation. | No |
### Returns
[`[Solid]`](/docs/kcl/types/Solid)
[`[Solid]`](/docs/kcl/types/std-types-Solid)
### Examples
@ -44,8 +44,8 @@ fn cube(center, size) {
|> extrude(length = 10)
}
part001 = cube([0, 0], 10)
part002 = cube([7, 3], 5)
part001 = cube(center = [0, 0], size = 10)
part002 = cube(center = [7, 3], size = 5)
|> translate(z = 1)
intersectedPart = intersect([part001, part002])
@ -69,8 +69,8 @@ fn cube(center, size) {
|> extrude(length = 10)
}
part001 = cube([0, 0], 10)
part002 = cube([7, 3], 5)
part001 = cube(center = [0, 0], size = 10)
part002 = cube(center = [7, 3], size = 5)
|> translate(z = 1)
// This is the equivalent of: intersect([part001, part002])

View File

@ -10,13 +10,13 @@ Extend the current sketch with a new involute circular curve.
```kcl
involuteCircular(
sketch: [Sketch](/docs/kcl/types/Sketch),
startRadius: [number](/docs/kcl/types/number),
endRadius: [number](/docs/kcl/types/number),
angle: [number](/docs/kcl/types/number),
reverse?: [bool](/docs/kcl/types/bool),
tag?: [TagDeclarator](/docs/kcl/types#tag-declaration),
): [Sketch](/docs/kcl/types/Sketch)
sketch: Sketch,
startRadius: number,
endRadius: number,
angle: number,
reverse?: bool,
tag?: TagDeclarator,
): Sketch
```
@ -24,16 +24,16 @@ involuteCircular(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `startRadius` | [`number`](/docs/kcl/types/number) | The involute is described between two circles, start_radius is the radius of the inner circle. | Yes |
| `endRadius` | [`number`](/docs/kcl/types/number) | The involute is described between two circles, end_radius is the radius of the outer circle. | Yes |
| `angle` | [`number`](/docs/kcl/types/number) | The angle to rotate the involute by. A value of zero will produce a curve with a tangent along the x-axis at the start point of the curve. | Yes |
| `reverse` | [`bool`](/docs/kcl/types/bool) | If reverse is true, the segment will start from the end of the involute, otherwise it will start from that start. Defaults to false. | No |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
| `sketch` | [`Sketch`](/docs/kcl/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
| `startRadius` | [`number`](/docs/kcl/types/std-types-number) | The involute is described between two circles, start_radius is the radius of the inner circle. | Yes |
| `endRadius` | [`number`](/docs/kcl/types/std-types-number) | The involute is described between two circles, end_radius is the radius of the outer circle. | Yes |
| `angle` | [`number`](/docs/kcl/types/std-types-number) | The angle to rotate the involute by. A value of zero will produce a curve with a tangent along the x-axis at the start point of the curve. | Yes |
| `reverse` | [`bool`](/docs/kcl/types/std-types-bool) | If reverse is true, the segment will start from the end of the involute, otherwise it will start from that start. Defaults to false. | No |
| [`tag`](/docs/kcl/types/std-types-tag) | [`TagDeclarator`](/docs/kcl/types#TagDeclarator) | Create a new tag which refers to this line | No |
### Returns
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl/types/std-types-Sketch)
### Examples

View File

@ -9,7 +9,7 @@ Extract the 'x' axis value of the last line segment in the provided 2-d sketch.
```kcl
lastSegX(sketch: [Sketch](/docs/kcl/types/Sketch)): [number](/docs/kcl/types/number)
lastSegX(sketch: Sketch): number
```
@ -17,11 +17,11 @@ lastSegX(sketch: [Sketch](/docs/kcl/types/Sketch)): [number](/docs/kcl/types/num
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | The sketch whose line segment is being queried | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/std-types-Sketch) | The sketch whose line segment is being queried | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -9,7 +9,7 @@ Extract the 'y' axis value of the last line segment in the provided 2-d sketch.
```kcl
lastSegY(sketch: [Sketch](/docs/kcl/types/Sketch)): [number](/docs/kcl/types/number)
lastSegY(sketch: Sketch): number
```
@ -17,11 +17,11 @@ lastSegY(sketch: [Sketch](/docs/kcl/types/Sketch)): [number](/docs/kcl/types/num
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | The sketch whose line segment is being queried | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/std-types-Sketch) | The sketch whose line segment is being queried | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -10,9 +10,9 @@ Compute the angle of the given leg for x.
```kcl
legAngX(
hypotenuse: [number](/docs/kcl/types/number),
leg: [number](/docs/kcl/types/number),
): [number](/docs/kcl/types/number)
hypotenuse: number,
leg: number,
): number
```
### Tags
@ -24,12 +24,12 @@ legAngX(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `hypotenuse` | [`number`](/docs/kcl/types/number) | The length of the triangle's hypotenuse | Yes |
| `leg` | [`number`](/docs/kcl/types/number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes |
| `hypotenuse` | [`number`](/docs/kcl/types/std-types-number) | The length of the triangle's hypotenuse | Yes |
| `leg` | [`number`](/docs/kcl/types/std-types-number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -10,9 +10,9 @@ Compute the angle of the given leg for y.
```kcl
legAngY(
hypotenuse: [number](/docs/kcl/types/number),
leg: [number](/docs/kcl/types/number),
): [number](/docs/kcl/types/number)
hypotenuse: number,
leg: number,
): number
```
### Tags
@ -24,12 +24,12 @@ legAngY(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `hypotenuse` | [`number`](/docs/kcl/types/number) | The length of the triangle's hypotenuse | Yes |
| `leg` | [`number`](/docs/kcl/types/number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes |
| `hypotenuse` | [`number`](/docs/kcl/types/std-types-number) | The length of the triangle's hypotenuse | Yes |
| `leg` | [`number`](/docs/kcl/types/std-types-number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -10,9 +10,9 @@ Compute the length of the given leg.
```kcl
legLen(
hypotenuse: [number](/docs/kcl/types/number),
leg: [number](/docs/kcl/types/number),
): [number](/docs/kcl/types/number)
hypotenuse: number,
leg: number,
): number
```
### Tags
@ -24,12 +24,12 @@ legLen(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `hypotenuse` | [`number`](/docs/kcl/types/number) | The length of the triangle's hypotenuse | Yes |
| `leg` | [`number`](/docs/kcl/types/number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes |
| `hypotenuse` | [`number`](/docs/kcl/types/std-types-number) | The length of the triangle's hypotenuse | Yes |
| `leg` | [`number`](/docs/kcl/types/std-types-number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -10,11 +10,11 @@ Extend the current sketch with a new straight line.
```kcl
line(
sketch: [Sketch](/docs/kcl/types/Sketch),
endAbsolute?: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
end?: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
tag?: [TagDeclarator](/docs/kcl/types#tag-declaration),
): [Sketch](/docs/kcl/types/Sketch)
sketch: Sketch,
endAbsolute?: Point2d,
end?: Point2d,
tag?: TagDeclarator,
): Sketch
```
@ -22,14 +22,14 @@ line(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `endAbsolute` | [`[number]`](/docs/kcl/types/number) | Which absolute point should this line go to? Incompatible with `end`. | No |
| `end` | [`[number]`](/docs/kcl/types/number) | How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`. | No |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
| `sketch` | [`Sketch`](/docs/kcl/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
| `endAbsolute` | [`Point2d`](/docs/kcl/types/std-types-Point2d) | Which absolute point should this line go to? Incompatible with `end`. | No |
| `end` | [`Point2d`](/docs/kcl/types/std-types-Point2d) | How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`. | No |
| [`tag`](/docs/kcl/types/std-types-tag) | [`TagDeclarator`](/docs/kcl/types#TagDeclarator) | Create a new tag which refers to this line | No |
### Returns
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl/types/std-types-Sketch)
### Examples

View File

@ -10,14 +10,14 @@ The sketches need to closed and on the same plane.
```kcl
loft(
sketches: [[[Sketch](/docs/kcl/types/Sketch)]](/docs/kcl/types/[Sketch](/docs/kcl/types/Sketch)),
vDegree: NonZeroU32,
bezApproximateRational: [bool](/docs/kcl/types/bool),
baseCurveIndex?: integer,
tolerance?: [number](/docs/kcl/types/number),
tagStart?: [TagDeclarator](/docs/kcl/types#tag-declaration),
tagEnd?: [TagDeclarator](/docs/kcl/types#tag-declaration),
): [Solid](/docs/kcl/types/Solid)
sketches: [Sketch],
vDegree: number,
bezApproximateRational: bool,
baseCurveIndex?: number,
tolerance?: number,
tagStart?: TagDeclarator,
tagEnd?: TagDeclarator,
): Solid
```
@ -25,17 +25,17 @@ loft(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | Which sketches to loft. Must include at least 2 sketches. | Yes |
| `vDegree` | `NonZeroU32` | Degree of the interpolation. Must be greater than zero. For example, use 2 for quadratic, or 3 for cubic interpolation in the V direction. This defaults to 2, if not specified. | Yes |
| `bezApproximateRational` | [`bool`](/docs/kcl/types/bool) | Attempt to approximate rational curves (such as arcs) using a bezier. This will remove banding around interpolations between arcs and non-arcs. It may produce errors in other scenarios Over time, this field won't be necessary. | Yes |
| `baseCurveIndex` | `integer` | This can be set to override the automatically determined topological base curve, which is usually the first section encountered. | No |
| `tolerance` | [`number`](/docs/kcl/types/number) | Tolerance for the loft operation. | No |
| `tagStart` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the start of the loft, i.e. the original sketch | No |
| `tagEnd` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the end of the loft, i.e. the last sketch | No |
| `sketches` | [`[Sketch]`](/docs/kcl/types/std-types-Sketch) | Which sketches to loft. Must include at least 2 sketches. | Yes |
| `vDegree` | [`number`](/docs/kcl/types/std-types-number) | Degree of the interpolation. Must be greater than zero. For example, use 2 for quadratic, or 3 for cubic interpolation in the V direction. This defaults to 2, if not specified. | Yes |
| `bezApproximateRational` | [`bool`](/docs/kcl/types/std-types-bool) | Attempt to approximate rational curves (such as arcs) using a bezier. This will remove banding around interpolations between arcs and non-arcs. It may produce errors in other scenarios Over time, this field won't be necessary. | Yes |
| `baseCurveIndex` | [`number`](/docs/kcl/types/std-types-number) | This can be set to override the automatically determined topological base curve, which is usually the first section encountered. | No |
| `tolerance` | [`number`](/docs/kcl/types/std-types-number) | Tolerance for the loft operation. | No |
| `tagStart` | [`TagDeclarator`](/docs/kcl/types#TagDeclarator) | A named tag for the face at the start of the loft, i.e. the original sketch | No |
| `tagEnd` | [`TagDeclarator`](/docs/kcl/types#TagDeclarator) | A named tag for the face at the end of the loft, i.e. the last sketch | No |
### Returns
[`Solid`](/docs/kcl/types/Solid)
[`Solid`](/docs/kcl/types/std-types-Solid)
### Examples

View File

@ -10,9 +10,9 @@ Given a list like `[a, b, c]`, and a function like `f`, returns `[f(a), f(b), f(
```kcl
map(
array: [[[KclValue](/docs/kcl/types/KclValue)]](/docs/kcl/types/[KclValue](/docs/kcl/types/KclValue)),
array: [any],
f: FunctionSource,
): [[[KclValue](/docs/kcl/types/KclValue)]](/docs/kcl/types/[KclValue](/docs/kcl/types/KclValue))
): [any]
```
@ -20,19 +20,19 @@ map(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | Input array. The output array is this input array, but every element has had the function `f` run on it. | Yes |
| `array` | [`[any]`](/docs/kcl/types/std-types-any) | Input array. The output array is this input array, but every element has had the function `f` run on it. | Yes |
| `f` | `FunctionSource` | A function. The output array is just the input array, but `f` has been run on every item. | Yes |
### Returns
[`[KclValue]`](/docs/kcl/types/KclValue)
[`[any]`](/docs/kcl/types/std-types-any)
### Examples
```kcl
r = 10 // radius
fn drawCircle(id) {
fn drawCircle(@id) {
return startSketchOn(XY)
|> circle(center = [id * 2 * r, 0], radius = r)
}

View File

@ -12,7 +12,7 @@ to other modules.
```kcl
// util.kcl
export fn increment(x) {
export fn increment(@x) {
return x + 1
}
```
@ -37,11 +37,11 @@ Multiple functions can be exported in a file.
```kcl
// util.kcl
export fn increment(x) {
export fn increment(@x) {
return x + 1
}
export fn decrement(x) {
export fn decrement(@x) {
return x - 1
}
```
@ -81,7 +81,7 @@ fn cube(center) {
|> extrude(length = 10)
}
myCube = cube([0, 0])
myCube = cube(center = [0, 0])
```
*Pros*

View File

@ -10,13 +10,13 @@ Repeat a 2-dimensional sketch some number of times along a partial or complete c
```kcl
patternCircular2d(
sketchSet: [[[Sketch](/docs/kcl/types/Sketch)]](/docs/kcl/types/[Sketch](/docs/kcl/types/Sketch)),
instances: integer,
center: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
arcDegrees: [number](/docs/kcl/types/number),
rotateDuplicates: [bool](/docs/kcl/types/bool),
useOriginal?: [bool](/docs/kcl/types/bool),
): [[[Sketch](/docs/kcl/types/Sketch)]](/docs/kcl/types/[Sketch](/docs/kcl/types/Sketch))
sketchSet: [Sketch],
instances: number,
center: Point2d,
arcDegrees: number,
rotateDuplicates: bool,
useOriginal?: bool,
): [Sketch]
```
@ -24,16 +24,16 @@ patternCircular2d(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketchSet` | [`[Sketch]`](/docs/kcl/types/Sketch) | Which sketch(es) to pattern | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `center` | [`[number]`](/docs/kcl/types/number) | The center about which to make the pattern. This is a 2D vector. | Yes |
| `arcDegrees` | [`number`](/docs/kcl/types/number) | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
| `rotateDuplicates` | [`bool`](/docs/kcl/types/bool) | Whether or not to rotate the duplicates as they are copied. | Yes |
| `useOriginal` | [`bool`](/docs/kcl/types/bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
| `sketchSet` | [`[Sketch]`](/docs/kcl/types/std-types-Sketch) | Which sketch(es) to pattern | Yes |
| `instances` | [`number`](/docs/kcl/types/std-types-number) | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `center` | [`Point2d`](/docs/kcl/types/std-types-Point2d) | The center about which to make the pattern. This is a 2D vector. | Yes |
| `arcDegrees` | [`number`](/docs/kcl/types/std-types-number) | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
| `rotateDuplicates` | [`bool`](/docs/kcl/types/std-types-bool) | Whether or not to rotate the duplicates as they are copied. | Yes |
| `useOriginal` | [`bool`](/docs/kcl/types/std-types-bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns
[`[Sketch]`](/docs/kcl/types/Sketch)
[`[Sketch]`](/docs/kcl/types/std-types-Sketch)
### Examples

View File

@ -10,14 +10,14 @@ Repeat a 3-dimensional solid some number of times along a partial or complete ci
```kcl
patternCircular3d(
solids: [[[Solid](/docs/kcl/types/Solid)]](/docs/kcl/types/[Solid](/docs/kcl/types/Solid)),
instances: integer,
axis: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
center: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
arcDegrees: [number](/docs/kcl/types/number),
rotateDuplicates: [bool](/docs/kcl/types/bool),
useOriginal?: [bool](/docs/kcl/types/bool),
): [[[Solid](/docs/kcl/types/Solid)]](/docs/kcl/types/[Solid](/docs/kcl/types/Solid))
solids: [Solid],
instances: number,
axis: [number],
center: Point3d,
arcDegrees: number,
rotateDuplicates: bool,
useOriginal?: bool,
): [Solid]
```
@ -25,17 +25,17 @@ patternCircular3d(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `solids` | [`[Solid]`](/docs/kcl/types/Solid) | Which solid(s) to pattern | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `axis` | [`[number]`](/docs/kcl/types/number) | The axis around which to make the pattern. This is a 3D vector | Yes |
| `center` | [`[number]`](/docs/kcl/types/number) | The center about which to make the pattern. This is a 3D vector. | Yes |
| `arcDegrees` | [`number`](/docs/kcl/types/number) | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
| `rotateDuplicates` | [`bool`](/docs/kcl/types/bool) | Whether or not to rotate the duplicates as they are copied. | Yes |
| `useOriginal` | [`bool`](/docs/kcl/types/bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
| `solids` | [`[Solid]`](/docs/kcl/types/std-types-Solid) | Which solid(s) to pattern | Yes |
| `instances` | [`number`](/docs/kcl/types/std-types-number) | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `axis` | [`[number]`](/docs/kcl/types/std-types-number) | The axis around which to make the pattern. This is a 3D vector | Yes |
| `center` | [`Point3d`](/docs/kcl/types/std-types-Point3d) | The center about which to make the pattern. This is a 3D vector. | Yes |
| `arcDegrees` | [`number`](/docs/kcl/types/std-types-number) | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
| `rotateDuplicates` | [`bool`](/docs/kcl/types/std-types-bool) | Whether or not to rotate the duplicates as they are copied. | Yes |
| `useOriginal` | [`bool`](/docs/kcl/types/std-types-bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns
[`[Solid]`](/docs/kcl/types/Solid)
[`[Solid]`](/docs/kcl/types/std-types-Solid)
### Examples

View File

@ -10,12 +10,12 @@ Repeat a 2-dimensional sketch along some dimension, with a dynamic amount of dis
```kcl
patternLinear2d(
sketches: [[[Sketch](/docs/kcl/types/Sketch)]](/docs/kcl/types/[Sketch](/docs/kcl/types/Sketch)),
instances: integer,
distance: [number](/docs/kcl/types/number),
axis: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
useOriginal?: [bool](/docs/kcl/types/bool),
): [[[Sketch](/docs/kcl/types/Sketch)]](/docs/kcl/types/[Sketch](/docs/kcl/types/Sketch))
sketches: [Sketch],
instances: number,
distance: number,
axis: Point2d,
useOriginal?: bool,
): [Sketch]
```
@ -23,15 +23,15 @@ patternLinear2d(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | The sketch(es) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `distance` | [`number`](/docs/kcl/types/number) | Distance between each repetition. Also known as 'spacing'. | Yes |
| `axis` | [`[number]`](/docs/kcl/types/number) | The axis of the pattern. A 2D vector. | Yes |
| `useOriginal` | [`bool`](/docs/kcl/types/bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
| `sketches` | [`[Sketch]`](/docs/kcl/types/std-types-Sketch) | The sketch(es) to duplicate | Yes |
| `instances` | [`number`](/docs/kcl/types/std-types-number) | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `distance` | [`number`](/docs/kcl/types/std-types-number) | Distance between each repetition. Also known as 'spacing'. | Yes |
| `axis` | [`Point2d`](/docs/kcl/types/std-types-Point2d) | The axis of the pattern. A 2D vector. | Yes |
| `useOriginal` | [`bool`](/docs/kcl/types/std-types-bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns
[`[Sketch]`](/docs/kcl/types/Sketch)
[`[Sketch]`](/docs/kcl/types/std-types-Sketch)
### Examples

View File

@ -10,12 +10,12 @@ Repeat a 3-dimensional solid along a linear path, with a dynamic amount of dista
```kcl
patternLinear3d(
solids: [[[Solid](/docs/kcl/types/Solid)]](/docs/kcl/types/[Solid](/docs/kcl/types/Solid)),
instances: integer,
distance: [number](/docs/kcl/types/number),
axis: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
useOriginal?: [bool](/docs/kcl/types/bool),
): [[[Solid](/docs/kcl/types/Solid)]](/docs/kcl/types/[Solid](/docs/kcl/types/Solid))
solids: [Solid],
instances: number,
distance: number,
axis: Point3d,
useOriginal?: bool,
): [Solid]
```
@ -23,15 +23,15 @@ patternLinear3d(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `solids` | [`[Solid]`](/docs/kcl/types/Solid) | The solid(s) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `distance` | [`number`](/docs/kcl/types/number) | Distance between each repetition. Also known as 'spacing'. | Yes |
| `axis` | [`[number]`](/docs/kcl/types/number) | The axis of the pattern. A 2D vector. | Yes |
| `useOriginal` | [`bool`](/docs/kcl/types/bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
| `solids` | [`[Solid]`](/docs/kcl/types/std-types-Solid) | The solid(s) to duplicate | Yes |
| `instances` | [`number`](/docs/kcl/types/std-types-number) | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `distance` | [`number`](/docs/kcl/types/std-types-number) | Distance between each repetition. Also known as 'spacing'. | Yes |
| `axis` | [`Point3d`](/docs/kcl/types/std-types-Point3d) | The axis of the pattern. A 2D vector. | Yes |
| `useOriginal` | [`bool`](/docs/kcl/types/std-types-bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns
[`[Solid]`](/docs/kcl/types/Solid)
[`[Solid]`](/docs/kcl/types/std-types-Solid)
### Examples

File diff suppressed because one or more lines are too long

View File

@ -10,11 +10,11 @@ Just like patternTransform, but works on 2D sketches not 3D solids.
```kcl
patternTransform2d(
sketches: [[[Sketch](/docs/kcl/types/Sketch)]](/docs/kcl/types/[Sketch](/docs/kcl/types/Sketch)),
instances: integer,
sketches: [Sketch],
instances: number,
transform: FunctionSource,
useOriginal?: [bool](/docs/kcl/types/bool),
): [[[Sketch](/docs/kcl/types/Sketch)]](/docs/kcl/types/[Sketch](/docs/kcl/types/Sketch))
useOriginal?: bool,
): [Sketch]
```
@ -22,21 +22,21 @@ patternTransform2d(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | The sketch(es) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `sketches` | [`[Sketch]`](/docs/kcl/types/std-types-Sketch) | The sketch(es) to duplicate | Yes |
| `instances` | [`number`](/docs/kcl/types/std-types-number) | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
| `useOriginal` | [`bool`](/docs/kcl/types/bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
| `useOriginal` | [`bool`](/docs/kcl/types/std-types-bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns
[`[Sketch]`](/docs/kcl/types/Sketch)
[`[Sketch]`](/docs/kcl/types/std-types-Sketch)
### Examples
```kcl
// Each instance will be shifted along the X axis.
fn transform(id) {
fn transform(@id) {
return { translate = [4 * id, 0] }
}

File diff suppressed because one or more lines are too long

View File

@ -10,12 +10,12 @@ Create a regular polygon with the specified number of sides that is either inscr
```kcl
polygon(
sketchSurfaceOrGroup: [[Sketch](/docs/kcl/types/Sketch)OrSurface](/docs/kcl/types/[Sketch](/docs/kcl/types/Sketch)OrSurface),
radius: [number](/docs/kcl/types/number),
sketchSurfaceOrGroup: Sketch | Plane | Face,
radius: number,
numSides: u64,
center: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
inscribed?: [bool](/docs/kcl/types/bool),
): [Sketch](/docs/kcl/types/Sketch)
center: Point2d,
inscribed?: bool,
): Sketch
```
@ -23,15 +23,15 @@ polygon(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on | Yes |
| `radius` | [`number`](/docs/kcl/types/number) | The radius of the polygon | Yes |
| `sketchSurfaceOrGroup` | [`Sketch`](/docs/kcl/types/std-types-Sketch) or [`Plane`](/docs/kcl/types/std-types-Plane) or [`Face`](/docs/kcl/types/std-types-Face) | Plane or surface to sketch on | Yes |
| `radius` | [`number`](/docs/kcl/types/std-types-number) | The radius of the polygon | Yes |
| `numSides` | `u64` | The number of sides in the polygon | Yes |
| `center` | [`[number]`](/docs/kcl/types/number) | The center point of the polygon | Yes |
| `inscribed` | [`bool`](/docs/kcl/types/bool) | Whether the polygon is inscribed (true, the default) or circumscribed (false) about a circle with the specified radius | No |
| `center` | [`Point2d`](/docs/kcl/types/std-types-Point2d) | The center point of the polygon | Yes |
| `inscribed` | [`bool`](/docs/kcl/types/std-types-bool) | Whether the polygon is inscribed (true, the default) or circumscribed (false) about a circle with the specified radius | No |
### Returns
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl/types/std-types-Sketch)
### Examples

View File

@ -9,7 +9,7 @@ Remove the last element from an array.
Returns a new array with the last element removed.
```kcl
pop(array: [[[KclValue](/docs/kcl/types/KclValue)]](/docs/kcl/types/[KclValue](/docs/kcl/types/KclValue))): [KclValue](/docs/kcl/types/KclValue)
pop(array: [any]): any
```
@ -17,11 +17,11 @@ pop(array: [[[KclValue](/docs/kcl/types/KclValue)]](/docs/kcl/types/[KclValue](/
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | The array to pop from. Must not be empty. | Yes |
| `array` | [`[any]`](/docs/kcl/types/std-types-any) | The array to pop from. Must not be empty. | Yes |
### Returns
[`KclValue`](/docs/kcl/types/KclValue) - Any KCL value.
[`any`](/docs/kcl/types/std-types-any) - Any KCL value.
### Examples

View File

@ -9,7 +9,7 @@ Extract the provided 2-dimensional sketch's profile's origin value.
```kcl
profileStart(profile: [Sketch](/docs/kcl/types/Sketch)): [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number))
profileStart(profile: Sketch): [number]
```
@ -17,11 +17,11 @@ profileStart(profile: [Sketch](/docs/kcl/types/Sketch)): [[[number](/docs/kcl/ty
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `profile` | [`Sketch`](/docs/kcl/types/Sketch) | Profile whose start is being used | Yes |
| `profile` | [`Sketch`](/docs/kcl/types/std-types-Sketch) | Profile whose start is being used | Yes |
### Returns
[`[number]`](/docs/kcl/types/number)
[`[number]`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -9,7 +9,7 @@ Extract the provided 2-dimensional sketch's profile's origin's 'x' value.
```kcl
profileStartX(profile: [Sketch](/docs/kcl/types/Sketch)): [number](/docs/kcl/types/number)
profileStartX(profile: Sketch): number
```
@ -17,11 +17,11 @@ profileStartX(profile: [Sketch](/docs/kcl/types/Sketch)): [number](/docs/kcl/typ
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `profile` | [`Sketch`](/docs/kcl/types/Sketch) | Profile whose start is being used | Yes |
| `profile` | [`Sketch`](/docs/kcl/types/std-types-Sketch) | Profile whose start is being used | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -9,7 +9,7 @@ Extract the provided 2-dimensional sketch's profile's origin's 'y' value.
```kcl
profileStartY(profile: [Sketch](/docs/kcl/types/Sketch)): [number](/docs/kcl/types/number)
profileStartY(profile: Sketch): number
```
@ -17,11 +17,11 @@ profileStartY(profile: [Sketch](/docs/kcl/types/Sketch)): [number](/docs/kcl/typ
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `profile` | [`Sketch`](/docs/kcl/types/Sketch) | Profile whose start is being used | Yes |
| `profile` | [`Sketch`](/docs/kcl/types/std-types-Sketch) | Profile whose start is being used | Yes |
### Returns
[`number`](/docs/kcl/types/number)
[`number`](/docs/kcl/types/std-types-number)
### Examples

View File

@ -10,9 +10,9 @@ Returns a new array with the element appended.
```kcl
push(
array: [[[KclValue](/docs/kcl/types/KclValue)]](/docs/kcl/types/[KclValue](/docs/kcl/types/KclValue)),
item: [KclValue](/docs/kcl/types/KclValue),
): [KclValue](/docs/kcl/types/KclValue)
array: [any],
item: any,
): any
```
@ -20,12 +20,12 @@ push(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | The array which you're adding a new item to. | Yes |
| `item` | [`KclValue`](/docs/kcl/types/KclValue) | The new item to add to the array | Yes |
| `array` | [`[any]`](/docs/kcl/types/std-types-any) | The array which you're adding a new item to. | Yes |
| `item` | [`any`](/docs/kcl/types/std-types-any) | The new item to add to the array | Yes |
### Returns
[`KclValue`](/docs/kcl/types/KclValue) - Any KCL value.
[`any`](/docs/kcl/types/std-types-any) - Any KCL value.
### Examples

View File

@ -10,10 +10,10 @@ Take a starting value. Then, for each element of an array, calculate the next va
```kcl
reduce(
array: [[[KclValue](/docs/kcl/types/KclValue)]](/docs/kcl/types/[KclValue](/docs/kcl/types/KclValue)),
initial: [KclValue](/docs/kcl/types/KclValue),
array: [any],
initial: any,
f: FunctionSource,
): [KclValue](/docs/kcl/types/KclValue)
): any
```
@ -21,13 +21,13 @@ reduce(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | Each element of this array gets run through the function `f`, combined with the previous output from `f`, and then used for the next run. | Yes |
| `initial` | [`KclValue`](/docs/kcl/types/KclValue) | The first time `f` is run, it will be called with the first item of `array` and this initial starting value. | Yes |
| `array` | [`[any]`](/docs/kcl/types/std-types-any) | Each element of this array gets run through the function `f`, combined with the previous output from `f`, and then used for the next run. | Yes |
| `initial` | [`any`](/docs/kcl/types/std-types-any) | The first time `f` is run, it will be called with the first item of `array` and this initial starting value. | Yes |
| `f` | `FunctionSource` | Run once per item in the input `array`. This function takes an item from the array, and the previous output from `f` (or `initial` on the very first run). The final time `f` is run, its output is returned as the final output from `reduce`. | Yes |
### Returns
[`KclValue`](/docs/kcl/types/KclValue) - Any KCL value.
[`any`](/docs/kcl/types/std-types-any) - Any KCL value.
### Examples
@ -41,7 +41,7 @@ fn add(a, b) {
// This function adds an array of numbers.
// It uses the `reduce` function, to call the `add` function on every
// element of the `arr` parameter. The starting value is 0.
fn sum(arr) {
fn sum(@arr) {
return reduce(arr, initial = 0, f = add)
}
@ -91,7 +91,7 @@ assert(
```kcl
// Declare a function that sketches a decagon.
fn decagon(radius) {
fn decagon(@radius) {
// Each side of the decagon is turned this many radians from the previous angle.
stepAngle = (1 / 10 * TAU): number(rad)

View File

@ -28,14 +28,14 @@ When rotating a part around an axis, you specify the axis of rotation and the an
```kcl
rotate(
objects: [[Solid](/docs/kcl/types/Solid)Or[Sketch](/docs/kcl/types/Sketch)OrImportedGeometry](/docs/kcl/types/[Solid](/docs/kcl/types/Solid)Or[Sketch](/docs/kcl/types/Sketch)OrImportedGeometry),
roll?: [number](/docs/kcl/types/number),
pitch?: [number](/docs/kcl/types/number),
yaw?: [number](/docs/kcl/types/number),
axis?: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
angle?: [number](/docs/kcl/types/number),
global?: [bool](/docs/kcl/types/bool),
): [[Solid](/docs/kcl/types/Solid)Or[Sketch](/docs/kcl/types/Sketch)OrImportedGeometry](/docs/kcl/types/[Solid](/docs/kcl/types/Solid)Or[Sketch](/docs/kcl/types/Sketch)OrImportedGeometry)
objects: [Solid] | [Sketch] | ImportedGeometry,
roll?: number,
pitch?: number,
yaw?: number,
axis?: [number],
angle?: number,
global?: bool,
): [Solid] | [Sketch] | ImportedGeometry
```
@ -43,17 +43,17 @@ rotate(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `objects` | [`SolidOrSketchOrImportedGeometry`](/docs/kcl/types/SolidOrSketchOrImportedGeometry) | The solid, sketch, or set of solids or sketches to rotate. | Yes |
| `roll` | [`number`](/docs/kcl/types/number) | The roll angle in degrees. Must be between -360 and 360. Default is 0 if not given. | No |
| `pitch` | [`number`](/docs/kcl/types/number) | The pitch angle in degrees. Must be between -360 and 360. Default is 0 if not given. | No |
| `yaw` | [`number`](/docs/kcl/types/number) | The yaw angle in degrees. Must be between -360 and 360. Default is 0 if not given. | No |
| `axis` | [`[number]`](/docs/kcl/types/number) | The axis to rotate around. Must be used with `angle`. | No |
| `angle` | [`number`](/docs/kcl/types/number) | The angle to rotate in degrees. Must be used with `axis`. Must be between -360 and 360. | No |
| `global` | [`bool`](/docs/kcl/types/bool) | If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move. | No |
| `objects` | [`[Solid]`](/docs/kcl/types/std-types-Solid) or [`[Sketch]`](/docs/kcl/types/std-types-Sketch) or [`ImportedGeometry`](/docs/kcl/types#ImportedGeometry) | The solid, sketch, or set of solids or sketches to rotate. | Yes |
| `roll` | [`number`](/docs/kcl/types/std-types-number) | The roll angle in degrees. Must be between -360 and 360. Default is 0 if not given. | No |
| `pitch` | [`number`](/docs/kcl/types/std-types-number) | The pitch angle in degrees. Must be between -360 and 360. Default is 0 if not given. | No |
| `yaw` | [`number`](/docs/kcl/types/std-types-number) | The yaw angle in degrees. Must be between -360 and 360. Default is 0 if not given. | No |
| `axis` | [`[number]`](/docs/kcl/types/std-types-number) | The axis to rotate around. Must be used with `angle`. | No |
| `angle` | [`number`](/docs/kcl/types/std-types-number) | The angle to rotate in degrees. Must be used with `axis`. Must be between -360 and 360. | No |
| `global` | [`bool`](/docs/kcl/types/std-types-bool) | If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move. | No |
### Returns
[`SolidOrSketchOrImportedGeometry`](/docs/kcl/types/SolidOrSketchOrImportedGeometry) - Data for a solid, sketch, or an imported geometry.
[`[Solid]`](/docs/kcl/types/std-types-Solid) or [`[Sketch]`](/docs/kcl/types/std-types-Sketch) or [`ImportedGeometry`](/docs/kcl/types#ImportedGeometry) - Data for a solid, sketch, or an imported geometry.
### Examples

View File

@ -16,12 +16,12 @@ If you want to apply the transform in global space, set `global` to `true`. The
```kcl
scale(
objects: [[Solid](/docs/kcl/types/Solid)Or[Sketch](/docs/kcl/types/Sketch)OrImportedGeometry](/docs/kcl/types/[Solid](/docs/kcl/types/Solid)Or[Sketch](/docs/kcl/types/Sketch)OrImportedGeometry),
x?: [number](/docs/kcl/types/number),
y?: [number](/docs/kcl/types/number),
z?: [number](/docs/kcl/types/number),
global?: [bool](/docs/kcl/types/bool),
): [[Solid](/docs/kcl/types/Solid)Or[Sketch](/docs/kcl/types/Sketch)OrImportedGeometry](/docs/kcl/types/[Solid](/docs/kcl/types/Solid)Or[Sketch](/docs/kcl/types/Sketch)OrImportedGeometry)
objects: [Solid] | [Sketch] | ImportedGeometry,
x?: number,
y?: number,
z?: number,
global?: bool,
): [Solid] | [Sketch] | ImportedGeometry
```
@ -29,15 +29,15 @@ scale(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `objects` | [`SolidOrSketchOrImportedGeometry`](/docs/kcl/types/SolidOrSketchOrImportedGeometry) | The solid, sketch, or set of solids or sketches to scale. | Yes |
| `x` | [`number`](/docs/kcl/types/number) | The scale factor for the x axis. Default is 1 if not provided. | No |
| `y` | [`number`](/docs/kcl/types/number) | The scale factor for the y axis. Default is 1 if not provided. | No |
| `z` | [`number`](/docs/kcl/types/number) | The scale factor for the z axis. Default is 1 if not provided. | No |
| `global` | [`bool`](/docs/kcl/types/bool) | If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move. | No |
| `objects` | [`[Solid]`](/docs/kcl/types/std-types-Solid) or [`[Sketch]`](/docs/kcl/types/std-types-Sketch) or [`ImportedGeometry`](/docs/kcl/types#ImportedGeometry) | The solid, sketch, or set of solids or sketches to scale. | Yes |
| `x` | [`number`](/docs/kcl/types/std-types-number) | The scale factor for the x axis. Default is 1 if not provided. | No |
| `y` | [`number`](/docs/kcl/types/std-types-number) | The scale factor for the y axis. Default is 1 if not provided. | No |
| `z` | [`number`](/docs/kcl/types/std-types-number) | The scale factor for the z axis. Default is 1 if not provided. | No |
| `global` | [`bool`](/docs/kcl/types/std-types-bool) | If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move. | No |
### Returns
[`SolidOrSketchOrImportedGeometry`](/docs/kcl/types/SolidOrSketchOrImportedGeometry) - Data for a solid, sketch, or an imported geometry.
[`[Solid]`](/docs/kcl/types/std-types-Solid) or [`[Sketch]`](/docs/kcl/types/std-types-Sketch) or [`ImportedGeometry`](/docs/kcl/types#ImportedGeometry) - Data for a solid, sketch, or an imported geometry.
### Examples

Some files were not shown because too many files have changed in this diff Show More