Compare commits

...

27 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
525f213f1d Assemblies: Make Clone available in releases (#6538)
* Assemblies: Make Clone available in releases
Fixes #6537

* Lint
2025-04-30 14:10:52 -04:00
58a81da039 Update Insert, Transform, and Clone codemods to match new import behavior (#6577)
* Fix operations to reflect concurrent module import behavior

* Add new generated output

* Fix root module import tracking

* Rename test so that it's easier to filter

* Update output ops

* Fix clippy

* Update output after rebase

* Update multi-axis-robot flowchart output

* Disable e2e tests until future PR

* WIP: Update Insert and Transform codemods to match new import behavior
Fixes #6570

* Fix operations to reflect concurrent module import behavior

* Add new generated output

* Fix root module import tracking

* Rename test so that it's easier to filter

* Update output ops

* Fix clippy

* Update output after rebase

* Disable e2e tests until future PR

* Update one of the tests

* Somewhat working very ugly translate

* Working translate and rotate

* Fix deletion

* Clean up things and disable tests deleting the *first* import due to unclear issue

* Fix Clone

* Clean up ahead of review

* Support cases with translate and rotate in two different pipes (but not for deletion)

* Fix generated output; probably from recent merge

* Find all pipes and look for last in most cases, adding fallbacks to set translate/rotate on the right ones

* More fixups

* Delete unused snap file

* Update src/lang/queryAst.ts

Co-authored-by: Jonathan Tran <jonnytran@gmail.com>

* Change lint ignore to be more specific

* Add test that checks we can still translate, rotate, and delete weird import code

* Clean up

---------

Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2025-04-30 13:07:39 -04:00
0002295cdf Fix operations to reflect concurrent module import behavior (#6568)
* Fix operations to reflect concurrent module import behavior

* Add new generated output

* Fix root module import tracking

* Rename test so that it's easier to filter

* Update output ops

* Fix clippy

* Update output after rebase

* Disable e2e tests until future PR

* Fix generated output; probably from recent merge

* Delete unused snap file
2025-04-30 16:26:46 +00:00
c050739f41 Some improvements to the boxed signatures in the docs (#6593)
* Show a more reasonable name in function docs

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

* Fix buggy docs for union types

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

* Make types in the docs signatures into links

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

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-04-30 16:03:22 +00:00
ccd5b0272d Add math functions back to the prelude (#6595)
* Add math functions back to the prelude

* Update output

* Update docs
2025-04-30 11:07:05 -04:00
702 changed files with 43265 additions and 29085 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

@ -8,7 +8,7 @@ Draw a line segment relative to the current origin using the polar measure of so
```js
```kcl
angledLine(
sketch: Sketch,
angle: number,
@ -26,23 +26,23 @@ 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`](/docs/kcl/types/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
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> yLine(endAbsolute = 15)

View File

@ -8,7 +8,7 @@ Draw an angled line from the current origin, constructing a line segment such th
```js
```kcl
angledLineThatIntersects(
sketch: Sketch,
angle: number,
@ -23,20 +23,20 @@ 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`](/docs/kcl/types/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
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(endAbsolute = [5, 10])

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@ Check a value meets some expected conditions at runtime. Program terminates with
```js
```kcl
assert(
actual: number,
isGreaterThan?: number,
@ -17,7 +17,7 @@ assert(
isLessThanOrEqual?: number,
isEqualTo?: number,
tolerance?: number,
error?: String,
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
@ -42,7 +42,7 @@ assert(
### Examples
```js
```kcl
n = 10
assert(n, isEqualTo = 10)
assert(

View File

@ -8,10 +8,10 @@ Asserts that a value is the boolean value true.
```js
```kcl
assertIs(
actual: bool,
error?: String,
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
@ -30,7 +30,7 @@ assertIs(
### Examples
```js
```kcl
kclIsFun = true
assertIs(kclIsFun)
```

View File

@ -8,12 +8,12 @@ Draw a smooth, continuous, curved line segment from the current origin to the de
```js
```kcl
bezierCurve(
sketch: Sketch,
control1: [number],
control2: [number],
end: [number],
control1: Point2d,
control2: Point2d,
end: Point2d,
tag?: TagDeclarator,
): Sketch
```
@ -23,20 +23,20 @@ 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`](/docs/kcl/types/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
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(end = [0, 10])

View File

@ -8,12 +8,12 @@ Construct a circle derived from 3 points.
```js
```kcl
circleThreePoint(
sketchSurfaceOrGroup: SketchOrSurface,
p1: [number],
p2: [number],
p3: [number],
sketchSurfaceOrGroup: Sketch | Plane | Face,
p1: Point2d,
p2: Point2d,
p3: Point2d,
tag?: TagDeclarator,
): Sketch
```
@ -23,20 +23,20 @@ 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`](/docs/kcl/types/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
```js
```kcl
exampleSketch = startSketchOn(XY)
|> circleThreePoint(p1 = [10, 10], p2 = [20, 8], p3 = [15, 5])
|> extrude(length = 5)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@ Identifies the ending face of an extrusion. I.e., the new face created by an ext
```js
```kcl
std::END: string = 'end'
```

View File

@ -8,7 +8,7 @@ Identifies the starting face of an extrusion. I.e., the face which is extruded.
```js
```kcl
std::START: string = 'start'
```

View File

@ -8,7 +8,7 @@ layout: manual
```js
```kcl
std::X
```

View File

@ -8,7 +8,7 @@ layout: manual
```js
```kcl
std::XY
```

View File

@ -8,7 +8,7 @@ layout: manual
```js
```kcl
std::XZ
```

View File

@ -8,7 +8,7 @@ layout: manual
```js
```kcl
std::Y
```

View File

@ -8,7 +8,7 @@ layout: manual
```js
```kcl
std::YZ
```

View File

@ -8,7 +8,7 @@ layout: manual
```js
```kcl
std::Z
```

View File

@ -8,13 +8,13 @@ The value of Eulers number `e`.
```js
```kcl
std::math::E: number = 2.71828182845904523536028747135266250_
```
### Examples
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(

View File

@ -8,13 +8,13 @@ The value of `pi`, Archimedes constant (π).
```js
```kcl
std::math::PI: number(_?) = 3.14159265358979323846264338327950288_?
```
### Examples
```js
```kcl
circumference = 70
exampleSketch = startSketchOn(XZ)

View File

@ -8,13 +8,13 @@ The value of `tau`, the full circle constant (τ). Equal to 2π.
```js
```kcl
std::math::TAU: number = 6.28318530717958647692528676655900577_
```
### Examples
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(

View File

@ -8,7 +8,7 @@ layout: manual
```js
```kcl
std::turns::HALF_TURN: number(deg) = 180deg
```

View File

@ -8,7 +8,7 @@ layout: manual
```js
```kcl
std::turns::QUARTER_TURN: number(deg) = 90deg
```

View File

@ -8,7 +8,7 @@ layout: manual
```js
```kcl
std::turns::THREE_QUARTER_TURN: number(deg) = 270deg
```

View File

@ -8,7 +8,7 @@ layout: manual
```js
```kcl
std::turns::ZERO: number = 0
```

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

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

@ -8,7 +8,7 @@ Compute the absolute value of a number.
```js
```kcl
abs(@input: number): number
```
@ -17,23 +17,23 @@ abs(@input: number): 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
```js
```kcl
myAngle = -120
sketch001 = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(end = [8, 0])
|> angledLine(
angle = math::abs(myAngle),
angle = abs(myAngle),
length = 5,
)
|> line(end = [-5, 0])

View File

@ -8,7 +8,7 @@ Compute the arccosine of a number.
```js
```kcl
acos(@num: number(_)): number(rad)
```
@ -26,11 +26,11 @@ acos(@num: number(_)): number(rad)
### Examples
```js
```kcl
sketch001 = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(
angle = math::acos(0.5),
angle = acos(0.5),
length = 10,
)
|> line(end = [5, 0])

View File

@ -8,7 +8,7 @@ Compute the arcsine of a number.
```js
```kcl
asin(@num: number(_)): number(rad)
```
@ -26,11 +26,11 @@ asin(@num: number(_)): number(rad)
### Examples
```js
```kcl
sketch001 = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(
angle = math::asin(0.5),
angle = asin(0.5),
length = 20,
)
|> yLine(endAbsolute = 0)

View File

@ -8,7 +8,7 @@ Compute the arctangent of a number.
Consider using `atan2()` instead for the true inverse of tangent.
```js
```kcl
atan(@num: number(_)): number(rad)
```
@ -26,11 +26,11 @@ atan(@num: number(_)): number(rad)
### Examples
```js
```kcl
sketch001 = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(
angle = math::atan(1.25),
angle = atan(1.25),
length = 20,
)
|> yLine(endAbsolute = 0)

View File

@ -8,7 +8,7 @@ Compute the four quadrant arctangent of Y and X.
```js
```kcl
atan2(
y: number(Length),
x: number(Length),
@ -30,11 +30,11 @@ atan2(
### Examples
```js
```kcl
sketch001 = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(
angle = math::atan2(y = 1.25, x = 2),
angle = atan2(y = 1.25, x = 2),
length = 20,
)
|> yLine(endAbsolute = 0)

View File

@ -8,7 +8,7 @@ Compute the smallest integer greater than or equal to a number.
```js
```kcl
ceil(@input: number): number
```
@ -17,20 +17,20 @@ ceil(@input: number): 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
```js
```kcl
sketch001 = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(endAbsolute = [12, 10])
|> line(end = [math::ceil(7.02986), 0])
|> line(end = [ceil(7.02986), 0])
|> yLine(endAbsolute = 0)
|> close()

View File

@ -8,7 +8,7 @@ Compute the cosine of a number.
```js
```kcl
cos(@num: number(Angle)): number(_)
```
@ -26,12 +26,12 @@ cos(@num: number(Angle)): number(_)
### Examples
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(
angle = 30,
length = 3 / math::cos(30deg),
length = 3 / cos(30deg),
)
|> yLine(endAbsolute = 0)
|> close()

View File

@ -8,7 +8,7 @@ Compute the largest integer less than or equal to a number.
```js
```kcl
floor(@input: number): number
```
@ -17,20 +17,20 @@ floor(@input: number): 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
```js
```kcl
sketch001 = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(endAbsolute = [12, 10])
|> line(end = [math::floor(7.02986), 0])
|> line(end = [floor(7.02986), 0])
|> yLine(endAbsolute = 0)
|> close()

View File

@ -8,7 +8,7 @@ Compute the natural logarithm of the number.
```js
```kcl
ln(@input: number): number
```
@ -17,19 +17,19 @@ ln(@input: number): 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
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(end = [math::ln(100), 15])
|> line(end = [ln(100), 15])
|> line(end = [5, -6])
|> line(end = [-10, -10])
|> close()

View File

@ -7,10 +7,10 @@ layout: manual
Compute the logarithm of the number with respect to an arbitrary base.
The result might not be correctly rounded owing to implementation
details; `math::log2` can produce more accurate results for base 2,
and `math::log10` can produce more accurate results for base 10.
details; `log2` can produce more accurate results for base 2,
and `log10` can produce more accurate results for base 10.
```js
```kcl
log(
@input: number,
base: number(_),
@ -22,20 +22,20 @@ 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
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(end = [math::log(100, base = 5), 0])
|> line(end = [log(100, base = 5), 0])
|> line(end = [5, 8])
|> line(end = [-10, 0])
|> close()

View File

@ -8,7 +8,7 @@ Compute the base 10 logarithm of the number.
```js
```kcl
log10(@input: number): number
```
@ -17,19 +17,19 @@ log10(@input: number): 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
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(end = [math::log10(100), 0])
|> line(end = [log10(100), 0])
|> line(end = [5, 8])
|> line(end = [-10, 0])
|> close()

View File

@ -8,7 +8,7 @@ Compute the base 2 logarithm of the number.
```js
```kcl
log2(@input: number): number
```
@ -17,19 +17,19 @@ log2(@input: number): 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
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(end = [math::log2(100), 0])
|> line(end = [log2(100), 0])
|> line(end = [5, 8])
|> line(end = [-10, 0])
|> close()

View File

@ -8,7 +8,7 @@ Compute the maximum of the given arguments.
```js
```kcl
max(@input: [number; 1+]): number
```
@ -17,21 +17,21 @@ max(@input: [number; 1+]): number
| 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
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(
angle = 70,
length = math::max([15, 31, 4, 13, 22])
length = max([15, 31, 4, 13, 22])
)
|> line(end = [20, 0])
|> close()

View File

@ -8,7 +8,7 @@ Compute the minimum of the given arguments.
```js
```kcl
min(@input: [number; 1+]): number
```
@ -17,21 +17,21 @@ min(@input: [number; 1+]): number
| 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
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(
angle = 70,
length = math::min([15, 31, 4, 13, 22])
length = min([15, 31, 4, 13, 22])
)
|> line(end = [20, 0])
|> close()

View File

@ -9,7 +9,7 @@ layout: manual
Convert polar/sphere (azimuth, elevation, distance) coordinates to
cartesian (x/y/z grid) coordinates.
```js
```kcl
polar(
angle: number(rad),
length: number(Length),
@ -26,15 +26,15 @@ polar(
### Returns
[`Point2d`](/docs/kcl/types/Point2d)
[`Point2d`](/docs/kcl/types/std-types-Point2d)
### Examples
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(end = math::polar(angle = 30, length = 5), tag = $thing)
|> line(end = polar(angle = 30, length = 5), tag = $thing)
|> line(end = [0, 5])
|> line(end = [segEndX(thing), 0])
|> line(end = [-20, 10])

View File

@ -8,7 +8,7 @@ Compute the number to a power.
```js
```kcl
pow(
@input: number,
exp: number(_),
@ -20,22 +20,22 @@ 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
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(
angle = 50,
length = math::pow(5, exp = 2),
length = pow(5, exp = 2),
)
|> yLine(endAbsolute = 0)
|> close()

View File

@ -9,7 +9,7 @@ layout: manual
Compute the remainder after dividing `num` by `div`.
If `num` is negative, the result will be too.
```js
```kcl
rem(
@num: number,
divisor: number,
@ -21,17 +21,17 @@ 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
```js
```kcl
import rem from "std::math"
assert(rem( 7, divisor = 4), isEqualTo = 3, error = "remainder is 3")

View File

@ -8,7 +8,7 @@ Round a number to the nearest integer.
```js
```kcl
round(@input: number): number
```
@ -17,20 +17,20 @@ round(@input: number): 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
```js
```kcl
sketch001 = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(endAbsolute = [12, 10])
|> line(end = [math::round(7.02986), 0])
|> line(end = [round(7.02986), 0])
|> yLine(endAbsolute = 0)
|> close()

View File

@ -8,7 +8,7 @@ Compute the sine of a number.
```js
```kcl
sin(@num: number(Angle)): number(_)
```
@ -26,12 +26,12 @@ sin(@num: number(Angle)): number(_)
### Examples
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(
angle = 50,
length = 15 / math::sin(135deg),
length = 15 / sin(135deg),
)
|> yLine(endAbsolute = 0)
|> close()

View File

@ -8,7 +8,7 @@ Compute the square root of a number.
```js
```kcl
sqrt(@input: number): number
```
@ -17,16 +17,16 @@ sqrt(@input: number): 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
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(

View File

@ -8,7 +8,7 @@ Compute the tangent of a number.
```js
```kcl
tan(@num: number(Angle)): number(_)
```
@ -26,12 +26,12 @@ tan(@num: number(Angle)): number(_)
### Examples
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(
angle = 50,
length = 50 * math::tan((1/2): number(rad)),
length = 50 * tan((1/2): number(rad)),
)
|> yLine(endAbsolute = 0)
|> close()

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,8 +8,8 @@ Convert a number to centimeters from its current units.
```js
toCentimeters(@num: number(cm)): number(cm)
```kcl
units::toCentimeters(@num: number(cm)): number(cm)
```

View File

@ -8,8 +8,8 @@ Converts a number to degrees from its current units.
```js
toDegrees(@num: number(deg)): number(deg)
```kcl
units::toDegrees(@num: number(deg)): number(deg)
```
@ -26,12 +26,12 @@ toDegrees(@num: number(deg)): number(deg)
### Examples
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(
angle = 50,
length = 70 * math::cos(units::toDegrees((PI/4): number(rad))),
length = 70 * cos(units::toDegrees((PI/4): number(rad))),
)
|> yLine(endAbsolute = 0)
|> close()

View File

@ -8,8 +8,8 @@ Convert a number to feet from its current units.
```js
toFeet(@num: number(ft)): number(ft)
```kcl
units::toFeet(@num: number(ft)): number(ft)
```

View File

@ -8,8 +8,8 @@ Convert a number to inches from its current units.
```js
toInches(@num: number(in)): number(in)
```kcl
units::toInches(@num: number(in)): number(in)
```

View File

@ -8,8 +8,8 @@ Convert a number to meters from its current units.
```js
toMeters(@num: number(m)): number(m)
```kcl
units::toMeters(@num: number(m)): number(m)
```

View File

@ -8,8 +8,8 @@ Convert a number to millimeters from its current units.
```js
toMillimeters(@num: number(mm)): number(mm)
```kcl
units::toMillimeters(@num: number(mm)): number(mm)
```

View File

@ -8,8 +8,8 @@ Converts a number to radians from its current units.
```js
toRadians(@num: number(rad)): number(rad)
```kcl
units::toRadians(@num: number(rad)): number(rad)
```
@ -26,12 +26,12 @@ toRadians(@num: number(rad)): number(rad)
### Examples
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(
angle = 50,
length = 70 * math::cos(units::toRadians(45)),
length = 70 * cos(units::toRadians(45)),
)
|> yLine(endAbsolute = 0)
|> close()

View File

@ -8,8 +8,8 @@ Converts a number to yards from its current units.
```js
toYards(@num: number(yd)): number(yd)
```kcl
units::toYards(@num: number(yd)): number(yd)
```

View File

@ -8,7 +8,7 @@ Get the shared edge between two faces.
```js
```kcl
getCommonEdge(faces: [TagIdentifier]): Uuid
```
@ -17,7 +17,7 @@ getCommonEdge(faces: [TagIdentifier]): Uuid
| 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
@ -26,7 +26,7 @@ getCommonEdge(faces: [TagIdentifier]): Uuid
### Examples
```js
```kcl
// Get an edge shared between two faces, created after a chamfer.

View File

@ -8,7 +8,7 @@ Get the next adjacent edge to the edge given.
```js
```kcl
getNextAdjacentEdge(edge: TagIdentifier): Uuid
```
@ -17,7 +17,7 @@ getNextAdjacentEdge(edge: TagIdentifier): Uuid
| 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
@ -26,7 +26,7 @@ getNextAdjacentEdge(edge: TagIdentifier): Uuid
### Examples
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(end = [10, 0])

View File

@ -8,7 +8,7 @@ Get the opposite edge to the edge given.
```js
```kcl
getOppositeEdge(edge: TagIdentifier): Uuid
```
@ -17,7 +17,7 @@ getOppositeEdge(edge: TagIdentifier): Uuid
| 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
@ -26,7 +26,7 @@ getOppositeEdge(edge: TagIdentifier): Uuid
### Examples
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(end = [10, 0])

View File

@ -8,7 +8,7 @@ Get the previous adjacent edge to the edge given.
```js
```kcl
getPreviousAdjacentEdge(edge: TagIdentifier): Uuid
```
@ -17,7 +17,7 @@ getPreviousAdjacentEdge(edge: TagIdentifier): Uuid
| 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
@ -26,7 +26,7 @@ getPreviousAdjacentEdge(edge: TagIdentifier): Uuid
### Examples
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(end = [10, 0])

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)
@ -93,60 +79,89 @@ layout: manual
* [`xLine`](kcl/xLine)
* [`yLine`](kcl/yLine)
* **std::math**
* [`math::E`](kcl/consts/std-math-E)
* [`math::PI`](kcl/consts/std-math-PI)
* [`math::TAU`](kcl/consts/std-math-TAU)
* [`math::abs`](kcl/std-math-abs)
* [`math::acos`](kcl/std-math-acos)
* [`math::asin`](kcl/std-math-asin)
* [`math::atan`](kcl/std-math-atan)
* [`math::atan2`](kcl/std-math-atan2)
* [`math::ceil`](kcl/std-math-ceil)
* [`math::cos`](kcl/std-math-cos)
* [`math::floor`](kcl/std-math-floor)
* [`math::ln`](kcl/std-math-ln)
* [`math::log`](kcl/std-math-log)
* [`math::log10`](kcl/std-math-log10)
* [`math::log2`](kcl/std-math-log2)
* [`math::max`](kcl/std-math-max)
* [`math::min`](kcl/std-math-min)
* [`math::polar`](kcl/std-math-polar)
* [`math::pow`](kcl/std-math-pow)
* [`math::rem`](kcl/std-math-rem)
* [`math::round`](kcl/std-math-round)
* [`math::sin`](kcl/std-math-sin)
* [`math::sqrt`](kcl/std-math-sqrt)
* [`math::tan`](kcl/std-math-tan)
* [`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/std-sketch-circle)
* [`mirror2d`](kcl/std-sketch-mirror2d)
* [`circle`](kcl/functions/std-sketch-circle)
* [`mirror2d`](kcl/functions/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)
* [`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)
* **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

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@ Extend the current sketch with a new involute circular curve.
```js
```kcl
involuteCircular(
sketch: Sketch,
startRadius: number,
@ -24,21 +24,21 @@ 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`](/docs/kcl/types/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
```js
```kcl
a = 10
b = 14
startSketchOn(XZ)

View File

@ -8,7 +8,7 @@ Extract the 'x' axis value of the last line segment in the provided 2-d sketch.
```js
```kcl
lastSegX(sketch: Sketch): number
```
@ -17,16 +17,16 @@ lastSegX(sketch: Sketch): number
| 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
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(end = [5, 0])

View File

@ -8,7 +8,7 @@ Extract the 'y' axis value of the last line segment in the provided 2-d sketch.
```js
```kcl
lastSegY(sketch: Sketch): number
```
@ -17,16 +17,16 @@ lastSegY(sketch: Sketch): number
| 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
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> line(end = [5, 0])

View File

@ -8,7 +8,7 @@ Compute the angle of the given leg for x.
```js
```kcl
legAngX(
hypotenuse: number,
leg: number,
@ -24,17 +24,17 @@ 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
```js
```kcl
legAngX(hypotenuse = 5, leg = 3)
```

View File

@ -8,7 +8,7 @@ Compute the angle of the given leg for y.
```js
```kcl
legAngY(
hypotenuse: number,
leg: number,
@ -24,17 +24,17 @@ 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
```js
```kcl
legAngY(hypotenuse = 5, leg = 3)
```

View File

@ -8,7 +8,7 @@ Compute the length of the given leg.
```js
```kcl
legLen(
hypotenuse: number,
leg: number,
@ -24,17 +24,17 @@ 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
```js
```kcl
legLen(hypotenuse = 5, leg = 3)
```

View File

@ -8,11 +8,11 @@ Extend the current sketch with a new straight line.
```js
```kcl
line(
sketch: Sketch,
endAbsolute?: [number],
end?: [number],
endAbsolute?: Point2d,
end?: Point2d,
tag?: TagDeclarator,
): Sketch
```
@ -22,19 +22,19 @@ 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`](/docs/kcl/types/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
```js
```kcl
triangle = startSketchOn(XZ)
|> startProfile(at = [0, 0])
// The END argument means it ends at exactly [10, 0].

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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

@ -8,11 +8,11 @@ Repeat a 2-dimensional sketch some number of times along a partial or complete c
```js
```kcl
patternCircular2d(
sketchSet: [Sketch],
instances: integer,
center: [number],
instances: number,
center: Point2d,
arcDegrees: number,
rotateDuplicates: bool,
useOriginal?: bool,
@ -24,21 +24,21 @@ 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
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [.5, 25])
|> line(end = [0, 5])

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