Compare commits

...

63 Commits

Author SHA1 Message Date
fb5314d2ad Change kcl_samples tests to run sequentially to make errors easier to understand 2025-03-07 11:40:29 -05:00
6cce3cda36 Misc tidying up around KclValue, etc. (#5653)
* Make some things a little less public

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

* Rename KclValue::Array to MixedArray

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

* Add settings to KclValue::Function

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

* Remove a bunch of dead code, simplifying mock exec and meaning KclValue no longer needs to deserialize

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

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-03-07 15:04:57 +00:00
5d25f4a0e5 Support types in the standard library (#5651)
* Parse an unparse type decls (and refactor impl attributes slightly)

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

* Remove special treatment of geometric types from parser and executor

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

* Generate docs for std types

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

* Hover tool-tips for types and fixup the frontend

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

* Fixes

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

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-03-07 09:53:34 -05:00
79d37d360a Remove xstate typegen scripts (#5662) 2025-03-07 09:38:44 -05:00
69553fded7 test: Vendor kcl-samples and add simulation tests for them (#5460)
* Change to unzip

* Download kcl-samples as zip to public dir

* Fix fetch:samples, e2e electron still not working

* Change error message to be clearer

* Refactor so that input and output directories of sim tests can be different

* Add kcl samples test implementation

* Update output since adding kcl_samples tests

* Update kcl-samples branch

* Fix git-ignore pattern to only apply to the root

* Fix yarn install and yarn fetch:samples to work the first time

* Remove unneeded exists check

* Change to use kcl-samples in public directory

* Add kcl-samples

* Update output since updating kcl-samples

* Update output files

* Change to not fetch samples during yarn install

* Update output after merge

* Ignore kcl-samples in codespell

* WIP: Don't run e2e if only kcl-samples changed

* Conditionally run cargo tests

* Fix to round floating point values in program memory arrays

* Update output since merge and rounding numbers in memory

* Fix memory redaction for floating point to find more values

* Fix float redaction pattern

* Update output since rounding floating point numbers

* Add center to floating point pattern

* Fix trigger to use picomatch syntax

* Update output since rounding center

* Remove kcl-samples github workflows

* Enable Rust backtrace

* Update output after re-running

* Update output after changing order of post-extrude commands

* Fix to have deterministic order of commands

* Update output after reverting ordering changes

* Update kcl-samples

* Update output after updating samples

* Fix error messages to show the names of all samples that failed

* Change cargo test command to match current one

* Update kcl-samples

* Update output since updating kcl-samples

* Add generate manifest workflow and yarn script

* Fix error check to actually work

* Change util function to be what we actually need

* Move new files after merge

* Fix paths since directory move

* Add dependabot updates for kcl-samples

* Add GitHub workflow to make PR to kcl-samples repo

* Add GitHub workflow to check kcl-samples header comments

* Fix worfklow to change to the right directory

* Add auto-commit simulation test output changes

* Add permissions to workflows

* Fix to run git commit step

* Install just if needed

* Fix directory of justfile

* Add installation of cargo-insta

* Fix to use underscore

* Fix to allow just command failure

* Change to always install CLI tools and cache them

* Trying to fix overwrite failing

* Combine commands

* Change reviewer

* Change to PR targeting the next branch

* Change git commands to not do unnecessary fetch

* Comment out trigger for creating a PR

* Update kcl-samples from next branch

* Update outputs after kcl-samples change

* Fix to use bash pipefail

* Add rust backtrace

* Print full env from sim tests

* Change command to use long option name

* Fix to use ci profile even when calling through just

* Add INSTA_UPDATE=always

* Fix git push by using an app token on checkout

* Add comments

* Fix to use bash options

* Change to echo when no changes are found

* Fix so that kcl-samples updates don't trigger full run

* Fix paths to reflect new crate location

* Fix path detection

* Fix e2e job to ignore kcl_samples simulation test output

* Fix the fetch logic for the KCL samples after vendoring (#5661)

Fixes the last 2 E2E tests for #5460.

---------

Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Frank Noirot <frank@zoo.dev>
2025-03-06 18:01:24 -05:00
200a9af61f add react perf plugin (#5645)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-06 18:57:46 +00:00
2696ddb996 Lf94/hidpi hovering fix (#5541)
* Fix hover highlights on HiDPI screens

* Fix flakey tests with new toolbar.exitSketch

* tsc && lint && fmt

* Disable pw electron thing again

* Fix test

---------

Co-authored-by: 49lf <ircsurfer33@gmail.com>
2025-03-06 11:19:13 -05:00
4e1b0daacb close websocket after test (#5652)
close the websocket properly
2025-03-06 03:09:00 +00:00
8aa46099a8 Types on test settings (#5643)
* type check the test settings

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

* updates

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

* fix another

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

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-05 21:03:49 -05:00
00ff6371ed Bugfix: show proper error toast when user tries to rename project to conflicting name (#5613)
* Correct error toast behavior so rename error comes through

* Add rename error state to E2E test
2025-03-06 10:00:36 +11:00
b947dad6e9 Change step back shortcut in command palette to Shift+Backspace (#5604)
* Change cmdbar step back shortcut to Shift+Backspace

* Add visual button for step back

* Make the shortcut apply no matter what's in the input
2025-03-06 09:57:47 +11:00
c13bdbb749 Allow users to delete sketches on offset planes via feature tree (#5641)
* Add sketch-on-offset plane deletion cleanup logic

* Add an E2E test for this behavior
2025-03-06 09:56:28 +11:00
e500fad0e1 Don't crash when trying to apply lastSelectionEvent selection that is out-of-range (#5644)
* Dumbest possible fix: don't let the `throw` propogate

* Add E2E test

* Fix lint
2025-03-06 09:52:48 +11:00
bcac4d3798 Snapshots, yee shall kneel. (#5627)
* Give snapshotter a better chance of getting a good snapshot

* fmt tsc lint

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* Fix tests

* Again

* Make cmdBarFixture Locators getters

* Fix export error test

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-05 14:09:21 -05:00
63897bd60e Bump taiki-e/install-action from 2.49.11 to 2.49.15 (#5632)
Bumps [taiki-e/install-action](https://github.com/taiki-e/install-action) from 2.49.11 to 2.49.15.
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Commits](https://github.com/taiki-e/install-action/compare/v2.49.11...v2.49.15)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-05 10:03:01 -08:00
d429e868ac Bump @types/node from 22.13.1 to 22.13.9 in /packages/codemirror-lsp-client (#5638) 2025-03-05 10:15:18 -05:00
faa51ddc18 Bump eslint-plugin-react from 7.37.3 to 7.37.4 (#5637) 2025-03-05 10:14:54 -05:00
c28eb360c0 Bump google-github-actions/auth from 2.1.7 to 2.1.8 (#5630) 2025-03-05 09:47:00 -05:00
69cac17543 Bump @types/node from 22.13.1 to 22.13.9 (#5635) 2025-03-05 09:20:16 -05:00
50c7356b6a Bump google-github-actions/upload-cloud-storage from 2.2.1 to 2.2.2 (#5633) 2025-03-05 09:19:00 -05:00
37715d9fa8 Move lsp server to this repo (#5619) 2025-03-04 22:21:12 -08:00
e8af61e11f Code completions for @settings (#5622)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-03-05 16:23:46 +13:00
de85c31e71 Make memory accessible from multiple threads/tasks (#5530)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-03-05 12:03:32 +13:00
725c56ea6f Fix to not specify the rust toolchain version everywhere (#5614)
* Fix to not specify the rust toolchain version everywhere

* Fix to source

* Fix warning about non-portable option to cp

* Fix to use built-in Swatinem/rust-cache

* Fix Swatinem/rust-cache to use the right directory
2025-03-04 20:39:22 +00:00
1b958ee29f Only save the themeColor setting on end of input (#5618)
* Only save the themeColor setting on end of input

Closes #4463 by making this input sliders less eager to write to disk,
which was gumming up the works.

* fmt
2025-03-04 14:11:38 -05:00
4b0f67e604 Explicitly set shell to bash for retry action in CI (#5610)
* Explicitly set shell to bash for retry action in CI

* Do not run tests on dep install failure

* Use single quotes for string

* Had the wrong name
2025-03-04 13:18:36 -05:00
8ba1a5cd4d Add button in settings menu to manually check for updates (#5607)
* Expose an electron handler for checking for updates

* Add "Check for updates" button to settings
2025-03-04 12:41:35 -05:00
df278c7e6a Various hover improvements (#5617)
* Show more info on hover for variables

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

* Move hover impls to lsp module

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

* Make hover work on names inside calls, fix doc line breaking, trim docs in tool tips

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

* Test the new hovers; fix signature syntax

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

* Hover tips for kwargs

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

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-03-04 09:53:31 +00:00
6e57a80c13 Bump script for kcl crates (#5612)
* start of kcl-bumper

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

* works!

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

* add readme

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-03 16:03:18 -06:00
efe6565857 Bump taiki-e/install-action from 2.48.20 to 2.49.11 (#5608)
Bumps [taiki-e/install-action](https://github.com/taiki-e/install-action) from 2.48.20 to 2.49.11.
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Commits](https://github.com/taiki-e/install-action/compare/v2.48.20...v2.49.11)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-03 20:48:50 +00:00
fa0a34585b Bump once_cell from 1.20.2 to 1.20.3 in /rust (#5592)
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.20.2 to 1.20.3.
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.20.2...v1.20.3)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-03 11:58:20 -08:00
dec74f633b Bump @codemirror/search from 6.5.6 to 6.5.10 (#5596)
Bumps [@codemirror/search](https://github.com/codemirror/search) from 6.5.6 to 6.5.10.
- [Changelog](https://github.com/codemirror/search/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/search/compare/6.5.6...6.5.10)

---
updated-dependencies:
- dependency-name: "@codemirror/search"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-03 19:16:58 +00:00
dfcea282ec add export test so we dont break cli / kcl.py (#5553)
* add export test so we dont break cli / kcl.py

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

Overwrite created date (#5602)

* updates

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-03 18:26:01 +00:00
191dcf8bb0 Bump nick-fields/retry from 3.0.1 to 3.0.2 (#5589)
* Bump nick-fields/retry from 3.0.1 to 3.0.2

Bumps [nick-fields/retry](https://github.com/nick-fields/retry) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/nick-fields/retry/releases)
- [Changelog](https://github.com/nick-fields/retry/blob/master/.releaserc.js)
- [Commits](https://github.com/nick-fields/retry/compare/v3.0.1...v3.0.2)

---
updated-dependencies:
- dependency-name: nick-fields/retry
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-03 10:08:37 -08:00
cb1bbe4660 Bump tabled from 0.15.0 to 0.18.0 in /rust (#5593)
Bumps [tabled](https://github.com/zhiburt/tabled) from 0.15.0 to 0.18.0.
- [Changelog](https://github.com/zhiburt/tabled/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zhiburt/tabled/commits)

---
updated-dependencies:
- dependency-name: tabled
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-03 10:05:50 -08:00
ff66cb1deb Bump parse-display from 0.9.1 to 0.10.0 in /rust (#5595)
Bumps [parse-display](https://github.com/frozenlib/parse-display) from 0.9.1 to 0.10.0.
- [Changelog](https://github.com/frozenlib/parse-display/blob/master/CHANGELOG.md)
- [Commits](https://github.com/frozenlib/parse-display/compare/v0.9.1...v0.10.0)

---
updated-dependencies:
- dependency-name: parse-display
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-03 10:05:21 -08:00
ab46349d63 Bump @codemirror/autocomplete from 6.17.0 to 6.18.6 in /packages/codemirror-lsp-client (#5601)
* Bump @codemirror/autocomplete in /packages/codemirror-lsp-client

Bumps [@codemirror/autocomplete](https://github.com/codemirror/autocomplete) from 6.17.0 to 6.18.6.
- [Changelog](https://github.com/codemirror/autocomplete/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/autocomplete/compare/6.17.0...6.18.6)

---
updated-dependencies:
- dependency-name: "@codemirror/autocomplete"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-03 10:04:44 -08:00
cffad78bf7 Bump convert_case from 0.6.0 to 0.8.0 in /rust (#5591)
* Bump convert_case from 0.6.0 to 0.8.0 in /rust

Bumps [convert_case](https://github.com/rutrum/convert-case) from 0.6.0 to 0.8.0.
- [Commits](https://github.com/rutrum/convert-case/commits)

---
updated-dependencies:
- dependency-name: convert_case
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-03 10:03:47 -08:00
bfb81877d3 Bump husky from 9.1.5 to 9.1.7 (#5597)
Bumps [husky](https://github.com/typicode/husky) from 9.1.5 to 9.1.7.
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](https://github.com/typicode/husky/compare/v9.1.5...v9.1.7)

---
updated-dependencies:
- dependency-name: husky
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-03 10:03:15 -08:00
c56398db83 Bump @types/diff from 6.0.0 to 7.0.1 (#5599)
Bumps [@types/diff](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/diff) from 6.0.0 to 7.0.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/diff)

---
updated-dependencies:
- dependency-name: "@types/diff"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-03 10:02:57 -08:00
36e0d35968 Bump @codemirror/commands from 6.6.0 to 6.8.0 (#5600)
Bumps [@codemirror/commands](https://github.com/codemirror/commands) from 6.6.0 to 6.8.0.
- [Changelog](https://github.com/codemirror/commands/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/commands/compare/6.6.0...6.8.0)

---
updated-dependencies:
- dependency-name: "@codemirror/commands"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-03 10:02:09 -08:00
62bf7d8715 Pin Rust to 1.85 to fix CI (#5606)
* Make Rust 1.85 the default

* Less specific Rust ver

* Pin Rust 1.85 to -clippy and -fmt

* Pin Rust version

* Use Rust 1.85 in package.json
2025-03-03 09:57:31 -08:00
a4db302174 move kcl.py to this repo (#5587)
* ci for kcl-python-bindings

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

* updates

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

* updates

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

* updates

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

* bettter concurrency

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

* cleanup files

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

* updates

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

* updaets

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

* updaets

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

* updaets

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

* updaets

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

* format

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

* format

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-01 19:38:25 -05:00
66f3500ca9 Remove start sketch at (#5586)
* remove start sketch at

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

* fixes

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

* updates

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

* updates

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

* fixes

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-01 19:32:46 -05:00
c3bdc6f106 Move the wasm lib, and cleanup rust directory and all references (#5585)
* git mv src/wasm-lib rust

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

* mv wasm-lib to workspace

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

* mv kcl-lib

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

* mv derive docs

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

* resolve file paths

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

* clippy

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

* move more shit

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

* fix more paths

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

* make yarn build:wasm work

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

* fix scripts

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

* fixups

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

* better references

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

* fix cargo ci

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

* fix reference

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

* fix more ci

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

* fix tests

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

* cargo sort

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

* fix script

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

* fix

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

* fmt

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

* fix a dep

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

* sort

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

* remove unused deps

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

* Revert "remove unused deps"

This reverts commit fbabdb062e275fd5cbc1476f8480a1afee15d972.

* updates

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

* deps;

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

* fixes

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-03-01 21:59:01 +00:00
0a2bf4b55f Fix to round floating point numbers in test output (#5584)
* Fix to round floating point numbers in test output

* Update output after rounding
2025-02-28 23:32:00 -08:00
bbae9b6363 Fix to have deterministic order of commands (#5583) 2025-02-28 23:31:38 -08:00
180d52280d minor fixes to some scripts / From<impl for Project Config> (#5582)
minor fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-01 03:02:06 +00:00
dce1dca7c7 bump to 45 for kcl-samples next (#5581)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-01 02:30:21 +00:00
343f6572a2 circle moved to kw args (#5560)
* rust side of circle args

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

* change circle in all test js files

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

* more js side

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

* fix

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

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* updates

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

* updates

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

* fixes

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

* updates

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

* updates

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

* fix

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

* ud[ates

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

* ud[ates

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

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 20:40:01 -05:00
c8e58d49e0 Remove unused Zoo CLI step in e2e-tests.yml (#5574)
pierremtb/adhoc/remove-unused-cli-step-e2e
2025-02-28 17:19:46 -08:00
c18546fb2f more pedantic rust types for project specific settings versus user settings (#5575)
* move debug_panel to app settings

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

* move showDebugPanel to app settings with backwards compatibility;

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

* updates

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

* more pedantic project specific settings

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

* updates

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

* updates

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

* updates

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

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-01 00:15:57 +00:00
466c23a9d8 Add support for hidden command arguments (#5534)
* Add configuration/type support for `hidden`

* Add UI support for `hidden` configuration

* Make `nodeToEdit` args hidden

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* Fix cmdBarFixture to actually serialize to "pickCommand" case

* Add test step to ensure hidden commands can't be backed into

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 23:00:29 +00:00
8403025c77 fix bug where even clear scene fails miette cant get output (#5578)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-02-28 23:00:10 +00:00
9ce591a1a1 Disable view control menu items and gizmo clicks conditionally (#5537)
* Disable view control menu items and gizmo clicks conditionally

* Actually just turn off all mouse events, moves too

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* fix gizmo flickering

* fmt

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* Add test step for disabling gizmo in sketch mode

* Use grayscale to indicate disabled state?

@max-mrgrsk feel free to discard if you prefer the opacity, I don't have
a strong opinion at the moment.

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: max-mrgrsk <156543465+max-mrgrsk@users.noreply.github.com>
2025-02-28 22:27:35 +00:00
f238f3882b Feature: Named views (#5532)
* feature: building skeleton for adding a viewpoint in frontend as well as rust with the settings toml

* chore: named views loaded into memory

* fix: testing code

* chore: saving off progress, skeleton for listing and deleting named views

* fix: fixed state stale dereferencing issue

* feat: initial skeleton for loading view points

* fix: pushing bug

* fix: saving off progress

* fix: trying to update to main?

* fix: main fixes, API fixes

* fix: what is happening

* fix: ope

* fix: implemented default values on serde

* fix: pushing working dev code... need to clean it up

* feature: adding no results found on filteroptions within an options input, not just command input bar level

* fix: initial PR cleanup pass of junky code

* fix: addressing comments in initial pass

* fix: addressing PR comments

* fix: moved modeling.namedViews to app.namedViews as per request

* fix: _id and _version are now id and version.

* fix: python codespell, perspective

* fix: cargo fmt

* fix: updating description of the named view commands

* fix: removing testing code

* fix: feature flag this to DEV only

* fix: ts ignore for production engine api

* fix: deep parital fights arrays and objects within settings, doing a namedview type predicate checking

* fix: auto fixes

* Remove unnecessary alias

* Reword toast messages (more consistency)

* fmt

* cargo clippy

* Fix Set appearance flakes

* cargo test

* fix: removing pub since the toml_stringify was refactored

* fix: adding ignore this on user level

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* chore: Vec<NamedView> to HashMap<uuid::Uuid,NamedView>

* fix: removing debugging code

* chore: HashMap to IndexMap

* fix: remove testing code

---------

Co-authored-by: 49lf <ircsurfer33@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 16:37:25 -05:00
a91208eb1c Add expandable disclosure to AI operation success toasts (#5555)
* Add expandable disclosure to Text-to-CAD success toast

Closes #5258 by adding a details element that the user can open if they
don't like the result of their "successful" prompt.

* Add the same disclosure to the Prompt-to-Edit toast

* Rework text per @greg-kcio's feedback

* Fix tsc

* WIP fix up ttc e2e tests
2025-02-28 16:26:11 -05:00
b92b0a9afe Upload public mirror of origin modeling-app slides to README (#5549)
Closes #4264.
2025-02-28 16:14:58 -05:00
964347f43a Fix sketch-on-face sketches to be in the artifact graph (#5489)
* Add code ref to sketch-on-face artifacts

* Fix to add execution artifacts to the artifact graph

* Update output after including exec artifacts

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 21:06:26 +00:00
3811c88b5c properly flush batch (#5565)
* properly flush batch

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

* add test

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

* add test

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

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* only flush if not on error

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

* better method

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

* updates

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

* ensure nothing in batch assembly test

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 19:52:14 +00:00
69a1473197 Scheduled e2e tests on main (#5551)
* WIP: Scheduled e2e tests

* Update .github/workflows/e2e-tests.yml

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

---------

Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2025-02-28 18:55:45 +00:00
1f1e996cfa Bugfix: absolute line segment dragging behavior offset was relative (#5571)
* Refactor: Use the named constant for 'endAbsolute' in more places

* Bugfix: lineTo was calculating relative distances instead of absolute

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 12:50:14 -05:00
58167deda7 Fix file I/O errors to not be engine type errors (#5554)
* Fix file I/O errors to not be engine type errors

* Update output
2025-02-28 12:08:44 -05:00
2085 changed files with 829352 additions and 22939 deletions

View File

@ -1,3 +1,3 @@
[codespell] [codespell]
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,atleast,ue,afterall,ser ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,atleast,ue,afterall,ser
skip: **/target,node_modules,build,dist,./out,**/Cargo.lock,./docs/kcl/*.md,.yarn.lock,**/yarn.lock,./openapi/*.json,./packages/codemirror-lang-kcl/test/all.test.ts,tsconfig.tsbuildinfo skip: **/target,node_modules,build,dist,./out,**/Cargo.lock,./docs/kcl/*.md,.yarn.lock,**/yarn.lock,./openapi/*.json,./packages/codemirror-lang-kcl/test/all.test.ts,./public/kcl-samples,./rust/kcl-lib/tests/kcl_samples,tsconfig.tsbuildinfo

View File

@ -1,4 +1,6 @@
src/wasm-lib/* rust/**/*.ts
!rust/kcl-language-server/client/src/**/*.ts
*.typegen.ts *.typegen.ts
packages/codemirror-lsp-client/dist/* packages/codemirror-lsp-client/dist/*
e2e/playwright/snapshots/prompt-to-edit/* e2e/playwright/snapshots/prompt-to-edit/*
.vscode-test

View File

@ -4,6 +4,7 @@
"project": "./tsconfig.json" "project": "./tsconfig.json"
}, },
"plugins": [ "plugins": [
"react-perf",
"css-modules", "css-modules",
"jest", "jest",
"jsx-a11y", "jsx-a11y",

View File

@ -0,0 +1,8 @@
FROM node:slim
COPY . /action
WORKDIR /action
RUN npm install --production
ENTRYPOINT ["node", "/action/main.js"]

View File

@ -0,0 +1,21 @@
# github-release
Copy-pasted from
https://github.com/bytecodealliance/wasmtime/tree/8acfdbdd8aa550d1b84e0ce1e6222a6605d14e38/.github/actions/github-release
An action used to publish GitHub releases for `wasmtime`.
As of the time of this writing there's a few actions floating around which
perform github releases but they all tend to have their set of drawbacks.
Additionally nothing handles deleting releases which we need for our rolling
`dev` release.
To handle all this, this action rolls its own implementation using the
actions/toolkit repository and packages published there. These run in a Docker
container and take various inputs to orchestrate the release from the build.
More comments can be found in `main.js`.
Testing this is really hard. If you want to try though run `npm install` and
then `node main.js`. You'll have to configure a bunch of env vars though to get
anything reasonably working.

View File

@ -0,0 +1,15 @@
name: "wasmtime github releases"
description: "wasmtime github releases"
inputs:
token:
description: ""
required: true
name:
description: ""
required: true
files:
description: ""
required: true
runs:
using: "docker"
image: "Dockerfile"

143
.github/actions/github-release/main.js vendored Normal file
View File

@ -0,0 +1,143 @@
const core = require("@actions/core");
const path = require("path");
const fs = require("fs");
const github = require("@actions/github");
const glob = require("glob");
function sleep(milliseconds) {
return new Promise((resolve) => setTimeout(resolve, milliseconds));
}
async function runOnce() {
// Load all our inputs and env vars. Note that `getInput` reads from `INPUT_*`
const files = core.getInput("files");
const name = core.getInput("name");
const token = core.getInput("token");
const slug = process.env.GITHUB_REPOSITORY;
const owner = slug.split("/")[0];
const repo = slug.split("/")[1];
const sha = process.env.HEAD_SHA;
core.info(`files: ${files}`);
core.info(`name: ${name}`);
const options = {
request: {
timeout: 30000,
},
};
const octokit = github.getOctokit(token, options);
// Delete the previous release since we can't overwrite one. This may happen
// due to retrying an upload or it may happen because we're doing the dev
// release.
const releases = await octokit.paginate("GET /repos/:owner/:repo/releases", { owner, repo });
for (const release of releases) {
if (release.tag_name !== name) {
continue;
}
const release_id = release.id;
core.info(`deleting release ${release_id}`);
await octokit.rest.repos.deleteRelease({ owner, repo, release_id });
}
// We also need to update the `dev` tag while we're at it on the `dev` branch.
if (name == "nightly") {
try {
core.info(`updating nightly tag`);
await octokit.rest.git.updateRef({
owner,
repo,
ref: "tags/nightly",
sha,
force: true,
});
} catch (e) {
core.error(e);
core.info(`creating nightly tag`);
await octokit.rest.git.createTag({
owner,
repo,
tag: "nightly",
message: "nightly release",
object: sha,
type: "commit",
});
}
}
// Creates an official GitHub release for this `tag`, and if this is `dev`
// then we know that from the previous block this should be a fresh release.
core.info(`creating a release`);
const release = await octokit.rest.repos.createRelease({
owner,
repo,
name,
tag_name: name,
target_commitish: sha,
prerelease: name === "nightly",
});
const release_id = release.data.id;
// Upload all the relevant assets for this release as just general blobs.
for (const file of glob.sync(files)) {
const size = fs.statSync(file).size;
const name = path.basename(file);
await runWithRetry(async function () {
// We can't overwrite assets, so remove existing ones from a previous try.
let assets = await octokit.rest.repos.listReleaseAssets({
owner,
repo,
release_id,
});
for (const asset of assets.data) {
if (asset.name === name) {
core.info(`delete asset ${name}`);
const asset_id = asset.id;
await octokit.rest.repos.deleteReleaseAsset({ owner, repo, asset_id });
}
}
core.info(`upload ${file}`);
const headers = { "content-length": size, "content-type": "application/octet-stream" };
const data = fs.createReadStream(file);
await octokit.rest.repos.uploadReleaseAsset({
data,
headers,
name,
url: release.data.upload_url,
});
});
}
}
async function runWithRetry(f) {
const retries = 10;
const maxDelay = 4000;
let delay = 1000;
for (let i = 0; i < retries; i++) {
try {
await f();
break;
} catch (e) {
if (i === retries - 1) throw e;
core.error(e);
const currentDelay = Math.round(Math.random() * delay);
core.info(`sleeping ${currentDelay} ms`);
await sleep(currentDelay);
delay = Math.min(delay * 2, maxDelay);
}
}
}
async function run() {
await runWithRetry(runOnce);
}
run().catch((err) => {
core.error(err);
core.setFailed(err.message);
});

View File

@ -0,0 +1,10 @@
{
"name": "wasmtime-github-release",
"version": "0.0.0",
"main": "main.js",
"dependencies": {
"@actions/core": "^1.6",
"@actions/github": "^5.0",
"glob": "^7.1.5"
}
}

View File

@ -10,6 +10,7 @@ updates:
- '/' - '/'
- '/packages/codemirror-lang-kcl/' - '/packages/codemirror-lang-kcl/'
- '/packages/codemirror-lsp-client/' - '/packages/codemirror-lsp-client/'
- '/rust/kcl-language-server/'
schedule: schedule:
interval: weekly interval: weekly
day: monday day: monday
@ -25,7 +26,7 @@ updates:
- adamchalmers - adamchalmers
- jessfraz - jessfraz
- package-ecosystem: 'cargo' # See documentation for possible values - package-ecosystem: 'cargo' # See documentation for possible values
directory: '/src/wasm-lib/' # Location of package manifests directory: '/rust/' # Location of package manifests
schedule: schedule:
interval: weekly interval: weekly
day: monday day: monday
@ -39,3 +40,13 @@ updates:
wasm-bindgen-deps: wasm-bindgen-deps:
patterns: patterns:
- "wasm-bindgen*" - "wasm-bindgen*"
- package-ecosystem: "pip"
directories:
- "/public/kcl-samples/"
- "/rust/kcl-python-bindings/"
schedule:
interval: weekly
day: monday
reviewers:
- adamchalmers
- jessfraz

View File

@ -21,8 +21,8 @@ jobs:
- name: Cache wasm - name: Cache wasm
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with: with:
workspaces: './src/wasm-lib' workspaces: './rust'
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb - uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with: with:
tool: wasm-pack tool: wasm-pack
- name: build wasm - name: build wasm
@ -33,4 +33,4 @@ jobs:
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: wasm-bundle name: wasm-bundle
path: src/wasm-lib/pkg path: rust/kcl-wasm-lib/pkg

View File

@ -38,10 +38,10 @@ jobs:
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
workspaces: './src/wasm-lib' workspaces: './rust'
# TODO: see if we can fetch from main instead if no diff at src/wasm-lib # TODO: see if we can fetch from main instead if no diff at rust
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb - uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with: with:
tool: wasm-pack tool: wasm-pack
@ -67,7 +67,7 @@ jobs:
path: | path: |
package.json package.json
electron-builder.yml electron-builder.yml
src/wasm-lib/pkg/wasm_lib* rust/kcl-wasm-lib/pkg/kcl_wasm_lib*
release-notes.md release-notes.md
assets/icon.ico assets/icon.ico
assets/icon.png assets/icon.png
@ -117,9 +117,9 @@ jobs:
ls -R prepared-files ls -R prepared-files
cp prepared-files/package.json package.json cp prepared-files/package.json package.json
cp prepared-files/electron-builder.yml electron-builder.yml cp prepared-files/electron-builder.yml electron-builder.yml
cp prepared-files/src/wasm-lib/pkg/wasm_lib_bg.wasm public cp prepared-files/rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public
mkdir src/wasm-lib/pkg mkdir rust/kcl-wasm-lib/pkg
cp prepared-files/src/wasm-lib/pkg/wasm_lib* src/wasm-lib/pkg cp prepared-files/rust/kcl-wasm-lib/pkg/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
cp prepared-files/release-notes.md release-notes.md cp prepared-files/release-notes.md release-notes.md
cp prepared-files/assets/icon.ico assets/icon.ico cp prepared-files/assets/icon.ico assets/icon.ico
cp prepared-files/assets/icon.png assets/icon.png cp prepared-files/assets/icon.png assets/icon.png
@ -132,8 +132,9 @@ jobs:
- name: yarn install - name: yarn install
# Windows is picky sometimes and fails on fetch. Step takes about ~30s # Windows is picky sometimes and fails on fetch. Step takes about ~30s
uses: nick-fields/retry@v3.0.1 uses: nick-fields/retry@v3.0.2
with: with:
shell: bash
timeout_minutes: 2 timeout_minutes: 2
max_attempts: 3 max_attempts: 3
command: yarn install command: yarn install
@ -183,8 +184,9 @@ jobs:
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }} WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
DEBUG: "electron-notarize*" DEBUG: "electron-notarize*"
# TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures # TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures
uses: nick-fields/retry@v3.0.1 uses: nick-fields/retry@v3.0.2
with: with:
shell: bash
timeout_minutes: 10 timeout_minutes: 10
max_attempts: 3 max_attempts: 3
command: yarn tronb:package:prod command: yarn tronb:package:prod
@ -244,8 +246,9 @@ jobs:
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }} WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
DEBUG: "electron-notarize*" DEBUG: "electron-notarize*"
# TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures # TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures
uses: nick-fields/retry@v3.0.1 uses: nick-fields/retry@v3.0.2
with: with:
shell: bash
timeout_minutes: 10 timeout_minutes: 10
max_attempts: 3 max_attempts: 3
command: yarn tronb:package:prod command: yarn tronb:package:prod

View File

@ -17,23 +17,20 @@ jobs:
cargocheck: cargocheck:
name: cargo check name: cargo check
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
dir: ['src/wasm-lib']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install latest rust - name: Use correct Rust toolchain
uses: actions-rs/toolchain@v1 shell: bash
run: |
cp --update=none rust/rust-toolchain.toml ./ || true
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: stable cache-workspaces: rust
override: true
- name: Rust Cache
uses: Swatinem/rust-cache@v2.6.1
- name: Run check - name: Run check
run: | run: |
cd "${{ matrix.dir }}" cd rust
# We specifically want to test the disable-println feature # We specifically want to test the disable-println feature
# Since it is not enabled by default, we need to specify it # Since it is not enabled by default, we need to specify it
# This is used in kcl-lsp # This is used in kcl-lsp

View File

@ -23,25 +23,22 @@ jobs:
cargoclippy: cargoclippy:
name: cargo clippy name: cargo clippy
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
dir: ['src/wasm-lib']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: taiki-e/install-action@just - uses: taiki-e/install-action@just
- name: Install latest rust - name: Use correct Rust toolchain
uses: actions-rs/toolchain@v1 shell: bash
run: |
cp --update=none rust/rust-toolchain.toml ./ || true
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: stable cache-workspaces: rust
override: true components: clippy
components: clippy
- name: Rust Cache
uses: Swatinem/rust-cache@v2.6.1
- name: Run clippy - name: Run clippy
run: | run: |
cd "${{ matrix.dir }}" cd rust
just lint just lint
# If this fails, run "cargo check" to update Cargo.lock, # If this fails, run "cargo check" to update Cargo.lock,
# then add Cargo.lock to the PR. # then add Cargo.lock to the PR.

View File

@ -26,23 +26,20 @@ jobs:
cargofmt: cargofmt:
name: cargo fmt name: cargo fmt
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
dir: ['src/wasm-lib']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install latest rust - name: Use correct Rust toolchain
uses: actions-rs/toolchain@v1 shell: bash
run: |
cp --update=none rust/rust-toolchain.toml ./ || true
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: stable cache-workspaces: rust
override: true components: rustfmt
components: rustfmt
- name: Rust Cache
uses: Swatinem/rust-cache@v2.6.1
- name: Run cargo fmt - name: Run cargo fmt
run: | run: |
cd "${{ matrix.dir }}" cd rust
cargo fmt -- --check cargo fmt -- --check
shell: bash shell: bash

View File

@ -5,25 +5,35 @@ on:
pull_request: pull_request:
workflow_dispatch: workflow_dispatch:
permissions: read-all permissions:
contents: read
pull-requests: write
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true cancel-in-progress: true
name: cargo test of wasm-lib name: cargo test
jobs: jobs:
cargotest: cargotest:
name: cargo test name: cargo test
runs-on: ubuntu-latest-8-cores runs-on: ubuntu-latest-8-cores
strategy:
matrix:
dir: ['src/wasm-lib']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/create-github-app-token@v1
- name: Install latest rust id: app-token
uses: actions-rs/toolchain@v1
with: with:
toolchain: stable app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
override: true private-key: ${{ secrets.MODELING_APP_GH_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
- name: Use correct Rust toolchain
shell: bash
run: |
cp --update=none rust/rust-toolchain.toml ./ || true
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false # Configured below.
- name: Install vector - name: Install vector
run: | run: |
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
@ -40,22 +50,95 @@ jobs:
${HOME}/.vector/bin/vector --config /tmp/vector.toml & ${HOME}/.vector/bin/vector --config /tmp/vector.toml &
- uses: taiki-e/install-action@cargo-llvm-cov - uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest - uses: taiki-e/install-action@nextest
- name: Install just
uses: taiki-e/install-action@just
- name: Install cargo-insta
shell: bash
run: |
cargo install cargo-insta
- name: Rust Cache - name: Rust Cache
uses: Swatinem/rust-cache@v2.6.1 uses: Swatinem/rust-cache@v2
with:
workspaces: rust
- name: Fetch the base branch
if: ${{ github.event_name == 'pull_request' }}
run: git fetch origin ${{ github.base_ref }} --depth=1
- name: Check for path changes
id: path-changes
shell: bash
run: |
set -euo pipefail
# Manual runs or push should run all tests.
if [[ ${{ github.event_name }} != 'pull_request' ]]; then
echo "outside-kcl-samples=true" >> $GITHUB_OUTPUT
exit 0
fi
changed_files=$(git diff --name-only origin/${{ github.base_ref }})
echo "$changed_files"
if grep -Evq '^public/kcl-samples/|^rust/kcl-lib/tests/kcl_samples/' <<< "$changed_files" ; then
echo "outside-kcl-samples=true" >> $GITHUB_OUTPUT
else
echo "outside-kcl-samples=false" >> $GITHUB_OUTPUT
fi
- name: cargo test only kcl-samples
id: cargo-test-kcl-samples
if: steps.path-changes.outputs.outside-kcl-samples == 'false'
continue-on-error: true
shell: bash
run: |
set -euo pipefail
cd rust
cargo nextest run --workspace --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}}
RUST_BACKTRACE: full
RUST_MIN_STACK: 10485760000
- name: Commit differences
if: steps.path-changes.outputs.outside-kcl-samples == 'false' && steps.cargo-test-kcl-samples.outcome == 'failure'
shell: bash
run: |
set -euo pipefail
cd rust
just overwrite-sim-test kcl_samples
git add kcl-lib/tests
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git fetch origin
echo ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
if ! git commit -m "Update kcl-samples simulation test output" ; then
echo "No changes to commit"
# This only runs if tests failed, so we should fail the step.
exit 1
fi
git push origin ${{ github.head_ref }}
env:
# The default is auto, and insta behaves differently in CI vs. not.
INSTA_UPDATE: always
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
# Configure nextest when it's run by insta (via just).
NEXTEST_PROFILE: ci
RUST_BACKTRACE: full
RUST_MIN_STACK: 10485760000
- name: cargo test - name: cargo test
if: steps.path-changes.outputs.outside-kcl-samples == 'true'
shell: bash shell: bash
run: |- run: |-
cd "${{ matrix.dir }}" cd rust
cargo llvm-cov nextest --workspace --lcov --output-path lcov.info --test-threads=1 --retries=2 --no-fail-fast -P ci 2>&1 | tee /tmp/github-actions.log cargo llvm-cov nextest --workspace --lcov --output-path lcov.info --retries=2 --no-fail-fast -P ci 2>&1 | tee /tmp/github-actions.log
env: env:
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}} KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
RUST_MIN_STACK: 10485760000 RUST_MIN_STACK: 10485760000
- name: Upload to codecov.io - name: Upload to codecov.io
if: steps.path-changes.outputs.outside-kcl-samples == 'true'
uses: codecov/codecov-action@v5 uses: codecov/codecov-action@v5
with: with:
token: ${{secrets.CODECOV_TOKEN}} token: ${{secrets.CODECOV_TOKEN}}
fail_ci_if_error: true fail_ci_if_error: true
flags: wasm-lib flags: rust
verbose: true verbose: true
files: lcov.info files: lcov.info

48
.github/workflows/check-kcl-header.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: Check kcl-samples files for proper header structure
on:
pull_request:
paths:
- 'public/kcl-samples/**/*.kcl'
- .github/workflows/check-kcl-header.yml
branches:
- main
push:
paths:
- 'public/kcl-samples/**/*.kcl'
- .github/workflows/check-kcl-header.yml
branches:
- main
permissions:
contents: read
jobs:
check-kcl-header:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check KCL files for header comment block and blank line
run: |
files=$(find public/kcl-samples -type f -name '*.kcl')
failed_files=()
for file in $files; do
if ! awk '
NR == 1 && $0 !~ /^\/\// { exit 1 }
BEGIN { in_comment = 1 }
NF == 0 && in_comment == 1 { in_comment = 0; next }
$1 !~ /^\/\// && in_comment == 1 { exit 1 }
in_comment == 0 && NF > 0 { exit 0 }
END { if (in_comment == 1) exit 1 }
' "$file"; then
failed_files+=("$file")
fi
done
if [ ${#failed_files[@]} -ne 0 ]; then
echo "One or more KCL files do not begin with a header comment block followed by a blank line:"
printf '%s\n' "${failed_files[@]}"
exit 1
fi

View File

@ -3,6 +3,8 @@ on:
push: push:
branches: [ main ] branches: [ main ]
pull_request: pull_request:
schedule:
- cron: 0 * * * * # hourly
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@ -16,21 +18,39 @@ permissions:
jobs: jobs:
check-rust-changes: path-changes:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
rust-changed: ${{ steps.filter.outputs.rust }} significant: ${{ steps.path-changes.outputs.significant }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Fetch the base branch
if: ${{ github.event_name == 'pull_request' }}
run: git fetch origin ${{ github.base_ref }} --depth=1
- name: Check for path changes
id: path-changes
shell: bash
run: |
set -euo pipefail
- id: filter # Manual runs or push should run all tests.
name: Check for Rust changes if [[ ${{ github.event_name }} != 'pull_request' ]]; then
uses: dorny/paths-filter@v3 echo "significant=true" >> $GITHUB_OUTPUT
with: exit 0
filters: | fi
rust:
- 'src/wasm-lib/**' changed_files=$(git diff --name-only origin/${{ github.base_ref }})
echo "$changed_files"
if grep -Evq '^README.md|^public/kcl-samples/|^rust/kcl-lib/tests/kcl_samples/' <<< "$changed_files" ; then
echo "significant=true" >> $GITHUB_OUTPUT
else
echo "significant=false" >> $GITHUB_OUTPUT
fi
- name: Display path changes
run: |
# For debugging purposes.
echo "significant: ${{ steps.path-changes.outputs.significant }}"
electron: electron:
timeout-minutes: 60 timeout-minutes: 60
@ -42,8 +62,10 @@ jobs:
os: [namespace-profile-ubuntu-8-cores, namespace-profile-macos-8-cores, windows-16-cores] os: [namespace-profile-ubuntu-8-cores, namespace-profile-macos-8-cores, windows-16-cores]
shardIndex: [1, 2, 3, 4] shardIndex: [1, 2, 3, 4]
shardTotal: [4] shardTotal: [4]
# TODO: add ref here for main and latest release tag
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
needs: check-rust-changes needs: path-changes
if: ${{ needs.path-changes.outputs.significant == 'true' }}
steps: steps:
- uses: actions/create-github-app-token@v1 - uses: actions/create-github-app-token@v1
id: app-token id: app-token
@ -54,12 +76,19 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
token: ${{ steps.app-token.outputs.token }} token: ${{ steps.app-token.outputs.token }}
- id: filter
name: Check for Rust changes
uses: dorny/paths-filter@v3
with:
filters: |
rust:
- 'rust/**'
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'yarn'
- uses: KittyCAD/action-install-cli@main
- name: Install dependencies - name: Install dependencies
id: deps-install
shell: bash shell: bash
run: yarn run: yarn
- name: Cache Playwright Browsers - name: Cache Playwright Browsers
@ -73,7 +102,7 @@ jobs:
run: yarn playwright install --with-deps run: yarn playwright install --with-deps
- name: Download Wasm Cache - name: Download Wasm Cache
id: download-wasm id: download-wasm
if: needs.check-rust-changes.outputs.rust-changed == 'false' if: github.event_name != 'schedule' && steps.filter.outputs.rust == 'false'
uses: dawidd6/action-download-artifact@v7 uses: dawidd6/action-download-artifact@v7
continue-on-error: true continue-on-error: true
with: with:
@ -81,27 +110,27 @@ jobs:
name: wasm-bundle name: wasm-bundle
workflow: build-and-store-wasm.yml workflow: build-and-store-wasm.yml
branch: main branch: main
path: src/wasm-lib/pkg path: rust/kcl-wasm-lib/pkg
- name: copy wasm blob - name: copy wasm blob
if: needs.check-rust-changes.outputs.rust-changed == 'false' if: github.event_name != 'schedule' && steps.filter.outputs.rust == 'false'
shell: bash shell: bash
run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public run: cp rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public
continue-on-error: true continue-on-error: true
- name: Setup Rust - name: Setup Rust
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb - uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with: with:
tool: wasm-pack tool: wasm-pack
- name: Cache Wasm (because rust diff) - name: Cache Wasm (because rust diff)
if: needs.check-rust-changes.outputs.rust-changed == 'true' if: github.event_name == 'schedule' || steps.filter.outputs.rust == 'true'
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with: with:
workspaces: './src/wasm-lib' workspaces: './rust'
- name: OR Cache Wasm (because wasm cache failed) - name: OR Cache Wasm (because wasm cache failed)
if: steps.download-wasm.outcome == 'failure' if: steps.download-wasm.outcome == 'failure'
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with: with:
workspaces: './src/wasm-lib' workspaces: './rust'
- name: install good sed - name: install good sed
if: ${{ startsWith(matrix.os, 'macos') }} if: ${{ startsWith(matrix.os, 'macos') }}
shell: bash shell: bash
@ -126,7 +155,7 @@ jobs:
cat /tmp/vector.toml cat /tmp/vector.toml
${HOME}/.vector/bin/vector --config /tmp/vector.toml & ${HOME}/.vector/bin/vector --config /tmp/vector.toml &
- name: Build Wasm (because rust diff) - name: Build Wasm (because rust diff)
if: needs.check-rust-changes.outputs.rust-changed == 'true' if: github.event_name == 'schedule' || steps.filter.outputs.rust == 'true'
shell: bash shell: bash
run: yarn build:wasm run: yarn build:wasm
- name: OR Build Wasm (because wasm cache failed) - name: OR Build Wasm (because wasm cache failed)
@ -142,7 +171,7 @@ jobs:
# TODO: break this in its own job, for now it's not slowing down the overall execution as ubuntu is the quickest, # TODO: break this in its own job, for now it's not slowing down the overall execution as ubuntu is the quickest,
# but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes. # but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes.
run: | run: |
PLATFORM=web yarn playwright test --config=playwright.config.ts --retries="3" --update-snapshots --grep=@snapshot --trace=on --shard=1/1 yarn test:snapshots
env: env:
CI: true CI: true
NODE_ENV: development NODE_ENV: development
@ -202,9 +231,10 @@ jobs:
path: test-results/ path: test-results/
- name: Run playwright/electron flow (with retries) - name: Run playwright/electron flow (with retries)
id: retry id: retry
if: ${{ !cancelled() && (success() || failure()) }} if: ${{ !cancelled() && steps.deps-install.outcome == 'success' }}
uses: nick-fields/retry@v3.0.1 uses: nick-fields/retry@v3.0.2
with: with:
shell: bash
command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}} command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}}
timeout_minutes: 30 timeout_minutes: 30
max_attempts: 25 max_attempts: 25

View File

@ -0,0 +1,401 @@
name: kcl-language-server
on:
push:
branches:
- main
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain.toml'
- 'rust/kcl-language-server/**'
- '**.rs'
- .github/workflows/kcl-language-server.yml
tags:
- 'kcl-*'
pull_request:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain.toml'
- 'rust/kcl-language-server/**'
- '**.rs'
- .github/workflows/kcl-language-server.yml
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTFLAGS: ""
RUSTUP_MAX_RETRIES: 10
FETCH_DEPTH: 0 # pull in the tags for the version string
MACOSX_DEPLOYMENT_TARGET: 10.15
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
jobs:
test:
name: vscode tests
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Install dependencies
run: |
yarn install
cd rust/kcl-language-server
yarn install
- name: Run tests
run: |
cd rust/kcl-language-server
yarn build
yarn test-compile
ls -la dist
xvfb-run -a yarn test
if: runner.os == 'Linux'
- name: Run tests
run: |
cd rust/kcl-language-server
yarn test
if: runner.os != 'Linux'
build-release:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
code-target:
win32-x64
#- os: windows-latest
#target: i686-pc-windows-msvc
#code-target:
#win32-ia32
#- os: windows-latest
#target: aarch64-pc-windows-msvc
#code-target: win32-arm64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
code-target:
linux-x64
#- os: ubuntu-latest
#target: aarch64-unknown-linux-musl
#code-target: linux-arm64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
code-target: linux-arm64
- os: ubuntu-latest
target: arm-unknown-linux-gnueabihf
code-target: linux-armhf
- os: macos-latest
target: x86_64-apple-darwin
code-target: darwin-x64
- os: macos-latest
target: aarch64-apple-darwin
code-target: darwin-arm64
name: build-release (${{ matrix.target }})
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
env:
RA_TARGET: ${{ matrix.target }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
- name: Use correct Rust toolchain
shell: bash
run: |
rm rust/rust-toolchain.toml
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: rust
components: rust-src
target: ${{ matrix.target }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Update apt repositories
if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'arm-unknown-linux-gnueabihf' || matrix.os == 'ubuntu-latest'
run: sudo apt-get update
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: Install deps
shell: bash
run: |
sudo apt install -y \
ca-certificates \
clang \
cmake \
curl \
g++ \
gcc \
gcc-mingw-w64-i686 \
gcc-mingw-w64 \
jq \
libmpc-dev \
libmpfr-dev \
libgmp-dev \
libssl-dev \
libxml2-dev \
mingw-w64 \
wget \
zlib1g-dev
cargo install cross
- name: Install AArch64 target toolchain
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get install gcc-aarch64-linux-gnu
- name: Install ARM target toolchain
if: matrix.target == 'arm-unknown-linux-gnueabihf'
run: sudo apt-get install gcc-arm-linux-gnueabihf
- name: build
run: |
cd rust
cargo kcl-language-server-release build --client-patch-version ${{ github.run_number }}
- name: Install dependencies
run: |
cd rust/kcl-language-server
yarn install
- name: Package Extension (release)
if: startsWith(github.event.ref, 'refs/tags/')
run: |
cd rust/kcl-language-server
npx vsce package -o "../build/kcl-language-server-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }}
- name: Package Extension (nightly)
if: startsWith(github.event.ref, 'refs/tags/') == false
run: |
cd rust/kcl-language-server
npx vsce package -o "../build/kcl-language-server-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} --pre-release
- name: remove server
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
cd rust/kcl-language-server
rm -rf server
- name: Package Extension (no server, release)
if: matrix.target == 'x86_64-unknown-linux-gnu' && startsWith(github.event.ref, 'refs/tags/')
run: |
cd rust/kcl-language-server
npx vsce package -o ../build/kcl-language-server-no-server.vsix
- name: Package Extension (no server, nightly)
if: matrix.target == 'x86_64-unknown-linux-gnu' && startsWith(github.event.ref, 'refs/tags/') == false
run: |
cd rust/kcl-language-server
npx vsce package -o ../build/kcl-language-server-no-server.vsix --pre-release
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.target }}
path: ./rust/build
build-release-x86_64-unknown-linux-musl:
name: build-release (x86_64-unknown-linux-musl)
runs-on: ubuntu-latest
env:
RA_TARGET: x86_64-unknown-linux-musl
# For some reason `-crt-static` is not working for clang without lld
RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
container:
image: alpine:latest
volumes:
- /usr/local/cargo/registry:/usr/local/cargo/registry
steps:
- name: Install dependencies
run: |
apk add --no-cache \
bash \
curl \
git \
clang \
lld \
musl-dev \
nodejs \
yarn \
npm
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
- name: Use correct Rust toolchain
shell: bash
run: |
rm rust/rust-toolchain.toml
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: rust
components: rust-src
target: ${{ matrix.target }}
- name: build
run: |
cd rust
cargo kcl-language-server-release build --client-patch-version ${{ github.run_number }}
- name: Install dependencies
run: |
cd rust/kcl-language-server
yarn install
- name: Package Extension (release)
if: startsWith(github.event.ref, 'refs/tags/')
run: |
cd rust/kcl-language-server
npx vsce package -o "../build/kcl-language-server-alpine-x64.vsix" --target alpine-x64
- name: Package Extension (release)
if: startsWith(github.event.ref, 'refs/tags/') == false
run: |
cd rust/kcl-language-server
npx vsce package -o "../build/kcl-language-server-alpine-x64.vsix" --target alpine-x64 --pre-release
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-x86_64-unknown-linux-musl
path: ./rust/build
publish:
name: publish
runs-on: ubuntu-latest
needs: ["build-release", "build-release-x86_64-unknown-linux-musl"]
if: startsWith(github.event.ref, 'refs/tags')
permissions:
contents: write
steps:
- run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- run: 'echo "TAG: $TAG"'
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
- name: Install Nodejs
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
- run: 'echo "HEAD_SHA: $HEAD_SHA"'
- uses: actions/download-artifact@v4
with:
name: release-aarch64-apple-darwin
path: rust/build
- uses: actions/download-artifact@v4
with:
name: release-x86_64-apple-darwin
path: rust/build
- uses: actions/download-artifact@v4
with:
name: release-x86_64-unknown-linux-gnu
path: rust/build
- uses: actions/download-artifact@v4
with:
name: release-x86_64-unknown-linux-musl
path: rust/build
- uses: actions/download-artifact@v4
with:
name: release-aarch64-unknown-linux-gnu
path: rust/build
- uses: actions/download-artifact@v4
with:
name: release-arm-unknown-linux-gnueabihf
path: rust/build
- uses: actions/download-artifact@v4
with:
name: release-x86_64-pc-windows-msvc
path:
rust/build
#- uses: actions/download-artifact@v4
#with:
#name: release-i686-pc-windows-msvc
#path:
#build
#- uses: actions/download-artifact@v4
#with:
#name: release-aarch64-pc-windows-msvc
#path: rust/build
- run: ls -al ./rust/build
- name: Publish Release
uses: ./.github/actions/github-release
with:
files: "rust/build/*"
name: ${{ env.TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: move files to dir for upload
shell: bash
run: |
cd rust
mkdir -p releases/language-server/${{ env.TAG }}
cp -r build/* releases/language-server/${{ env.TAG }}
- name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v2.1.8"
with:
credentials_json: "${{ secrets.GOOGLE_CLOUD_DL_SA }}"
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2.1.2
with:
project_id: kittycadapi
- name: "upload files to gcp"
id: upload-files
uses: google-github-actions/upload-cloud-storage@v2.2.2
with:
path: rust/releases
destination: dl.kittycad.io
- run: rm rust/build/kcl-language-server-no-server.vsix
- name: Publish Extension (Code Marketplace, release)
# token from https://dev.azure.com/kcl-language-server/
run: |
cd rust/kcl-language-server
npx vsce publish --pat ${{ secrets.VSCE_PAT }} --packagePath ../build/kcl-language-server-*.vsix
- name: Publish Extension (OpenVSX, release)
run: |
cd rust/kcl-language-server
npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../build/kcl-language-server-*.vsix
timeout-minutes: 2

View File

@ -0,0 +1,179 @@
# This file is autogenerated by maturin v1.6.0 and then modified
# To update, run
#
# maturin generate-ci github
#
name: kcl-python-bindings
on:
push:
branches:
- main
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain.toml'
- 'rust/kcl-python-bindings/**'
- '**.rs'
- .github/workflows/kcl-python-bindings.yml
tags:
- 'kcl-*'
pull_request:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain.toml'
- 'rust/kcl-python-bindings/**'
- '**.rs'
- .github/workflows/kcl-python-bindings.yml
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
linux-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: rust/kcl-python-bindings
target: x86_64
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto
before-script-linux: |
yum install openssl-devel -y
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-x86_64
path: rust/kcl-python-bindings/dist
windows:
runs-on: windows-16-cores
strategy:
matrix:
target:
- x64
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: rust/kcl-python-bindings
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.target }}
path: rust/kcl-python-bindings/dist
macos:
runs-on: macos-latest
strategy:
matrix:
target:
- x86_64
- aarch64
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: rust/kcl-python-bindings
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.target }}
path: rust/kcl-python-bindings/dist
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@just
- name: Run tests
run: |
cd rust/kcl-python-bindings
just setup-uv
just test
env:
KITTYCAD_API_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN }}
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
- name: Install codespell
run: |
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
uv pip install pip --upgrade
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
working-directory: rust/kcl-python-bindings
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: rust/kcl-python-bindings/dist
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/')
needs: [linux-x86_64, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
- name: Install codespell
run: |
cd rust/kcl-python-bindings
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
uv pip install pip --upgrade
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
working-directory: rust/kcl-python-bindings
command: upload
args: --non-interactive --skip-existing wheels-*/*

View File

@ -0,0 +1,52 @@
name: KCL Samples Manifest
permissions:
contents: write
pull-requests: write
on:
push:
branches:
- main
pull_request:
workflow_dispatch: # Allows manual triggering from the Actions tab
jobs:
generate-manifest:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
# Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v4
# Run the script to generate the manifest.json
- name: Run manifest generation script
working-directory: public/kcl-samples
run: node generate-manifest.js
# Check if the manifest.json has changed
- name: Check for changes
id: check-for-changes
working-directory: public/kcl-samples
run: |
git diff --exit-code ./manifest.json || echo "changed=changes detected" >> "$GITHUB_OUTPUT"
# Stage and commit the changes if any were made
- name: Commit and push changes
if: ${{ success() && (steps.check-for-changes.outputs.changed == 'changes detected') }}
working-directory: public/kcl-samples
run: |
git add ./manifest.json
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git fetch origin
echo ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
git commit -m "Update manifest.json"
git push origin ${{ github.head_ref }}

View File

@ -0,0 +1,64 @@
on:
push:
branches:
- main
paths:
- 'public/kcl-samples/**'
# pull_request:
# paths:
# - .github/workflows/pr-kcl-samples-repo.yml
workflow_dispatch:
name: Create PR in kcl-samples repo
permissions:
contents: read
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
pr-kcl-samples-repo:
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
# required
app-id: ${{ secrets.GH_ORG_APP_ID }}
private-key: ${{ secrets.GH_ORG_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- uses: actions/checkout@v4
# Checkout the other repo since we want to update the files there.
- uses: actions/checkout@v4
with:
repository: 'KittyCAD/kcl-samples'
ref: next
path: kcl-samples-repo
token: ${{ steps.app-token.outputs.token }}
- name: Move files to repo work tree
shell: bash
run: |
rsync -av --delete \
--exclude='.git' \
--exclude='.github' \
--exclude='screenshots' \
--exclude='step' \
public/kcl-samples/ kcl-samples-repo/
- name: Commit the changes in the repo
shell: bash
run: |
set -euo pipefail
cd kcl-samples-repo
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
export NEW_BRANCH="update-from-modeling-app"
git switch -c "$NEW_BRANCH"
git add --all .
git commit -m "Updates from modeling-app repo" || exit 0
git push -f origin "$NEW_BRANCH"
gh pr create --title "Update from modeling-app" \
--body "Updating files from the modeling-app repo" \
--head "$NEW_BRANCH" \
--reviewer jtran \
--base next || true
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

24
.github/workflows/ruff.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: ruff
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
push:
branches: main
paths:
- '**.py'
- .github/workflows/ruff.yml
pull_request:
paths:
- '**.py'
- .github/workflows/ruff.yml
permissions:
contents: read
pull-requests: write
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3

View File

@ -37,7 +37,7 @@ jobs:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'yarn'
- run: yarn install - run: yarn install
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb - uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with: with:
tool: wasm-pack tool: wasm-pack
- run: yarn build:wasm - run: yarn build:wasm
@ -52,11 +52,12 @@ jobs:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'yarn'
- run: yarn install - run: yarn install
- run: yarn --cwd ./rust/kcl-language-server --modules-folder node_modules install
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
workspaces: './src/wasm-lib' workspaces: './rust'
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb - uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with: with:
tool: wasm-pack tool: wasm-pack
- run: yarn build:wasm - run: yarn build:wasm
@ -72,6 +73,7 @@ jobs:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'yarn'
- run: yarn install - run: yarn install
- run: yarn --cwd ./rust/kcl-language-server --modules-folder node_modules install
- run: yarn lint - run: yarn lint
python-codespell: python-codespell:
@ -98,7 +100,7 @@ jobs:
cache: 'yarn' cache: 'yarn'
- run: yarn install - run: yarn install
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb - uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with: with:
tool: wasm-pack tool: wasm-pack
- run: yarn build:wasm - run: yarn build:wasm
@ -127,7 +129,7 @@ jobs:
cache: 'yarn' cache: 'yarn'
- run: yarn install - run: yarn install
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb - uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with: with:
tool: wasm-pack tool: wasm-pack
- run: yarn build:wasm - run: yarn build:wasm
@ -141,7 +143,7 @@ jobs:
- name: run unit tests - name: run unit tests
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }} if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
run: yarn test:unit run: xvfb-run -a yarn test:unit
env: env:
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}

40
.gitignore vendored
View File

@ -1,7 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies # dependencies
/node_modules node_modules
/.pnp /.pnp
.pnp.js .pnp.js
@ -9,7 +9,7 @@
/coverage /coverage
# production # production
/build build
# misc # misc
.DS_Store .DS_Store
@ -26,16 +26,19 @@ yarn-error.log*
.idea .idea
.vscode .vscode
.helix .helix
src/wasm-lib/.idea
src/wasm-lib/.vscode
# rust # rust
src/wasm-lib/target rust/target
src/wasm-lib/bindings rust/kcl-lib/bindings
src/wasm-lib/kcl/bindings public/kcl_wasm_lib_bg.wasm
public/wasm_lib_bg.wasm rust/lcov.info
src/wasm-lib/lcov.info rust/kcl-wasm-lib/pkg
src/wasm-lib/grackle/test_json_output *.snap.new
rust/kcl-lib/fuzz/Cargo.lock
rust/kcl-language-server-release/Cargo.lock
# kcl language server package
rust/kcl-language-server/dist/
e2e/playwright/playwright-secrets.env e2e/playwright/playwright-secrets.env
e2e/playwright/temp1.png e2e/playwright/temp1.png
@ -48,7 +51,10 @@ e2e/playwright/export-snapshots/*
!e2e/playwright/export-snapshots/*.png !e2e/playwright/export-snapshots/*.png
!e2e/playwright/snapshot-tests.spec.ts-snapshots/*.png !e2e/playwright/snapshot-tests.spec.ts-snapshots/*.png
/kcl-samples /public/kcl-samples.zip
/public/kcl-samples/.github
/public/kcl-samples/screenshots
/public/kcl-samples/step
/test-results/ /test-results/
/playwright-report/ /playwright-report/
/blob-report/ /blob-report/
@ -59,16 +65,20 @@ e2e/playwright/export-snapshots/*
## generated files ## generated files
src/**/*.typegen.ts src/**/*.typegen.ts
src/wasm-lib/grackle/stdlib_cube_partial.json
Mac_App_Distribution.provisionprofile Mac_App_Distribution.provisionprofile
*.tsbuildinfo *.tsbuildinfo
src/wasm-lib/pkg
.eslintcache .eslintcache
venv
.vite/ .vite/
# electron # electron
out/ out/
*.snap.new
# python
__pycache__/
uv.lock
dist
venv
.vscode-test

View File

@ -7,11 +7,10 @@ coverage
*.rs *.rs
*.hbs *.hbs
target target
src/wasm-lib/pkg
src/wasm-lib/kcl/bindings
e2e/playwright/export-snapshots e2e/playwright/export-snapshots
e2e/playwright/snapshots/prompt-to-edit e2e/playwright/snapshots/prompt-to-edit
# XState generated files # XState generated files
src/machines/**.typegen.ts src/machines/**.typegen.ts
.vscode-test

View File

@ -1,6 +1,6 @@
.PHONY: dev .PHONY: dev
WASM_LIB_FILES := $(wildcard src/wasm-lib/**/*.rs) KCL_WASM_LIB_FILES := $(wildcard rust/**/*.rs)
TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts) TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts)
XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts) XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts)
@ -18,7 +18,7 @@ lee-electron-test:
$(XSTATE_TYPEGENS): $(TS_SRC) $(XSTATE_TYPEGENS): $(TS_SRC)
yarn xstate typegen 'src/**/*.ts?(x)' yarn xstate typegen 'src/**/*.ts?(x)'
public/wasm_lib_bg.wasm: $(WASM_LIB_FILES) public/kcl_wasm_lib_bg.wasm: $(KCL_WASM_LIB_FILES)
yarn build:wasm yarn build:wasm
node_modules: package.json yarn.lock node_modules: package.json yarn.lock

View File

@ -40,7 +40,7 @@ The 3D view in Modeling App is just a video stream from our hosted geometry engi
[Original demo video](https://drive.google.com/file/d/183_wjqGdzZ8EEZXSqZ3eDcJocYPCyOdC/view?pli=1) [Original demo video](https://drive.google.com/file/d/183_wjqGdzZ8EEZXSqZ3eDcJocYPCyOdC/view?pli=1)
[Original demo slides](https://github.com/KittyCAD/Eng/files/10398178/demo.pdf) [Original demo slides](https://github.com/user-attachments/files/19010536/demo.pdf)
## Get started ## Get started
@ -52,18 +52,21 @@ Install a node version manager such as [fnm](https://github.com/Schniz/fnm?tab=r
On Windows, it's also recommended to [upgrade your PowerShell version](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.5#winget), we're using 7. On Windows, it's also recommended to [upgrade your PowerShell version](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.5#winget), we're using 7.
Then in the repo run the following to install and use the node version specified in `.nvmrc`. You might need to specify your processor architecture with `--arch arm64` or `--arch x64` if it's not autodetected. Then in the repo run the following to install and use the node version specified in `.nvmrc`. You might need to specify your processor architecture with `--arch arm64` or `--arch x64` if it's not autodetected.
``` ```
fnm install --corepack-enabled fnm install --corepack-enabled
fnm use fnm use
``` ```
Install the NPM dependencies with: Install the NPM dependencies with:
``` ```
yarn install yarn install
``` ```
This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We have package scripts to run rustup, see `package.json` for reference: This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We have package scripts to run rustup, see `package.json` for reference:
``` ```
# macOS/Linux # macOS/Linux
yarn install:rust yarn install:rust
@ -75,6 +78,7 @@ yarn install:wasm-pack:cargo
``` ```
Then to build the WASM layer, run: Then to build the WASM layer, run:
``` ```
# macOS/Linux # macOS/Linux
yarn build:wasm yarn build:wasm
@ -135,6 +139,7 @@ To package the app for your platform with electron-builder, run `yarn tronb:pack
Which commands from setup are one off vs need to be run every time? Which commands from setup are one off vs need to be run every time?
The following will need to be run when checking out a new commit and guarantees the build is not stale: The following will need to be run when checking out a new commit and guarantees the build is not stale:
```bash ```bash
yarn install yarn install
yarn build:wasm yarn build:wasm
@ -185,11 +190,12 @@ Manually test against this [list](https://github.com/KittyCAD/modeling-app/issue
##### Updater-test builds ##### Updater-test builds
The other `build-apps` output in the release `build-apps` workflow (triggered by 2.) is `updater-test-{arch}-{platform}`. It's a semi-automated process: for macOS, Windows, and Linux, download the corresponding updater-test artifact file, install the app, run it, expect an updater prompt to a dummy v0.255.255, install it and check that the app comes back at that version. The other `build-apps` output in the release `build-apps` workflow (triggered by 2.) is `updater-test-{arch}-{platform}`. It's a semi-automated process: for macOS, Windows, and Linux, download the corresponding updater-test artifact file, install the app, run it, expect an updater prompt to a dummy v0.255.255, install it and check that the app comes back at that version.
The only difference with these builds is that they point to a different update location on the release bucket, with this dummy v0.255.255 always available. This helps ensuring that the version we release will be able to update to the next one available. The only difference with these builds is that they point to a different update location on the release bucket, with this dummy v0.255.255 always available. This helps ensuring that the version we release will be able to update to the next one available.
If the prompt doesn't show up, start the app in command line to grab the electron-updater logs. This is likely an issue with the current build that needs addressing (or the updater-test location in the storage bucket). If the prompt doesn't show up, start the app in command line to grab the electron-updater logs. This is likely an issue with the current build that needs addressing (or the updater-test location in the storage bucket).
``` ```
# Windows (PowerShell) # Windows (PowerShell)
& 'C:\Program Files\Zoo Modeling App\Zoo Modeling App.exe' & 'C:\Program Files\Zoo Modeling App\Zoo Modeling App.exe'
@ -205,15 +211,14 @@ If the prompt doesn't show up, start the app in command line to grab the electro
Head over to https://github.com/KittyCAD/modeling-app/releases/new, pick the newly created tag and type it in the _Release title_ field as well. Head over to https://github.com/KittyCAD/modeling-app/releases/new, pick the newly created tag and type it in the _Release title_ field as well.
Hit _Generate release notes_ as a starting point to discuss the changelog in the issue. Once done, make sure _Set as the latest release_ is checked, and hit _Publish release_. Hit _Generate release notes_ as a starting point to discuss the changelog in the issue. Once done, make sure _Set as the latest release_ is checked, and hit _Publish release_.
A new `publish-apps-release` will kick in and you should be able to find it [here](https://github.com/KittyCAD/modeling-app/actions?query=event%3Arelease). On success, the files will be uploaded to the public bucket as well as to the GitHub release, and the announcement on Discord will be sent. A new `publish-apps-release` will kick in and you should be able to find it [here](https://github.com/KittyCAD/modeling-app/actions?query=event%3Arelease). On success, the files will be uploaded to the public bucket as well as to the GitHub release, and the announcement on Discord will be sent.
#### 5. Close the issue #### 5. Close the issue
If everything is well and the release is out to the public, the issue tracking the release shall be closed. If everything is well and the release is out to the public, the issue tracking the release shall be closed.
## Fuzzing the parser ## Fuzzing the parser
Make sure you install cargo fuzz: Make sure you install cargo fuzz:
@ -223,7 +228,7 @@ $ cargo install cargo-fuzz
``` ```
```bash ```bash
$ cd src/wasm-lib/kcl $ cd rust/kcl-lib
# list the fuzz targets # list the fuzz targets
$ cargo fuzz list $ cargo fuzz list
@ -251,6 +256,7 @@ snapshottoken=<your-snapshot-token>
For a portable way to run Playwright you'll need Docker. For a portable way to run Playwright you'll need Docker.
#### Generic example #### Generic example
After that, open a terminal and run: After that, open a terminal and run:
```bash ```bash
@ -263,7 +269,6 @@ and in another terminal, run:
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" <test suite> PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" <test suite>
``` ```
#### Specific example #### Specific example
open a terminal and run: open a terminal and run:
@ -281,7 +286,6 @@ PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project=
run a specific test change the test from `test('...` to `test.only('...` run a specific test change the test from `test('...` to `test.only('...`
(note if you commit this, the tests will instantly fail without running any of the tests) (note if you commit this, the tests will instantly fail without running any of the tests)
**Gotcha**: running the docker container with a mismatched image against your `./node_modules/playwright` will cause a failure. Make sure the versions are matched and up to date. **Gotcha**: running the docker container with a mismatched image against your `./node_modules/playwright` will cause a failure. Make sure the versions are matched and up to date.
run headed run headed
@ -375,17 +379,19 @@ Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testin
- `just` - `just`
#### Setting KITTYCAD_API_TOKEN #### Setting KITTYCAD_API_TOKEN
Use the production zoo.dev token, set this environment variable before running the tests Use the production zoo.dev token, set this environment variable before running the tests
#### Installing cargonextest #### Installing cargonextest
``` ```
cd src/wasm-lib cd rust
cargo search cargo-nextest cargo search cargo-nextest
cargo install cargo-nextest cargo install cargo-nextest
``` ```
#### just #### just
install [`just`](https://github.com/casey/just?tab=readme-ov-file#pre-built-binaries) install [`just`](https://github.com/casey/just?tab=readme-ov-file#pre-built-binaries)
#### Running the tests #### Running the tests
@ -395,7 +401,7 @@ install [`just`](https://github.com/casey/just?tab=readme-ov-file#pre-built-bina
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set # Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
# Make sure you installed cargo-nextest # Make sure you installed cargo-nextest
# Make sure you installed just # Make sure you installed just
cd src/wasm-lib cd rust
just test just test
``` ```
@ -403,7 +409,7 @@ just test
# Without just # Without just
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set # Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
# Make sure you installed cargo-nextest # Make sure you installed cargo-nextest
cd src/wasm-lib cd rust
export RUST_BRACKTRACE="full" && cargo nextest run --workspace --test-threads=1 export RUST_BRACKTRACE="full" && cargo nextest run --workspace --test-threads=1
``` ```
@ -412,13 +418,14 @@ Where `XXX` is an API token from the production engine (NOT the dev environment)
We recommend using [nextest](https://nexte.st/) to run the Rust tests (its faster and is used in CI). Once installed, run the tests using We recommend using [nextest](https://nexte.st/) to run the Rust tests (its faster and is used in CI). Once installed, run the tests using
``` ```
cd src/wasm-lib cd rust
KITTYCAD_API_TOKEN=XXX cargo run nextest KITTYCAD_API_TOKEN=XXX cargo run nextest
``` ```
### Mapping CI CD jobs to local commands ### Mapping CI CD jobs to local commands
When you see the CI CD fail on jobs you may wonder three things When you see the CI CD fail on jobs you may wonder three things
- Do I have a bug in my code? - Do I have a bug in my code?
- Is the test flaky? - Is the test flaky?
- Is there a bug in `main`? - Is there a bug in `main`?
@ -437,7 +444,6 @@ yarn test-setup
> Gotcha, are packages up to date and is the wasm built? > Gotcha, are packages up to date and is the wasm built?
``` ```
yarn tsc yarn tsc
yarn fmt-check yarn fmt-check
@ -493,7 +499,7 @@ PS: for the debug panel, the following JSON is useful for snapping the camera
## KCL ## KCL
For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/src/wasm-lib/kcl). For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/rust/kcl-lib).
### Logging ### Logging

View File

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

View File

@ -9,7 +9,7 @@ Compute the arccosine of a number (in radians).
```js ```js
acos(num: number) -> number acos(num: number): number
``` ```
### Tags ### Tags
@ -21,11 +21,11 @@ acos(num: number) -> number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | `number` | | Yes | | `num` | [`number`](/docs/kcl/types/number) | | Yes |
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -13,7 +13,7 @@ angleToMatchLengthX(
tag: TagIdentifier, tag: TagIdentifier,
to: number, to: number,
sketch: Sketch, sketch: Sketch,
) -> number ): number
``` ```
@ -21,13 +21,13 @@ angleToMatchLengthX(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes | | [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
| `to` | `number` | | Yes | | `to` | [`number`](/docs/kcl/types/number) | | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -13,7 +13,7 @@ angleToMatchLengthY(
tag: TagIdentifier, tag: TagIdentifier,
to: number, to: number,
sketch: Sketch, sketch: Sketch,
) -> number ): number
``` ```
@ -21,13 +21,13 @@ angleToMatchLengthY(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes | | [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
| `to` | `number` | | Yes | | `to` | [`number`](/docs/kcl/types/number) | | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -1,19 +1,19 @@
--- ---
title: "angledLine" title: "angledLine"
excerpt: "Draw a line segment relative to the current origin using the polar" excerpt: "Draw a line segment relative to the current origin using the polar measure of some angle and distance."
layout: manual layout: manual
--- ---
Draw a line segment relative to the current origin using the polar Draw a line segment relative to the current origin using the polar measure of some angle and distance.
measure of some angle and distance.
```js ```js
angledLine( angledLine(
data: AngledLineData, data: AngledLineData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Sketch ): Sketch
``` ```
@ -22,12 +22,12 @@ angledLine(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes | | `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples

View File

@ -1,19 +1,19 @@
--- ---
title: "angledLineOfXLength" title: "angledLineOfXLength"
excerpt: "Create a line segment from the current 2-dimensional sketch origin" excerpt: "Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'x' dimension."
layout: manual layout: manual
--- ---
Create a line segment from the current 2-dimensional sketch origin Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'x' dimension.
along some angle (in degrees) for some relative length in the 'x' dimension.
```js ```js
angledLineOfXLength( angledLineOfXLength(
data: AngledLineData, data: AngledLineData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Sketch ): Sketch
``` ```
@ -22,12 +22,12 @@ angledLineOfXLength(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes | | `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples

View File

@ -1,19 +1,19 @@
--- ---
title: "angledLineOfYLength" title: "angledLineOfYLength"
excerpt: "Create a line segment from the current 2-dimensional sketch origin" excerpt: "Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'y' dimension."
layout: manual layout: manual
--- ---
Create a line segment from the current 2-dimensional sketch origin Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'y' dimension.
along some angle (in degrees) for some relative length in the 'y' dimension.
```js ```js
angledLineOfYLength( angledLineOfYLength(
data: AngledLineData, data: AngledLineData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Sketch ): Sketch
``` ```
@ -22,12 +22,12 @@ angledLineOfYLength(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes | | `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples

View File

@ -1,19 +1,19 @@
--- ---
title: "angledLineThatIntersects" title: "angledLineThatIntersects"
excerpt: "Draw an angled line from the current origin, constructing a line segment" excerpt: "Draw an angled line from the current origin, constructing a line segment such that the newly created line intersects the desired target line segment."
layout: manual layout: manual
--- ---
Draw an angled line from the current origin, constructing a line segment Draw an angled line from the current origin, constructing a line segment such that the newly created line intersects the desired target line segment.
such that the newly created line intersects the desired target line segment.
```js ```js
angledLineThatIntersects( angledLineThatIntersects(
data: AngledLineThatIntersectsData, data: AngledLineThatIntersectsData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Sketch ): Sketch
``` ```
@ -22,12 +22,12 @@ angledLineThatIntersects(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`AngledLineThatIntersectsData`](/docs/kcl/types/AngledLineThatIntersectsData) | Data for drawing an angled line that intersects with a given line. | Yes | | `data` | [`AngledLineThatIntersectsData`](/docs/kcl/types/AngledLineThatIntersectsData) | Data for drawing an angled line that intersects with a given line. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples

View File

@ -1,19 +1,19 @@
--- ---
title: "angledLineToX" title: "angledLineToX"
excerpt: "Create a line segment from the current 2-dimensional sketch origin" excerpt: "Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension."
layout: manual layout: manual
--- ---
Create a line segment from the current 2-dimensional sketch origin Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension.
along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension.
```js ```js
angledLineToX( angledLineToX(
data: AngledLineToData, data: AngledLineToData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Sketch ): Sketch
``` ```
@ -22,12 +22,12 @@ angledLineToX(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes | | `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples

View File

@ -1,19 +1,19 @@
--- ---
title: "angledLineToY" title: "angledLineToY"
excerpt: "Create a line segment from the current 2-dimensional sketch origin" excerpt: "Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension."
layout: manual layout: manual
--- ---
Create a line segment from the current 2-dimensional sketch origin Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension.
along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension.
```js ```js
angledLineToY( angledLineToY(
data: AngledLineToData, data: AngledLineToData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Sketch ): Sketch
``` ```
@ -22,12 +22,12 @@ angledLineToY(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes | | `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples

View File

@ -14,7 +14,7 @@ appearance(
color: String, color: String,
metalness?: number, metalness?: number,
roughness?: number, roughness?: number,
) -> SolidSet ): SolidSet
``` ```
@ -24,8 +24,8 @@ appearance(
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) whose appearance is being set | Yes | | `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) whose appearance is being set | Yes |
| `color` | `String` | Color of the new material, a hex string like '#ff0000' | Yes | | `color` | `String` | Color of the new material, a hex string like '#ff0000' | Yes |
| `metalness` | `number` | Metalness of the new material, a percentage like 95.7. | No | | `metalness` | [`number`](/docs/kcl/types/number) | Metalness of the new material, a percentage like 95.7. | No |
| `roughness` | `number` | Roughness of the new material, a percentage like 95.7. | No | | `roughness` | [`number`](/docs/kcl/types/number) | Roughness of the new material, a percentage like 95.7. | No |
### Returns ### Returns
@ -53,7 +53,7 @@ example = extrude(exampleSketch, length = 5)
```js ```js
// Add color to a revolved solid. // Add color to a revolved solid.
sketch001 = startSketchOn('XY') sketch001 = startSketchOn('XY')
|> circle({ center = [15, 0], radius = 5 }, %) |> circle(center = [15, 0], radius = 5)
|> revolve({ angle = 360, axis = 'y' }, %) |> revolve({ angle = 360, axis = 'y' }, %)
|> appearance(color = '#ff0000', metalness = 90, roughness = 90) |> appearance(color = '#ff0000', metalness = 90, roughness = 90)
``` ```
@ -195,10 +195,10 @@ sweepPath = startSketchOn('XZ')
|> line(end = [0, 7]) |> line(end = [0, 7])
pipeHole = startSketchOn('XY') pipeHole = startSketchOn('XY')
|> circle({ center = [0, 0], radius = 1.5 }, %) |> circle(center = [0, 0], radius = 1.5)
sweepSketch = startSketchOn('XY') sweepSketch = startSketchOn('XY')
|> circle({ center = [0, 0], radius = 2 }, %) |> circle(center = [0, 0], radius = 2)
|> hole(pipeHole, %) |> hole(pipeHole, %)
|> sweep(path = sweepPath) |> sweep(path = sweepPath)
|> appearance(color = "#ff0000", metalness = 50, roughness = 50) |> appearance(color = "#ff0000", metalness = 50, roughness = 50)

View File

@ -15,7 +15,7 @@ arc(
data: ArcData, data: ArcData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Sketch ): Sketch
``` ```
@ -24,12 +24,12 @@ arc(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`ArcData`](/docs/kcl/types/ArcData) | Data to draw an arc. | Yes | | `data` | [`ArcData`](/docs/kcl/types/ArcData) | Data to draw an arc. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples

View File

@ -1,10 +1,10 @@
--- ---
title: "arcTo" title: "arcTo"
excerpt: "Draw a 3 point arc." excerpt: "Draw a three point arc."
layout: manual layout: manual
--- ---
Draw a 3 point arc. Draw a three point arc.
The arc is constructed such that the start point is the current position of the sketch and two more points defined as the end and interior point. The interior point is placed between the start point and end point. The radius of the arc will be controlled by how far the interior point is placed from the start and end. The arc is constructed such that the start point is the current position of the sketch and two more points defined as the end and interior point. The interior point is placed between the start point and end point. The radius of the arc will be controlled by how far the interior point is placed from the start and end.
@ -13,7 +13,7 @@ arcTo(
data: ArcToData, data: ArcToData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Sketch ): Sketch
``` ```
@ -22,12 +22,12 @@ arcTo(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`ArcToData`](/docs/kcl/types/ArcToData) | Data to draw a three point arc (arcTo). | Yes | | `data` | [`ArcToData`](/docs/kcl/types/ArcToData) | Data to draw a three point arc (arcTo). | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples

View File

@ -9,7 +9,7 @@ Compute the arcsine of a number (in radians).
```js ```js
asin(num: number) -> number asin(num: number): number
``` ```
### Tags ### Tags
@ -21,11 +21,11 @@ asin(num: number) -> number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | `number` | | Yes | | `num` | [`number`](/docs/kcl/types/number) | | Yes |
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -1,18 +1,18 @@
--- ---
title: "assert" title: "assert"
excerpt: "Check a value at runtime, and raise an error if the argument provided" excerpt: "Check a value at runtime, and raise an error if the argument provided is false."
layout: manual layout: manual
--- ---
Check a value at runtime, and raise an error if the argument provided Check a value at runtime, and raise an error if the argument provided is false.
is false.
```js ```js
assert( assert(
data: bool, data: bool,
message: string, message: string,
) -> () ): ()
``` ```
@ -20,8 +20,8 @@ assert(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | `bool` | | Yes | | `data` | [`bool`](/docs/kcl/types/bool) | | Yes |
| `message` | `string` | | Yes | | `message` | [`string`](/docs/kcl/types/string) | | Yes |
### Returns ### Returns

View File

@ -1,12 +1,12 @@
--- ---
title: "assertEqual" title: "assertEqual"
excerpt: "Check that a numerical value equals another at runtime," excerpt: "Check that a numerical value equals another at runtime, otherwise raise an error."
layout: manual layout: manual
--- ---
Check that a numerical value equals another at runtime, Check that a numerical value equals another at runtime, otherwise raise an error.
otherwise raise an error.
```js ```js
assertEqual( assertEqual(
@ -14,7 +14,7 @@ assertEqual(
right: number, right: number,
epsilon: number, epsilon: number,
message: string, message: string,
) -> () ): ()
``` ```
@ -22,10 +22,10 @@ assertEqual(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `left` | `number` | | Yes | | `left` | [`number`](/docs/kcl/types/number) | | Yes |
| `right` | `number` | | Yes | | `right` | [`number`](/docs/kcl/types/number) | | Yes |
| `epsilon` | `number` | | Yes | | `epsilon` | [`number`](/docs/kcl/types/number) | | Yes |
| `message` | `string` | | Yes | | `message` | [`string`](/docs/kcl/types/string) | | Yes |
### Returns ### Returns

View File

@ -1,19 +1,19 @@
--- ---
title: "assertGreaterThan" title: "assertGreaterThan"
excerpt: "Check that a numerical value is greater than another at runtime," excerpt: "Check that a numerical value is greater than another at runtime, otherwise raise an error."
layout: manual layout: manual
--- ---
Check that a numerical value is greater than another at runtime, Check that a numerical value is greater than another at runtime, otherwise raise an error.
otherwise raise an error.
```js ```js
assertGreaterThan( assertGreaterThan(
left: number, left: number,
right: number, right: number,
message: string, message: string,
) -> () ): ()
``` ```
@ -21,9 +21,9 @@ assertGreaterThan(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `left` | `number` | | Yes | | `left` | [`number`](/docs/kcl/types/number) | | Yes |
| `right` | `number` | | Yes | | `right` | [`number`](/docs/kcl/types/number) | | Yes |
| `message` | `string` | | Yes | | `message` | [`string`](/docs/kcl/types/string) | | Yes |
### Returns ### Returns

View File

@ -1,19 +1,19 @@
--- ---
title: "assertGreaterThanOrEq" title: "assertGreaterThanOrEq"
excerpt: "Check that a numerical value is greater than or equal to another at runtime," excerpt: "Check that a numerical value is greater than or equal to another at runtime, otherwise raise an error."
layout: manual layout: manual
--- ---
Check that a numerical value is greater than or equal to another at runtime, Check that a numerical value is greater than or equal to another at runtime, otherwise raise an error.
otherwise raise an error.
```js ```js
assertGreaterThanOrEq( assertGreaterThanOrEq(
left: number, left: number,
right: number, right: number,
message: string, message: string,
) -> () ): ()
``` ```
@ -21,9 +21,9 @@ assertGreaterThanOrEq(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `left` | `number` | | Yes | | `left` | [`number`](/docs/kcl/types/number) | | Yes |
| `right` | `number` | | Yes | | `right` | [`number`](/docs/kcl/types/number) | | Yes |
| `message` | `string` | | Yes | | `message` | [`string`](/docs/kcl/types/string) | | Yes |
### Returns ### Returns

View File

@ -1,19 +1,19 @@
--- ---
title: "assertLessThan" title: "assertLessThan"
excerpt: "Check that a numerical value is less than to another at runtime," excerpt: "Check that a numerical value is less than to another at runtime, otherwise raise an error."
layout: manual layout: manual
--- ---
Check that a numerical value is less than to another at runtime, Check that a numerical value is less than to another at runtime, otherwise raise an error.
otherwise raise an error.
```js ```js
assertLessThan( assertLessThan(
left: number, left: number,
right: number, right: number,
message: string, message: string,
) -> () ): ()
``` ```
@ -21,9 +21,9 @@ assertLessThan(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `left` | `number` | | Yes | | `left` | [`number`](/docs/kcl/types/number) | | Yes |
| `right` | `number` | | Yes | | `right` | [`number`](/docs/kcl/types/number) | | Yes |
| `message` | `string` | | Yes | | `message` | [`string`](/docs/kcl/types/string) | | Yes |
### Returns ### Returns

View File

@ -1,19 +1,19 @@
--- ---
title: "assertLessThanOrEq" title: "assertLessThanOrEq"
excerpt: "Check that a numerical value is less than or equal to another at runtime," excerpt: "Check that a numerical value is less than or equal to another at runtime, otherwise raise an error."
layout: manual layout: manual
--- ---
Check that a numerical value is less than or equal to another at runtime, Check that a numerical value is less than or equal to another at runtime, otherwise raise an error.
otherwise raise an error.
```js ```js
assertLessThanOrEq( assertLessThanOrEq(
left: number, left: number,
right: number, right: number,
message: string, message: string,
) -> () ): ()
``` ```
@ -21,9 +21,9 @@ assertLessThanOrEq(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `left` | `number` | | Yes | | `left` | [`number`](/docs/kcl/types/number) | | Yes |
| `right` | `number` | | Yes | | `right` | [`number`](/docs/kcl/types/number) | | Yes |
| `message` | `string` | | Yes | | `message` | [`string`](/docs/kcl/types/string) | | Yes |
### Returns ### Returns

View File

@ -9,7 +9,7 @@ Compute the arctangent of a number (in radians).
```js ```js
atan(num: number) -> number atan(num: number): number
``` ```
### Tags ### Tags
@ -21,11 +21,11 @@ atan(num: number) -> number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | `number` | | Yes | | `num` | [`number`](/docs/kcl/types/number) | | Yes |
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -12,7 +12,7 @@ Compute the four quadrant arctangent of Y and X (in radians).
atan2( atan2(
y: number, y: number,
x: number, x: number,
) -> number ): number
``` ```
### Tags ### Tags
@ -24,12 +24,12 @@ atan2(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `y` | `number` | | Yes | | `y` | [`number`](/docs/kcl/types/number) | | Yes |
| `x` | `number` | | Yes | | `x` | [`number`](/docs/kcl/types/number) | | Yes |
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -1,19 +1,19 @@
--- ---
title: "bezierCurve" title: "bezierCurve"
excerpt: "Draw a smooth, continuous, curved line segment from the current origin to" excerpt: "Draw a smooth, continuous, curved line segment from the current origin to the desired (x, y), using a number of control points to shape the curve's shape."
layout: manual layout: manual
--- ---
Draw a smooth, continuous, curved line segment from the current origin to Draw a smooth, continuous, curved line segment from the current origin to the desired (x, y), using a number of control points to shape the curve's shape.
the desired (x, y), using a number of control points to shape the curve's shape.
```js ```js
bezierCurve( bezierCurve(
data: BezierData, data: BezierData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Sketch ): Sketch
``` ```
@ -22,12 +22,12 @@ bezierCurve(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`BezierData`](/docs/kcl/types/BezierData) | Data to draw a bezier curve. | Yes | | `data` | [`BezierData`](/docs/kcl/types/BezierData) | Data to draw a bezier curve. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples

View File

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

View File

@ -14,7 +14,7 @@ chamfer(
length: number, length: number,
tags: [EdgeReference], tags: [EdgeReference],
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Solid ): Solid
``` ```
@ -23,13 +23,13 @@ chamfer(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | The solid whose edges should be chamfered | Yes | | `solid` | [`Solid`](/docs/kcl/types/Solid) | The solid whose edges should be chamfered | Yes |
| `length` | `number` | The length of the chamfer | Yes | | `length` | [`number`](/docs/kcl/types/number) | The length of the chamfer | Yes |
| `tags` | [`[EdgeReference]`](/docs/kcl/types/EdgeReference) | The paths you want to chamfer | Yes | | `tags` | [`[EdgeReference]`](/docs/kcl/types/EdgeReference) | The paths you want to chamfer | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this chamfer | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this chamfer | No |
### Returns ### Returns
[`Solid`](/docs/kcl/types/Solid) - A solid is a collection of extrude surfaces. [`Solid`](/docs/kcl/types/Solid)
### Examples ### Examples

View File

@ -1,19 +1,20 @@
--- ---
title: "circle" title: "circle"
excerpt: "Construct a 2-dimensional circle, of the specified radius, centered at" excerpt: "Construct a 2-dimensional circle, of the specified radius, centered at the provided (x, y) origin point."
layout: manual layout: manual
--- ---
Construct a 2-dimensional circle, of the specified radius, centered at Construct a 2-dimensional circle, of the specified radius, centered at the provided (x, y) origin point.
the provided (x, y) origin point.
```js ```js
circle( circle(
data: CircleData, sketchOrSurface: SketchOrSurface,
sketchSurfaceOrGroup: SketchOrSurface, center: [number],
radius: number,
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Sketch ): Sketch
``` ```
@ -21,20 +22,21 @@ circle(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`CircleData`](/docs/kcl/types/CircleData) | Data for drawing an circle | Yes | | `sketchOrSurface` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes |
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes | | `center` | [`[number]`](/docs/kcl/types/number) | The center of the circle. | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | `radius` | [`number`](/docs/kcl/types/number) | The radius of the circle. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this circle | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples
```js ```js
exampleSketch = startSketchOn("-XZ") exampleSketch = startSketchOn("-XZ")
|> circle({ center = [0, 0], radius = 10 }, %) |> circle(center = [0, 0], radius = 10)
example = extrude(exampleSketch, length = 5) example = extrude(exampleSketch, length = 5)
``` ```
@ -48,7 +50,7 @@ exampleSketch = startSketchOn("XZ")
|> line(end = [0, 30]) |> line(end = [0, 30])
|> line(end = [-30, 0]) |> line(end = [-30, 0])
|> close() |> close()
|> hole(circle({ center = [0, 15], radius = 5 }, %), %) |> hole(circle(center = [0, 15], radius = 5), %)
example = extrude(exampleSketch, length = 5) example = extrude(exampleSketch, length = 5)
``` ```

View File

@ -15,7 +15,7 @@ circleThreePoint(
p3: [number], p3: [number],
sketchSurfaceOrGroup: SketchOrSurface, sketchSurfaceOrGroup: SketchOrSurface,
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Sketch ): Sketch
``` ```
@ -23,15 +23,15 @@ circleThreePoint(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `p1` | `[number]` | 1st point to derive the circle. | Yes | | `p1` | [`[number]`](/docs/kcl/types/number) | 1st point to derive the circle. | Yes |
| `p2` | `[number]` | 2nd point to derive the circle. | Yes | | `p2` | [`[number]`](/docs/kcl/types/number) | 2nd point to derive the circle. | Yes |
| `p3` | `[number]` | 3rd point to derive the circle. | Yes | | `p3` | [`[number]`](/docs/kcl/types/number) | 3rd point to derive the circle. | Yes |
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes | | `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Identifier for the circle to reference elsewhere. | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Identifier for the circle to reference elsewhere. | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples

View File

@ -1,18 +1,18 @@
--- ---
title: "close" title: "close"
excerpt: "Construct a line segment from the current origin back to the profile's" excerpt: "Construct a line segment from the current origin back to the profile's origin, ensuring the resulting 2-dimensional sketch is not open-ended."
layout: manual layout: manual
--- ---
Construct a line segment from the current origin back to the profile's Construct a line segment from the current origin back to the profile's origin, ensuring the resulting 2-dimensional sketch is not open-ended.
origin, ensuring the resulting 2-dimensional sketch is not open-ended.
```js ```js
close( close(
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Sketch ): Sketch
``` ```
@ -21,11 +21,11 @@ close(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | The sketch you want to close | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | The sketch you want to close | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples

View File

@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `0.39
We merely provide these functions for convenience and readability, as `10 * cm()` is more readable that your intent is "I want 10 centimeters" than `10 * 10`, if the project settings are in millimeters. We merely provide these functions for convenience and readability, as `10 * cm()` is more readable that your intent is "I want 10 centimeters" than `10 * 10`, if the project settings are in millimeters.
```js ```js
cm() -> number cm(): number
``` ```
### Tags ### Tags
@ -26,7 +26,7 @@ cm() -> number
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -18,7 +18,7 @@ std::math::PI: number = 3.14159265358979323846264338327950288_
circumference = 70 circumference = 70
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> circle({ center = [0, 0], radius = circumference/ (2 * PI) }, %) |> circle(center = [0, 0], radius = circumference/ (2 * PI))
example = extrude(exampleSketch, length = 5) example = extrude(exampleSketch, length = 5)
``` ```

View File

@ -11,7 +11,7 @@ Return the value of Eulers number `e`.
**DEPRECATED** use the constant E **DEPRECATED** use the constant E
```js ```js
e() -> number e(): number
``` ```
### Tags ### Tags
@ -22,7 +22,7 @@ e() -> number
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -1,18 +1,18 @@
--- ---
title: "extrude" title: "extrude"
excerpt: "Extend a 2-dimensional sketch through a third dimension in order to" excerpt: "Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid."
layout: manual layout: manual
--- ---
Extend a 2-dimensional sketch through a third dimension in order to Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid.
create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid.
```js ```js
extrude( extrude(
sketchSet: SketchSet, sketchSet: SketchSet,
length: number, length: number,
) -> SolidSet ): SolidSet
``` ```
@ -21,7 +21,7 @@ extrude(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketches should be extruded | Yes | | `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketches should be extruded | Yes |
| `length` | `number` | How far to extrude the given sketches | Yes | | `length` | [`number`](/docs/kcl/types/number) | How far to extrude the given sketches | Yes |
### Returns ### Returns

View File

@ -15,7 +15,7 @@ fillet(
tags: [EdgeReference], tags: [EdgeReference],
tolerance?: number, tolerance?: number,
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Solid ): Solid
``` ```
@ -24,14 +24,14 @@ fillet(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | The solid whose edges should be filletted | Yes | | `solid` | [`Solid`](/docs/kcl/types/Solid) | The solid whose edges should be filletted | Yes |
| `radius` | `number` | The radius of the fillet | Yes | | `radius` | [`number`](/docs/kcl/types/number) | The radius of the fillet | Yes |
| `tags` | [`[EdgeReference]`](/docs/kcl/types/EdgeReference) | The paths you want to fillet | Yes | | `tags` | [`[EdgeReference]`](/docs/kcl/types/EdgeReference) | The paths you want to fillet | Yes |
| `tolerance` | `number` | The tolerance for this fillet | No | | `tolerance` | [`number`](/docs/kcl/types/number) | The tolerance for this fillet | No |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this fillet | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this fillet | No |
### Returns ### Returns
[`Solid`](/docs/kcl/types/Solid) - A solid is a collection of extrude surfaces. [`Solid`](/docs/kcl/types/Solid)
### Examples ### Examples

View File

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

View File

@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `12`.
We merely provide these functions for convenience and readability, as `10 * ft()` is more readable that your intent is "I want 10 feet" than `10 * 304.8`, if the project settings are in millimeters. We merely provide these functions for convenience and readability, as `10 * ft()` is more readable that your intent is "I want 10 feet" than `10 * 304.8`, if the project settings are in millimeters.
```js ```js
ft() -> number ft(): number
``` ```
### Tags ### Tags
@ -26,7 +26,7 @@ ft() -> number
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -9,7 +9,7 @@ Get the next adjacent edge to the edge given.
```js ```js
getNextAdjacentEdge(tag: TagIdentifier) -> Uuid getNextAdjacentEdge(tag: TagIdentifier): Uuid
``` ```
@ -17,7 +17,7 @@ getNextAdjacentEdge(tag: TagIdentifier) -> Uuid
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes | | [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
### Returns ### Returns

View File

@ -9,7 +9,7 @@ Get the opposite edge to the edge given.
```js ```js
getOppositeEdge(tag: TagIdentifier) -> Uuid getOppositeEdge(tag: TagIdentifier): Uuid
``` ```
@ -17,7 +17,7 @@ getOppositeEdge(tag: TagIdentifier) -> Uuid
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes | | [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
### Returns ### Returns

View File

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

View File

@ -16,7 +16,7 @@ helix(
radius: number, radius: number,
axis: Axis3dOrEdgeReference, axis: Axis3dOrEdgeReference,
length?: number, length?: number,
) -> HelixValue ): HelixValue
``` ```
@ -24,12 +24,12 @@ helix(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `revolutions` | `number` | Number of revolutions. | Yes | | `revolutions` | [`number`](/docs/kcl/types/number) | Number of revolutions. | Yes |
| `angleStart` | `number` | Start angle (in degrees). | Yes | | `angleStart` | [`number`](/docs/kcl/types/number) | Start angle (in degrees). | Yes |
| `ccw` | `bool` | Is the helix rotation counter clockwise? The default is `false`. | No | | `ccw` | [`bool`](/docs/kcl/types/bool) | Is the helix rotation counter clockwise? The default is `false`. | No |
| `radius` | `number` | Radius of the helix. | Yes | | `radius` | [`number`](/docs/kcl/types/number) | Radius of the helix. | Yes |
| `axis` | [`Axis3dOrEdgeReference`](/docs/kcl/types/Axis3dOrEdgeReference) | Axis to use for the helix. | Yes | | `axis` | [`Axis3dOrEdgeReference`](/docs/kcl/types/Axis3dOrEdgeReference) | Axis to use for the helix. | Yes |
| `length` | `number` | Length of the helix. This is not necessary if the helix is created around an edge. If not given the length of the edge is used. | No | | `length` | [`number`](/docs/kcl/types/number) | Length of the helix. This is not necessary if the helix is created around an edge. If not given the length of the edge is used. | No |
### Returns ### Returns
@ -51,7 +51,7 @@ helixPath = helix(
// Create a spring by sweeping around the helix path. // Create a spring by sweeping around the helix path.
springSketch = startSketchOn('YZ') springSketch = startSketchOn('YZ')
|> circle({ center = [0, 0], radius = 0.5 }, %) |> circle(center = [0, 0], radius = 0.5)
|> sweep(path = helixPath) |> sweep(path = helixPath)
``` ```
@ -74,7 +74,7 @@ helixPath = helix(
// Create a spring by sweeping around the helix path. // Create a spring by sweeping around the helix path.
springSketch = startSketchOn('XY') springSketch = startSketchOn('XY')
|> circle({ center = [0, 0], radius = 0.5 }, %) |> circle(center = [0, 0], radius = 0.5)
|> sweep(path = helixPath) |> sweep(path = helixPath)
``` ```
@ -98,7 +98,7 @@ helixPath = helix(
// Create a spring by sweeping around the helix path. // Create a spring by sweeping around the helix path.
springSketch = startSketchOn('XY') springSketch = startSketchOn('XY')
|> circle({ center = [0, 0], radius = 1 }, %) |> circle(center = [0, 0], radius = 1)
|> sweep(path = helixPath) |> sweep(path = helixPath)
``` ```

View File

@ -12,7 +12,7 @@ Create a helix on a cylinder.
helixRevolutions( helixRevolutions(
data: HelixRevolutionsData, data: HelixRevolutionsData,
solid: Solid, solid: Solid,
) -> Solid ): Solid
``` ```
@ -21,18 +21,18 @@ helixRevolutions(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`HelixRevolutionsData`](/docs/kcl/types/HelixRevolutionsData) | Data for helix revolutions. | Yes | | `data` | [`HelixRevolutionsData`](/docs/kcl/types/HelixRevolutionsData) | Data for helix revolutions. | Yes |
| `solid` | [`Solid`](/docs/kcl/types/Solid) | A solid is a collection of extrude surfaces. | Yes | | `solid` | [`Solid`](/docs/kcl/types/Solid) | | Yes |
### Returns ### Returns
[`Solid`](/docs/kcl/types/Solid) - A solid is a collection of extrude surfaces. [`Solid`](/docs/kcl/types/Solid)
### Examples ### Examples
```js ```js
part001 = startSketchOn('XY') part001 = startSketchOn('XY')
|> circle({ center = [5, 5], radius = 10 }, %) |> circle(center = [5, 5], radius = 10)
|> extrude(length = 10) |> extrude(length = 10)
|> helixRevolutions({ |> helixRevolutions({
angleStart = 0, angleStart = 0,

View File

@ -12,7 +12,7 @@ Use a 2-dimensional sketch to cut a hole in another 2-dimensional sketch.
hole( hole(
holeSketch: SketchSet, holeSketch: SketchSet,
sketch: Sketch, sketch: Sketch,
) -> Sketch ): Sketch
``` ```
@ -21,11 +21,11 @@ hole(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `holeSketch` | [`SketchSet`](/docs/kcl/types/SketchSet) | A sketch or a group of sketches. | Yes | | `holeSketch` | [`SketchSet`](/docs/kcl/types/SketchSet) | A sketch or a group of sketches. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples
@ -37,8 +37,8 @@ exampleSketch = startSketchOn(XY)
|> line(end = [5, 0]) |> line(end = [5, 0])
|> line(end = [0, -5]) |> line(end = [0, -5])
|> close() |> close()
|> hole(circle({ center = [1, 1], radius = .25 }, %), %) |> hole(circle(center = [1, 1], radius = .25), %)
|> hole(circle({ center = [1, 4], radius = .25 }, %), %) |> hole(circle(center = [1, 4], radius = .25), %)
example = extrude(exampleSketch, length = 1) example = extrude(exampleSketch, length = 1)
``` ```
@ -57,7 +57,7 @@ fn squareHoleSketch() {
} }
exampleSketch = startSketchOn(-XZ) exampleSketch = startSketchOn(-XZ)
|> circle({ center = [0, 0], radius = 3 }, %) |> circle(center = [0, 0], radius = 3)
|> hole(squareHoleSketch(), %) |> hole(squareHoleSketch(), %)
example = extrude(exampleSketch, length = 1) example = extrude(exampleSketch, length = 1)
``` ```

View File

@ -12,7 +12,7 @@ Remove volume from a 3-dimensional shape such that a wall of the provided thickn
hollow( hollow(
thickness: number, thickness: number,
solid: Solid, solid: Solid,
) -> Solid ): Solid
``` ```
@ -20,12 +20,12 @@ hollow(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `thickness` | `number` | | Yes | | `thickness` | [`number`](/docs/kcl/types/number) | | Yes |
| `solid` | [`Solid`](/docs/kcl/types/Solid) | A solid is a collection of extrude surfaces. | Yes | | `solid` | [`Solid`](/docs/kcl/types/Solid) | | Yes |
### Returns ### Returns
[`Solid`](/docs/kcl/types/Solid) - A solid is a collection of extrude surfaces. [`Solid`](/docs/kcl/types/Solid)
### Examples ### Examples
@ -70,17 +70,11 @@ case = startSketchOn('-XZ')
|> extrude(length = 65) |> extrude(length = 65)
thing1 = startSketchOn(case, 'end') thing1 = startSketchOn(case, 'end')
|> circle({ |> circle(center = [-size / 2, -size / 2], radius = 25)
center = [-size / 2, -size / 2],
radius = 25
}, %)
|> extrude(length = 50) |> extrude(length = 50)
thing2 = startSketchOn(case, 'end') thing2 = startSketchOn(case, 'end')
|> circle({ |> circle(center = [size / 2, -size / 2], radius = 25)
center = [size / 2, -size / 2],
radius = 25
}, %)
|> extrude(length = 50) |> extrude(length = 50)
hollow(0.5, case) hollow(0.5, case)

View File

@ -18,7 +18,7 @@ Note: The import command currently only works when using the native Modeling App
import( import(
filePath: String, filePath: String,
options?: ImportFormat, options?: ImportFormat,
) -> ImportedGeometry ): ImportedGeometry
``` ```

View File

@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `1`.
We merely provide these functions for convenience and readability, as `10 * inch()` is more readable that your intent is "I want 10 inches" than `10 * 25.4`, if the project settings are in millimeters. We merely provide these functions for convenience and readability, as `10 * inch()` is more readable that your intent is "I want 10 inches" than `10 * 25.4`, if the project settings are in millimeters.
```js ```js
inch() -> number inch(): number
``` ```
### Tags ### Tags
@ -26,7 +26,7 @@ inch() -> number
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -15,9 +15,17 @@ layout: manual
### Standard library ### Standard library
* **`std`** * **Primitive types**
* [`bool`](kcl/bool)
* [`number`](kcl/number)
* [`string`](kcl/string)
* [`tag`](kcl/tag)
* **std**
* [`HALF_TURN`](kcl/const_std-HALF_TURN) * [`HALF_TURN`](kcl/const_std-HALF_TURN)
* [`Plane`](kcl/Plane)
* [`QUARTER_TURN`](kcl/const_std-QUARTER_TURN) * [`QUARTER_TURN`](kcl/const_std-QUARTER_TURN)
* [`Sketch`](kcl/Sketch)
* [`Solid`](kcl/Solid)
* [`THREE_QUARTER_TURN`](kcl/const_std-THREE_QUARTER_TURN) * [`THREE_QUARTER_TURN`](kcl/const_std-THREE_QUARTER_TURN)
* [`XY`](kcl/const_std-XY) * [`XY`](kcl/const_std-XY)
* [`XZ`](kcl/const_std-XZ) * [`XZ`](kcl/const_std-XZ)
@ -127,7 +135,7 @@ layout: manual
* [`yLine`](kcl/yLine) * [`yLine`](kcl/yLine)
* [`yLineTo`](kcl/yLineTo) * [`yLineTo`](kcl/yLineTo)
* [`yd`](kcl/yd) * [`yd`](kcl/yd)
* **`std::math`** * **std::math**
* [`E`](kcl/const_std-math-E) * [`E`](kcl/const_std-math-E)
* [`PI`](kcl/const_std-math-PI) * [`PI`](kcl/const_std-math-PI)
* [`TAU`](kcl/const_std-math-TAU) * [`TAU`](kcl/const_std-math-TAU)

View File

@ -11,7 +11,7 @@ Convert a number to an integer.
DEPRECATED use floor(), ceil(), or round(). DEPRECATED use floor(), ceil(), or round().
```js ```js
int(num: number) -> number int(num: number): number
``` ```
### Tags ### Tags
@ -23,11 +23,11 @@ int(num: number) -> number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | `number` | | Yes | | `num` | [`number`](/docs/kcl/types/number) | | Yes |
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples
@ -37,7 +37,7 @@ n = int(ceil(5 / 2))
assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3") assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
// Draw n cylinders. // Draw n cylinders.
startSketchOn('XZ') startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 2 }, %) |> circle(center = [0, 0], radius = 2)
|> extrude(length = 5) |> extrude(length = 5)
|> patternTransform( |> patternTransform(
instances = n, instances = n,

View File

@ -1,15 +1,15 @@
--- ---
title: "lastSegX" title: "lastSegX"
excerpt: "Extract the 'x' axis value of the last line segment in the provided 2-d" excerpt: "Extract the 'x' axis value of the last line segment in the provided 2-d sketch."
layout: manual layout: manual
--- ---
Extract the 'x' axis value of the last line segment in the provided 2-d Extract the 'x' axis value of the last line segment in the provided 2-d sketch.
sketch.
```js ```js
lastSegX(sketch: Sketch) -> number lastSegX(sketch: Sketch): number
``` ```
@ -21,7 +21,7 @@ lastSegX(sketch: Sketch) -> number
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -1,15 +1,15 @@
--- ---
title: "lastSegY" title: "lastSegY"
excerpt: "Extract the 'y' axis value of the last line segment in the provided 2-d" excerpt: "Extract the 'y' axis value of the last line segment in the provided 2-d sketch."
layout: manual layout: manual
--- ---
Extract the 'y' axis value of the last line segment in the provided 2-d Extract the 'y' axis value of the last line segment in the provided 2-d sketch.
sketch.
```js ```js
lastSegY(sketch: Sketch) -> number lastSegY(sketch: Sketch): number
``` ```
@ -21,7 +21,7 @@ lastSegY(sketch: Sketch) -> number
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -12,7 +12,7 @@ Compute the angle of the given leg for x.
legAngX( legAngX(
hypotenuse: number, hypotenuse: number,
leg: number, leg: number,
) -> number ): number
``` ```
### Tags ### Tags
@ -24,12 +24,12 @@ legAngX(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `hypotenuse` | `number` | | Yes | | `hypotenuse` | [`number`](/docs/kcl/types/number) | | Yes |
| `leg` | `number` | | Yes | | `leg` | [`number`](/docs/kcl/types/number) | | Yes |
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -12,7 +12,7 @@ Compute the angle of the given leg for y.
legAngY( legAngY(
hypotenuse: number, hypotenuse: number,
leg: number, leg: number,
) -> number ): number
``` ```
### Tags ### Tags
@ -24,12 +24,12 @@ legAngY(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `hypotenuse` | `number` | | Yes | | `hypotenuse` | [`number`](/docs/kcl/types/number) | | Yes |
| `leg` | `number` | | Yes | | `leg` | [`number`](/docs/kcl/types/number) | | Yes |
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -12,7 +12,7 @@ Compute the length of the given leg.
legLen( legLen(
hypotenuse: number, hypotenuse: number,
leg: number, leg: number,
) -> number ): number
``` ```
### Tags ### Tags
@ -24,12 +24,12 @@ legLen(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `hypotenuse` | `number` | | Yes | | `hypotenuse` | [`number`](/docs/kcl/types/number) | | Yes |
| `leg` | `number` | | Yes | | `leg` | [`number`](/docs/kcl/types/number) | | Yes |
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -14,7 +14,7 @@ line(
endAbsolute?: [number], endAbsolute?: [number],
end?: [number], end?: [number],
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Sketch ): Sketch
``` ```
@ -23,13 +23,13 @@ line(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `endAbsolute` | `[number]` | Which absolute point should this line go to? Incompatible with `end`. | No | | `endAbsolute` | [`[number]`](/docs/kcl/types/number) | Which absolute point should this line go to? Incompatible with `end`. | No |
| `end` | `[number]` | How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`. | No | | `end` | [`[number]`](/docs/kcl/types/number) | How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`. | No |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples

View File

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

View File

@ -15,7 +15,7 @@ loft(
bezApproximateRational: bool, bezApproximateRational: bool,
baseCurveIndex?: integer, baseCurveIndex?: integer,
tolerance?: number, tolerance?: number,
) -> Solid ): Solid
``` ```
@ -25,13 +25,13 @@ loft(
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | Which sketches to loft. Must include at least 2 sketches. | Yes | | `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | Which sketches to loft. Must include at least 2 sketches. | Yes |
| `vDegree` | `NonZeroU32` | Degree of the interpolation. Must be greater than zero. For example, use 2 for quadratic, or 3 for cubic interpolation in the V direction. This defaults to 2, if not specified. | Yes | | `vDegree` | `NonZeroU32` | Degree of the interpolation. Must be greater than zero. For example, use 2 for quadratic, or 3 for cubic interpolation in the V direction. This defaults to 2, if not specified. | Yes |
| `bezApproximateRational` | `bool` | Attempt to approximate rational curves (such as arcs) using a bezier. This will remove banding around interpolations between arcs and non-arcs. It may produce errors in other scenarios Over time, this field won't be necessary. | Yes | | `bezApproximateRational` | [`bool`](/docs/kcl/types/bool) | Attempt to approximate rational curves (such as arcs) using a bezier. This will remove banding around interpolations between arcs and non-arcs. It may produce errors in other scenarios Over time, this field won't be necessary. | Yes |
| `baseCurveIndex` | `integer` | This can be set to override the automatically determined topological base curve, which is usually the first section encountered. | No | | `baseCurveIndex` | `integer` | This can be set to override the automatically determined topological base curve, which is usually the first section encountered. | No |
| `tolerance` | `number` | Tolerance for the loft operation. | No | | `tolerance` | [`number`](/docs/kcl/types/number) | Tolerance for the loft operation. | No |
### Returns ### Returns
[`Solid`](/docs/kcl/types/Solid) - A solid is a collection of extrude surfaces. [`Solid`](/docs/kcl/types/Solid)
### Examples ### Examples
@ -69,10 +69,10 @@ squareSketch = startSketchOn('XY')
|> close() |> close()
circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75)) circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
|> circle({ center = [0, 100], radius = 50 }, %) |> circle(center = [0, 100], radius = 50)
circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150)) circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
|> circle({ center = [0, 100], radius = 20 }, %) |> circle(center = [0, 100], radius = 20)
loft([ loft([
squareSketch, squareSketch,
@ -94,10 +94,10 @@ squareSketch = startSketchOn('XY')
|> close() |> close()
circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75)) circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
|> circle({ center = [0, 100], radius = 50 }, %) |> circle(center = [0, 100], radius = 50)
circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150)) circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
|> circle({ center = [0, 100], radius = 20 }, %) |> circle(center = [0, 100], radius = 20)
loft( loft(
[ [

View File

@ -12,7 +12,7 @@ The result might not be correctly rounded owing to implementation details; `log2
log( log(
num: number, num: number,
base: number, base: number,
) -> number ): number
``` ```
### Tags ### Tags
@ -24,12 +24,12 @@ log(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | `number` | | Yes | | `num` | [`number`](/docs/kcl/types/number) | | Yes |
| `base` | `number` | | Yes | | `base` | [`number`](/docs/kcl/types/number) | | Yes |
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

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

View File

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

View File

@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `39.3
We merely provide these functions for convenience and readability, as `10 * m()` is more readable that your intent is "I want 10 meters" than `10 * 1000`, if the project settings are in millimeters. We merely provide these functions for convenience and readability, as `10 * m()` is more readable that your intent is "I want 10 meters" than `10 * 1000`, if the project settings are in millimeters.
```js ```js
m() -> number m(): number
``` ```
### Tags ### Tags
@ -26,7 +26,7 @@ m() -> number
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -12,7 +12,7 @@ Given a list like `[a, b, c]`, and a function like `f`, returns `[f(a), f(b), f(
map( map(
array: [KclValue], array: [KclValue],
mapFn: FunctionSource, mapFn: FunctionSource,
) -> [KclValue] ): [KclValue]
``` ```
@ -34,7 +34,7 @@ map(
r = 10 // radius r = 10 // radius
fn drawCircle(id) { fn drawCircle(id) {
return startSketchOn("XY") return startSketchOn("XY")
|> circle({ center = [id * 2 * r, 0], radius = r }, %) |> circle(center = [id * 2 * r, 0], radius = r)
} }
// Call `drawCircle`, passing in each element of the array. // Call `drawCircle`, passing in each element of the array.
@ -50,7 +50,7 @@ r = 10 // radius
// Call `map`, using an anonymous function instead of a named one. // Call `map`, using an anonymous function instead of a named one.
circles = map([1..3], fn(id) { circles = map([1..3], fn(id) {
return startSketchOn("XY") return startSketchOn("XY")
|> circle({ center = [id * 2 * r, 0], radius = r }, %) |> circle(center = [id * 2 * r, 0], radius = r)
}) })
``` ```

View File

@ -9,7 +9,7 @@ Compute the maximum of the given arguments.
```js ```js
max(args: [number]) -> number max(args: [number]): number
``` ```
### Tags ### Tags
@ -21,11 +21,11 @@ max(args: [number]) -> number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `args` | `[number]` | | Yes | | `args` | [`[number]`](/docs/kcl/types/number) | | Yes |
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -9,7 +9,7 @@ Compute the minimum of the given arguments.
```js ```js
min(args: [number]) -> number min(args: [number]): number
``` ```
### Tags ### Tags
@ -21,11 +21,11 @@ min(args: [number]) -> number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `args` | `[number]` | | Yes | | `args` | [`[number]`](/docs/kcl/types/number) | | Yes |
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -14,7 +14,7 @@ Mirror occurs around a local sketch axis rather than a global axis.
mirror2d( mirror2d(
data: Mirror2dData, data: Mirror2dData,
sketchSet: SketchSet, sketchSet: SketchSet,
) -> [Sketch] ): [Sketch]
``` ```

View File

@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `(1/2
We merely provide these functions for convenience and readability, as `10 * mm()` is more readable that your intent is "I want 10 millimeters" than `10 * (1/25.4)`, if the project settings are in inches. We merely provide these functions for convenience and readability, as `10 * mm()` is more readable that your intent is "I want 10 millimeters" than `10 * (1/25.4)`, if the project settings are in inches.
```js ```js
mm() -> number mm(): number
``` ```
### Tags ### Tags
@ -26,7 +26,7 @@ mm() -> number
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -12,7 +12,7 @@ For example, if you offset the 'XZ' plane by 10, the new plane will be parallel
offsetPlane( offsetPlane(
plane: PlaneData, plane: PlaneData,
offset: number, offset: number,
) -> Plane ): Plane
``` ```
@ -21,11 +21,11 @@ offsetPlane(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `plane` | [`PlaneData`](/docs/kcl/types/PlaneData) | The plane (e.g. 'XY') which this new plane is created from. | Yes | | `plane` | [`PlaneData`](/docs/kcl/types/PlaneData) | The plane (e.g. 'XY') which this new plane is created from. | Yes |
| `offset` | `number` | Distance from the standard plane this new plane will be created at. | Yes | | `offset` | [`number`](/docs/kcl/types/number) | Distance from the standard plane this new plane will be created at. | Yes |
### Returns ### Returns
[`Plane`](/docs/kcl/types/Plane) - A plane. [`Plane`](/docs/kcl/types/Plane)
### Examples ### Examples
@ -41,7 +41,7 @@ squareSketch = startSketchOn('XY')
|> close() |> close()
circleSketch = startSketchOn(offsetPlane('XY', offset = 150)) circleSketch = startSketchOn(offsetPlane('XY', offset = 150))
|> circle({ center = [0, 100], radius = 50 }, %) |> circle(center = [0, 100], radius = 50)
loft([squareSketch, circleSketch]) loft([squareSketch, circleSketch])
``` ```
@ -59,7 +59,7 @@ squareSketch = startSketchOn('XZ')
|> close() |> close()
circleSketch = startSketchOn(offsetPlane('XZ', offset = 150)) circleSketch = startSketchOn(offsetPlane('XZ', offset = 150))
|> circle({ center = [0, 100], radius = 50 }, %) |> circle(center = [0, 100], radius = 50)
loft([squareSketch, circleSketch]) loft([squareSketch, circleSketch])
``` ```
@ -77,7 +77,7 @@ squareSketch = startSketchOn('YZ')
|> close() |> close()
circleSketch = startSketchOn(offsetPlane('YZ', offset = 150)) circleSketch = startSketchOn(offsetPlane('YZ', offset = 150))
|> circle({ center = [0, 100], radius = 50 }, %) |> circle(center = [0, 100], radius = 50)
loft([squareSketch, circleSketch]) loft([squareSketch, circleSketch])
``` ```
@ -95,7 +95,7 @@ squareSketch = startSketchOn('-XZ')
|> close() |> close()
circleSketch = startSketchOn(offsetPlane('-XZ', offset = -150)) circleSketch = startSketchOn(offsetPlane('-XZ', offset = -150))
|> circle({ center = [0, 100], radius = 50 }, %) |> circle(center = [0, 100], radius = 50)
loft([squareSketch, circleSketch]) loft([squareSketch, circleSketch])
``` ```
@ -106,7 +106,7 @@ loft([squareSketch, circleSketch])
// A circle on the XY plane // A circle on the XY plane
startSketchOn("XY") startSketchOn("XY")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> circle({ radius = 10, center = [0, 0] }, %) |> circle(radius = 10, center = [0, 0])
// Triangle on the plane 4 units above // Triangle on the plane 4 units above
startSketchOn(offsetPlane("XY", offset = 4)) startSketchOn(offsetPlane("XY", offset = 4))

View File

@ -1,12 +1,12 @@
--- ---
title: "patternCircular2d" title: "patternCircular2d"
excerpt: "Repeat a 2-dimensional sketch some number of times along a partial or" excerpt: "Repeat a 2-dimensional sketch some number of times along a partial or complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orentation of the solid with respect to the center of the circle is maintained."
layout: manual layout: manual
--- ---
Repeat a 2-dimensional sketch some number of times along a partial or Repeat a 2-dimensional sketch some number of times along a partial or complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orentation of the solid with respect to the center of the circle is maintained.
complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orentation of the solid with respect to the center of the circle is maintained.
```js ```js
patternCircular2d( patternCircular2d(
@ -16,7 +16,7 @@ patternCircular2d(
arcDegrees: number, arcDegrees: number,
rotateDuplicates: bool, rotateDuplicates: bool,
useOriginal?: bool, useOriginal?: bool,
) -> [Sketch] ): [Sketch]
``` ```
@ -26,10 +26,10 @@ patternCircular2d(
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketch(es) to pattern | Yes | | `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | 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 | | `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]` | The center about which to make the pattern. This is a 2D vector. | Yes | | `center` | [`[number]`](/docs/kcl/types/number) | The center about which to make the pattern. This is a 2D vector. | Yes |
| `arcDegrees` | `number` | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes | | `arcDegrees` | [`number`](/docs/kcl/types/number) | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
| `rotateDuplicates` | `bool` | Whether or not to rotate the duplicates as they are copied. | Yes | | `rotateDuplicates` | [`bool`](/docs/kcl/types/bool) | Whether or not to rotate the duplicates as they are copied. | Yes |
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No | | `useOriginal` | [`bool`](/docs/kcl/types/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 ### Returns

View File

@ -1,12 +1,12 @@
--- ---
title: "patternCircular3d" title: "patternCircular3d"
excerpt: "Repeat a 3-dimensional solid some number of times along a partial or" excerpt: "Repeat a 3-dimensional solid some number of times along a partial or complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orentation of the solid with respect to the center of the circle is maintained."
layout: manual layout: manual
--- ---
Repeat a 3-dimensional solid some number of times along a partial or Repeat a 3-dimensional solid some number of times along a partial or complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orentation of the solid with respect to the center of the circle is maintained.
complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orentation of the solid with respect to the center of the circle is maintained.
```js ```js
patternCircular3d( patternCircular3d(
@ -17,7 +17,7 @@ patternCircular3d(
arcDegrees: number, arcDegrees: number,
rotateDuplicates: bool, rotateDuplicates: bool,
useOriginal?: bool, useOriginal?: bool,
) -> [Solid] ): [Solid]
``` ```
@ -27,11 +27,11 @@ patternCircular3d(
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | Which solid(s) to pattern | Yes | | `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | Which solid(s) to pattern | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes | | `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `axis` | `[number]` | The axis around which to make the pattern. This is a 3D vector | Yes | | `axis` | [`[number]`](/docs/kcl/types/number) | The axis around which to make the pattern. This is a 3D vector | Yes |
| `center` | `[number]` | The center about which to make the pattern. This is a 3D vector. | Yes | | `center` | [`[number]`](/docs/kcl/types/number) | The center about which to make the pattern. This is a 3D vector. | Yes |
| `arcDegrees` | `number` | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes | | `arcDegrees` | [`number`](/docs/kcl/types/number) | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
| `rotateDuplicates` | `bool` | Whether or not to rotate the duplicates as they are copied. | Yes | | `rotateDuplicates` | [`bool`](/docs/kcl/types/bool) | Whether or not to rotate the duplicates as they are copied. | Yes |
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No | | `useOriginal` | [`bool`](/docs/kcl/types/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 ### Returns
@ -42,7 +42,7 @@ patternCircular3d(
```js ```js
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 1 }, %) |> circle(center = [0, 0], radius = 1)
example = extrude(exampleSketch, length = -5) example = extrude(exampleSketch, length = -5)
|> patternCircular3d( |> patternCircular3d(

View File

@ -1,12 +1,12 @@
--- ---
title: "patternLinear2d" title: "patternLinear2d"
excerpt: "Repeat a 2-dimensional sketch along some dimension, with a dynamic amount" excerpt: "Repeat a 2-dimensional sketch along some dimension, with a dynamic amount of distance between each repetition, some specified number of times."
layout: manual layout: manual
--- ---
Repeat a 2-dimensional sketch along some dimension, with a dynamic amount Repeat a 2-dimensional sketch along some dimension, with a dynamic amount of distance between each repetition, some specified number of times.
of distance between each repetition, some specified number of times.
```js ```js
patternLinear2d( patternLinear2d(
@ -15,7 +15,7 @@ patternLinear2d(
distance: number, distance: number,
axis: [number], axis: [number],
useOriginal?: bool, useOriginal?: bool,
) -> [Sketch] ): [Sketch]
``` ```
@ -25,9 +25,9 @@ patternLinear2d(
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | The sketch(es) to duplicate | Yes | | `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | The sketch(es) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes | | `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `distance` | `number` | Distance between each repetition. Also known as 'spacing'. | Yes | | `distance` | [`number`](/docs/kcl/types/number) | Distance between each repetition. Also known as 'spacing'. | Yes |
| `axis` | `[number]` | The axis of the pattern. A 2D vector. | Yes | | `axis` | [`[number]`](/docs/kcl/types/number) | The axis of the pattern. A 2D vector. | Yes |
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No | | `useOriginal` | [`bool`](/docs/kcl/types/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 ### Returns
@ -38,7 +38,7 @@ patternLinear2d(
```js ```js
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 1 }, %) |> circle(center = [0, 0], radius = 1)
|> patternLinear2d(axis = [1, 0], instances = 7, distance = 4) |> patternLinear2d(axis = [1, 0], instances = 7, distance = 4)
example = extrude(exampleSketch, length = 1) example = extrude(exampleSketch, length = 1)

View File

@ -1,12 +1,10 @@
--- ---
title: "patternLinear3d" title: "patternLinear3d"
excerpt: "Repeat a 3-dimensional solid along a linear path, with a dynamic amount" excerpt: "Repeat a 3-dimensional solid along a linear path, with a dynamic amount of distance between each repetition, some specified number of times."
layout: manual layout: manual
--- ---
Repeat a 3-dimensional solid along a linear path, with a dynamic amount Repeat a 3-dimensional solid along a linear path, with a dynamic amount of distance between each repetition, some specified number of times.
of distance between each repetition, some specified number of times.
/// ///
@ -17,7 +15,7 @@ patternLinear3d(
distance: number, distance: number,
axis: [number], axis: [number],
useOriginal?: bool, useOriginal?: bool,
) -> [Solid] ): [Solid]
``` ```
@ -27,9 +25,9 @@ patternLinear3d(
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes | | `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes | | `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `distance` | `number` | Distance between each repetition. Also known as 'spacing'. | Yes | | `distance` | [`number`](/docs/kcl/types/number) | Distance between each repetition. Also known as 'spacing'. | Yes |
| `axis` | `[number]` | The axis of the pattern. A 2D vector. | Yes | | `axis` | [`[number]`](/docs/kcl/types/number) | The axis of the pattern. A 2D vector. | Yes |
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No | | `useOriginal` | [`bool`](/docs/kcl/types/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 ### Returns
@ -64,17 +62,11 @@ case = startSketchOn('XY')
|> extrude(length = 65) |> extrude(length = 65)
thing1 = startSketchOn(case, 'end') thing1 = startSketchOn(case, 'end')
|> circle({ |> circle(center = [-size / 2, -size / 2], radius = 25)
center = [-size / 2, -size / 2],
radius = 25
}, %)
|> extrude(length = 50) |> extrude(length = 50)
thing2 = startSketchOn(case, 'end') thing2 = startSketchOn(case, 'end')
|> circle({ |> circle(center = [size / 2, -size / 2], radius = 25)
center = [size / 2, -size / 2],
radius = 25
}, %)
|> extrude(length = 50) |> extrude(length = 50)
// We pass in the "case" here since we want to pattern the whole sketch. // We pass in the "case" here since we want to pattern the whole sketch.
@ -101,10 +93,7 @@ case = startSketchOn('XY')
|> extrude(length = 65) |> extrude(length = 65)
thing1 = startSketchOn(case, 'end') thing1 = startSketchOn(case, 'end')
|> circle({ |> circle(center = [-size / 2, -size / 2], radius = 25)
center = [-size / 2, -size / 2],
radius = 25
}, %)
|> extrude(length = 50) |> extrude(length = 50)
// We pass in `thing1` here with `useOriginal` since we want to pattern just this object on the face. // We pass in `thing1` here with `useOriginal` since we want to pattern just this object on the face.

View File

@ -40,7 +40,7 @@ patternTransform(
instances: integer, instances: integer,
transform: FunctionSource, transform: FunctionSource,
useOriginal?: bool, useOriginal?: bool,
) -> [Solid] ): [Solid]
``` ```
@ -51,7 +51,7 @@ patternTransform(
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes | | `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes | | `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 |
| `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes | | `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No | | `useOriginal` | [`bool`](/docs/kcl/types/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 ### Returns
@ -68,7 +68,7 @@ fn transform(id) {
// Sketch 4 cylinders. // Sketch 4 cylinders.
sketch001 = startSketchOn('XZ') sketch001 = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 2 }, %) |> circle(center = [0, 0], radius = 2)
|> extrude(length = 5) |> extrude(length = 5)
|> patternTransform(instances = 4, transform = transform) |> patternTransform(instances = 4, transform = transform)
``` ```
@ -84,7 +84,7 @@ fn transform(id) {
} }
sketch001 = startSketchOn('XZ') sketch001 = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 2 }, %) |> circle(center = [0, 0], radius = 2)
|> extrude(length = 5) |> extrude(length = 5)
|> patternTransform(instances = 4, transform = transform) |> patternTransform(instances = 4, transform = transform)
``` ```
@ -184,7 +184,7 @@ fn transform(replicaId) {
fn layer() { fn layer() {
return startSketchOn("XY") return startSketchOn("XY")
// or some other plane idk // or some other plane idk
|> circle({ center = [0, 0], radius = 1 }, %, $tag1) |> circle(center = [0, 0], radius = 1, tag = $tag1)
|> extrude(length = h) |> extrude(length = h)
} }
// The vase is 100 layers tall. // The vase is 100 layers tall.

View File

@ -14,7 +14,7 @@ patternTransform2d(
instances: integer, instances: integer,
transform: FunctionSource, transform: FunctionSource,
useOriginal?: bool, useOriginal?: bool,
) -> [Sketch] ): [Sketch]
``` ```
@ -25,7 +25,7 @@ patternTransform2d(
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | The sketch(es) to duplicate | Yes | | `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | The sketch(es) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes | | `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 |
| `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes | | `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No | | `useOriginal` | [`bool`](/docs/kcl/types/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 ### Returns
@ -42,7 +42,7 @@ fn transform(id) {
// Sketch 4 circles. // Sketch 4 circles.
sketch001 = startSketchOn('XZ') sketch001 = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 2 }, %) |> circle(center = [0, 0], radius = 2)
|> patternTransform2d(instances = 4, transform = transform) |> patternTransform2d(instances = 4, transform = transform)
``` ```

View File

@ -11,7 +11,7 @@ Return the value of `pi`. Archimedes constant (π).
**DEPRECATED** use the constant PI **DEPRECATED** use the constant PI
```js ```js
pi() -> number pi(): number
``` ```
### Tags ### Tags
@ -22,7 +22,7 @@ pi() -> number
### Returns ### Returns
`number` [`number`](/docs/kcl/types/number)
### Examples ### Examples
@ -31,10 +31,7 @@ pi() -> number
circumference = 70 circumference = 70
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> circle({ |> circle(center = [0, 0], radius = circumference / (2 * pi()))
center = [0, 0],
radius = circumference / (2 * pi())
}, %)
example = extrude(exampleSketch, length = 5) example = extrude(exampleSketch, length = 5)
``` ```

View File

@ -1,15 +1,15 @@
--- ---
title: "polar" title: "polar"
excerpt: "Convert polar/sphere (azimuth, elevation, distance) coordinates to" excerpt: "Convert polar/sphere (azimuth, elevation, distance) coordinates to cartesian (x/y/z grid) coordinates."
layout: manual layout: manual
--- ---
Convert polar/sphere (azimuth, elevation, distance) coordinates to Convert polar/sphere (azimuth, elevation, distance) coordinates to cartesian (x/y/z grid) coordinates.
cartesian (x/y/z grid) coordinates.
```js ```js
polar(data: PolarCoordsData) -> [number] polar(data: PolarCoordsData): [number]
``` ```
@ -21,7 +21,7 @@ polar(data: PolarCoordsData) -> [number]
### Returns ### Returns
`[number]` [`[number]`](/docs/kcl/types/number)
### Examples ### Examples

View File

@ -13,7 +13,7 @@ polygon(
data: PolygonData, data: PolygonData,
sketchSurfaceOrGroup: SketchOrSurface, sketchSurfaceOrGroup: SketchOrSurface,
tag?: TagDeclarator, tag?: TagDeclarator,
) -> Sketch ): Sketch
``` ```
@ -23,11 +23,11 @@ polygon(
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`PolygonData`](/docs/kcl/types/PolygonData) | Data for drawing a polygon | Yes | | `data` | [`PolygonData`](/docs/kcl/types/PolygonData) | Data for drawing a polygon | Yes |
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes | | `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths. [`Sketch`](/docs/kcl/types/Sketch)
### Examples ### Examples

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