Compare commits

...

67 Commits

Author SHA1 Message Date
0bc0ed45b9 Run file tests on Windows to cover path differences 2025-05-06 21:26:42 -04:00
b0b1198d2e Reducing polling interval (#6729)
5s is way too fast, let's try 60s.
2025-05-07 01:24:12 +00:00
134ec63610 Add subtitle to docs and fix primitive type links (#6724)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-06 15:33:23 -07:00
cc904d258b Fix just command to update samples PNG files in screenshots dir (#6725)
* Fix just command to update samples PNG files in screenshots dir

* Update output
2025-05-06 22:26:44 +00:00
d187a29e55 Fix sketchOnFace point&click for booleans (#6713)
* fix bool sketchOnFace

* fix chamfer test

* add test

* Kurt composite attempt (#6722)

* composite attempt

* Add forward edge to CSG artifacts in artifact graph

* Fix comment

* Move the doc comments above the attributes

* Fix to update the correct field of Path

* Update output

---------

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

* use rust defined composite solid edges instead

* Update src/hooks/useEngineConnectionSubscriptions.ts

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

* Revert PNG screenshots

* Fix TS formatting

---------

Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-05-07 08:25:12 +10:00
996517f5c4 Multi-profile sweeps and more robust edit flows in point-and-click (#6437) 2025-05-06 17:57:27 -04:00
8fb1563f2d Billing UI (Nightly & Dev only) and Jest component unit testing (#6640)
A bajillion commits hi

* all the shit i'll git reset origin/main && git add -p . later

* fmt

* wip

* fmt

* rebase; fmt; tsc; lint;

* fmt

* Add jest tests

* fmt

* ok

* add nightly checks

* More is_nightly checks

* be happy codespell

* Make vitest ignore my shit

* nightly OR debug; try vitest fixing again

* Add this back

* fix

* Update src/components/LowerRightControls.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/LowerRightControls.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/LowerRightControls.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/BillingDialog.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update tailwind.config.js

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update tailwind.config.js

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/BillingRemaining.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/BillingRemaining.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/CustomIcon.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/CustomIcon.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/CustomIcon.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/CustomIcon.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/BillingRemaining.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/BillingRemaining.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* fixes

* tid bits

* Fix tests

* color

* Update src/components/BillingRemaining.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* fix someone else's problem

---------

Co-authored-by: Frank Noirot <frank@zoo.dev>
2025-05-06 15:07:22 -04:00
7b0ea5078c Fix tsc (#6717)
fix tsc
2025-05-06 15:06:47 -04:00
a04f7e9923 6458 Browser text-to-CAD should overwrite project and zoom to fit new model (#6626)
change 'Copy To Clipboard' -> 'Replace current file' for textToCAD in browser
2025-05-06 20:17:46 +02:00
e356cd34e3 6442 "Zoom to fit" when kcl file is shared on web (#6619)
* submit zoom_to_fit when kcl file is created on web

* add test for zoom to fit on shared model on web - only works with a hack so far

* resolve circular deps

* fix Zoom to fit to shared model on web, test still not passing without timeout

* Clean up zoom_to_fit for web sharing, stabilize test

* fmt

* small import refactor

* fmt

* Make Zoom to fit test web-only
2025-05-06 19:13:11 +02:00
941eacd559 [BUG]: split('/') caused bug on windows (#6697)
* fix: trying to figure out this pathing issue

* fix: found the bug

* fix: adding linter rule

* fix: rule for join('/') as well

* fix: removing useless string template

* fix: removing useless string template

* fix: ???? What ????

* fix: remove unused import

* fix: circular dep was added when I cleaned up the path logic, fixed the circular dep by passing args from the parent function
2025-05-06 16:48:45 +00:00
e06a09ed42 Fix "Cannot read properties of undefined (reading '0')" error (#6715)
pierremtb/adhoc/cannot-read-properties-undefined-0-on-hover
2025-05-06 12:06:10 -04:00
9fcc792b7e Update codespell ignore (#6702)
Adds these ignored dirs:

- ./test-results
- ./playwright-report
- ./kcl-book/book
2025-05-06 13:12:23 +00:00
1841e63021 Misc docs polishing (#6712)
* Fake modules for Rust std lib functions

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

* Include the missing @ in Rust std lib fns

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

* Move revolve and mirror2d to better modules

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

* Use docs from KCL mods for type summaries

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

* Use type docs to describe types from KCL std lib

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

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-06 16:09:59 +12:00
1e056cfd8a Display numeric units in the variables pane (#6683) 2025-05-06 03:40:18 +00:00
32db31e6c3 Increase cargo test retries (#6704) 2025-05-06 03:15:02 +00:00
9c246d6621 Fix units bug with involuteCircular (#6711)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-06 14:58:53 +12:00
9c52f5b19a Add tags to Rust std lib functions (#6701)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-06 14:14:11 +12:00
0464de33b1 Update the docs script (#6709)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-06 01:41:24 +00:00
1ed6bb8a7c change to no longer parallel for edges (#6705)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-05-06 01:06:20 +00:00
8f72920764 Fix app settings location not changing betwen nightly and release (#6656)
App settings location is not changing betwen nightly and release
Fixes #6655
2025-05-05 19:23:34 -04:00
574d6dae7f Add modules to docs (#6699)
* Support modules in docs

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

* shuffle around directories

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

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-06 11:02:55 +12:00
cf2e9d4b91 Add kclVersion as a field of the setting attribute (#6689)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-06 08:44:03 +12:00
7ab879a94f Show "experimental" badges around ML functionality (#6648)
* Make "experimental" a valid status for toolbar and commands

* Wire up status through createMachineCommand

* Add beaker icon

* Show UI elements if status is experimental

* Make ML operations experimental, powered by a flag

* Update command descriptions

* Add tooltip to home page Text-to-CAD button

* Splelnig erorrs

* 🧹lints

* Oopsie daisy Add KCL file isn't experimental

* Add warning message element to text area arg input

* Update message to common named constant
2025-05-05 15:36:22 +00:00
21da3c6482 allow var rename with tool equipped (#6693) 2025-05-05 08:13:13 -04:00
5f836358c0 Warn on usage of the unknown numeric suffix (#6690)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-05 13:17:55 +12:00
f407762259 Remove unused build scripts (#6673) 2025-05-03 12:07:54 -04:00
dea20861a0 Fix subtract2d icon in the Feature Tree (#6682) 2025-05-03 07:07:46 -04:00
bc818f10c3 Remove last remnants of legacy positional call (#6678)
* Remove last remnants of legacy positional call

* Update docs

* Fix segAng()

* Fix more docs

* Update docs again
2025-05-02 20:07:31 -05:00
19f5031ef7 Release KCL 66 (#6679)
Breaking changes:

 - All functions (even functions defined by users) must use keyword arguments, not positional arguments
2025-05-02 21:55:58 +00:00
b71eb4fb89 Simplify some test code (#6669) 2025-05-02 21:39:20 +00:00
c327c73087 Catch import scene selection on transforms and point to the feature tree (#6674)
* Catch import scene selection on transforms and point to the feature tree
Fixes #6667

* Add test for toast on clone, bringing back forgotten test
2025-05-02 17:25:33 -04:00
4fe8741ea7 Remove CallExpression support (#6639)
Users MUST use keyword call syntax now.

Closes https://github.com/KittyCAD/modeling-app/issues/4600
2025-05-02 16:08:12 -05:00
75916d4300 Fix resetting onboarding from settings in web after #6564 (#6675)
Fix resetting onboarding in web after #6564

Oversight on my part while refactoring the onboarding system in #6564.
The new centralized `acceptOnboarding` workflow constructs a relative
path, so we have to get out of the settings before invoking it.
2025-05-02 16:48:38 -04:00
e65a6b6a38 Remove reminder message in import (#6668)
Fixes #6666
2025-05-02 19:58:06 +00:00
86a83cadd3 Make onboarding optional, able to be ignored on desktop (take 2) (#6628)
* Remove unused `telemetryLoader`

* Remove onboarding redirect behavior

* Allow subRoute to be passed to navigateToProject

* Replace warning dialog routes with toasts

* Wire up new utilities and toasts to UI components

* Add home sidebar buttons for tutorial flow

* Rename menu item

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

* Remove onboarding avatar tests, they are becoming irrelevant

* Consolidate onboarding tests to one longer one

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

* Shorten warning toast button text

* tsc, lint, and circular deps

* Update circular dep file

* Fix mistakes made in circular update tweaking

* One more dumb created circular dep

* Update src/routes/Onboarding/utils.tsx

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

* Fix narrow screen home layout breaking

* fix: kevin, navigation routes fixed

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

* Fix e2e test state checks that are diff on Linux

* Create onboarding project entirely through systemIOMachine

* Fix Windows path construction

* Make utility to verify a string is an onboarding value

* Little biome formatting suggestion fix

* Units onboarding step was not using OnboardingButtons

* Add type checking of next and previous status, fix useNextClick

* Thanks Graphite Diamond, I should use that new util

* Remove TODO comment

* Fix botched merge because IS_PLAYWRIGHT moved or something

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Kevin Nadro <kevin@zoo.dev>
2025-05-02 15:54:49 -04:00
00553c34ab Enable Boolean op deletion from the feature tree (#6637)
* Can't Delete Union From Feature Tree
Fixes #6584. Works locally but the new tests don't appear to work yet

* Change tests to right-click > Delete
2025-05-02 15:34:21 -04:00
ace9a59a45 fix cache and imports (#6647)
* updates

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

* fix clippy

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-05-02 17:41:14 +00:00
09ebb517d9 Fix link to types.md in docs (#6653)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-02 09:06:43 -07:00
1c697d30ee Fix to not add extra spaces when formatting call (#6652) 2025-05-02 08:16:07 -05:00
c2dd4d1d2e Same hotkey for center rect and center circle (#6642)
Removed hotkey on center rectangle, seems less common than corner rectangle. Happy to be chalenged. Fixes #6634.
2025-05-02 04:59:33 -04:00
6866c9d418 Fix bad links in docs code blocks (#6649)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-02 16:00:27 +12:00
819ee23565 Fix to cache correct PathToNode in artifact graph (#6632)
* Add NodePath to artifact graph

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

* Remove dead code

* Add unit tests

* Add tests for PathToNode conversion

* Remove unused parameter

* Add missing PathToNode cases

* Fix to handle unlabeled arg

* Cherry pick unlabeled arg fix

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

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

* point python tests at dev

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

---------

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

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

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

* remove unused code

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

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

* fix: PR fixes

* fix: removing testing code

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

* fix: typo

* fix: typoos

* fix: fuking hack

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

* fix: got em

* fix: remove console log

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

* fix: location for scene empty check zzz:

* fix: removed debugging code

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

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

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

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

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

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

* add document color

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

* updates

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-05-01 02:47:36 +00:00
2d77aa0d36 Revert "Make onboarding optional, able to be ignored on desktop" (#6610)
Revert "Make onboarding optional, able to be ignored on desktop (#6564)"

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

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



cleanup

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

* Remove onboarding redirect behavior

* Allow subRoute to be passed to navigateToProject

* Replace warning dialog routes with toasts

* Wire up new utilities and toasts to UI components

* Add home sidebar buttons for tutorial flow

* Rename menu item

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

* Remove onboarding avatar tests, they are becoming irrelevant

* Consolidate onboarding tests to one longer one

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

* Shorten warning toast button text

* tsc, lint, and circular deps

* Update circular dep file

* Fix mistakes made in circular update tweaking

* One more dumb created circular dep

* Update src/routes/Onboarding/utils.tsx

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

* Fix narrow screen home layout breaking

* fix: kevin, navigation routes fixed

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

* Fix e2e test state checks that are diff on Linux

* Create onboarding project entirely through systemIOMachine

* Fix Windows path construction

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Kevin Nadro <kevin@zoo.dev>
2025-04-30 14:43:51 -04:00
525f213f1d Assemblies: Make Clone available in releases (#6538)
* Assemblies: Make Clone available in releases
Fixes #6537

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

* Add new generated output

* Fix root module import tracking

* Rename test so that it's easier to filter

* Update output ops

* Fix clippy

* Update output after rebase

* Update multi-axis-robot flowchart output

* Disable e2e tests until future PR

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

* Fix operations to reflect concurrent module import behavior

* Add new generated output

* Fix root module import tracking

* Rename test so that it's easier to filter

* Update output ops

* Fix clippy

* Update output after rebase

* Disable e2e tests until future PR

* Update one of the tests

* Somewhat working very ugly translate

* Working translate and rotate

* Fix deletion

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

* Fix Clone

* Clean up ahead of review

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

* Fix generated output; probably from recent merge

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

* More fixups

* Delete unused snap file

* Update src/lang/queryAst.ts

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

* Change lint ignore to be more specific

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

* Clean up

---------

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

* Add new generated output

* Fix root module import tracking

* Rename test so that it's easier to filter

* Update output ops

* Fix clippy

* Update output after rebase

* Disable e2e tests until future PR

* Fix generated output; probably from recent merge

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

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

* Fix buggy docs for union types

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

* Make types in the docs signatures into links

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

---------

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

* Update output

* Update docs
2025-04-30 11:07:05 -04:00
1235 changed files with 121631 additions and 107232 deletions

View File

@ -1,3 +1,4 @@
[codespell] [codespell]
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,atleast,ue,afterall,ser,fromM,FromM ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,atleast,ue,afterall,ser,fromM,FromM
skip: **/target,node_modules,build,dist,./out,**/Cargo.lock,./docs/kcl/*.md,./e2e/playwright/lib/console-error-whitelist.ts,.package-lock.json,**/package-lock.json,./openapi/*.json,./packages/codemirror-lang-kcl/test/all.test.ts,./public/kcl-samples,./rust/kcl-lib/tests/kcl_samples,tsconfig.tsbuildinfo,./src/lib/machine-api.d.ts skip: **/target,node_modules,build,dist,./out,**/Cargo.lock,./docs/**/*.md,./e2e/playwright/lib/console-error-whitelist.ts,.package-lock.json,**/package-lock.json,./openapi/*.json,./packages/codemirror-lang-kcl/test/all.test.ts,./public/kcl-samples,./rust/kcl-lib/tests/kcl_samples,tsconfig.tsbuildinfo,./src/lib/machine-api.d.ts,./test-results,./playwright-report,./kcl-book/book

View File

@ -87,6 +87,14 @@
{ {
"selector": "CallExpression[callee.object.name='TOML'][callee.property.name='parse']", "selector": "CallExpression[callee.object.name='TOML'][callee.property.name='parse']",
"message": "Do not use TOML.parse directly. Use the wrappers in test-utils instead like tomlToSettings." "message": "Do not use TOML.parse directly. Use the wrappers in test-utils instead like tomlToSettings."
},
{
"selector": "CallExpression[callee.property.name='split'] > Literal[value='/']",
"message": "Avoid using split with '/'."
},
{
"selector": "CallExpression[callee.property.name='join'] > Literal[value='/']",
"message": "Avoid using join with '/'."
} }
], ],
"no-restricted-imports": [ "no-restricted-imports": [

View File

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

441
.github/dependabot.yml vendored
View File

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

View File

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

View File

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

View File

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

1
.gitignore vendored
View File

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

View File

@ -97,7 +97,7 @@ The following will need to be run when checking out a new commit and guarantees
```bash ```bash
npm install npm install
npm run build:wasm npm run build:wasm
npm start # or npm run build:local && npm run serve for slower but more production-like build npm start
``` ```
## Before submitting a PR ## Before submitting a PR

View File

@ -49,14 +49,9 @@ REACT_SOURCES := $(wildcard src/*.tsx) $(wildcard src/**/*.tsx)
TYPESCRIPT_SOURCES := tsconfig.* $(wildcard src/*.ts) $(wildcard src/**/*.ts) TYPESCRIPT_SOURCES := tsconfig.* $(wildcard src/*.ts) $(wildcard src/**/*.ts)
VITE_SOURCES := $(wildcard vite.*) $(wildcard vite/**/*.tsx) VITE_SOURCES := $(wildcard vite.*) $(wildcard vite/**/*.tsx)
.PHONY: build .PHONY: build
build: build-web build-desktop build: install public/kcl_wasm_lib_bg.wasm .vite/build/main.js
.PHONY: build-web
build-web: install public/kcl_wasm_lib_bg.wasm build/index.html
.PHONY: build-desktop
build-desktop: install public/kcl_wasm_lib_bg.wasm .vite/build/main.js
public/kcl_wasm_lib_bg.wasm: $(CARGO_SOURCES) $(RUST_SOURCES) public/kcl_wasm_lib_bg.wasm: $(CARGO_SOURCES) $(RUST_SOURCES)
ifdef WINDOWS ifdef WINDOWS
@ -65,9 +60,6 @@ else
npm run build:wasm:dev npm run build:wasm:dev
endif endif
build/index.html: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES)
npm run build:local
.vite/build/main.js: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES) .vite/build/main.js: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES)
npm run tronb:vite:dev npm run tronb:vite:dev
@ -95,11 +87,11 @@ TARGET ?= desktop
run: run-$(TARGET) run: run-$(TARGET)
.PHONY: run-web .PHONY: run-web
run-web: install build-web ## Start the web app run-web: install build ## Start the web app
npm run start npm run start
.PHONY: run-desktop .PHONY: run-desktop
run-desktop: install build-desktop ## Start the desktop app run-desktop: install build ## Start the desktop app
npm run tron:start npm run tron:start
############################################################################### ###############################################################################
@ -121,7 +113,7 @@ test-unit: install ## Run the unit tests
test-e2e: test-e2e-$(TARGET) test-e2e: test-e2e-$(TARGET)
.PHONY: test-e2e-web .PHONY: test-e2e-web
test-e2e-web: install build-web ## Run the web e2e tests test-e2e-web: install build ## Run the web e2e tests
@ curl -fs localhost:3000 >/dev/null || ( echo "Error: localhost:3000 not available, 'make run-web' first" && exit 1 ) @ curl -fs localhost:3000 >/dev/null || ( echo "Error: localhost:3000 not available, 'make run-web' first" && exit 1 )
ifdef E2E_GREP ifdef E2E_GREP
npm run chrome:test -- --headed --grep="$(E2E_GREP)" --max-failures=$(E2E_FAILURES) npm run chrome:test -- --headed --grep="$(E2E_GREP)" --max-failures=$(E2E_FAILURES)
@ -130,7 +122,7 @@ else
endif endif
.PHONY: test-e2e-desktop .PHONY: test-e2e-desktop
test-e2e-desktop: install build-desktop ## Run the desktop e2e tests test-e2e-desktop: install build ## Run the desktop e2e tests
ifdef E2E_GREP ifdef E2E_GREP
npm run test:playwright:electron -- --grep="$(E2E_GREP)" --max-failures=$(E2E_FAILURES) npm run test:playwright:electron -- --grep="$(E2E_GREP)" --max-failures=$(E2E_FAILURES)
else else

12
docs/kcl-lang/index.md Normal file
View File

@ -0,0 +1,12 @@
---
title: "KCL Language Guide"
excerpt: "Documentation of the KCL language for the Zoo Design Studio."
layout: manual
---
## Topics
* [`Types`](/docs/kcl-lang/types)
* [`Modules`](/docs/kcl-lang/modules)
* [`Settings`](/docs/kcl-lang/settings)
* [`Known Issues`](/docs/kcl-lang/known-issues)

View File

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

View File

@ -55,20 +55,6 @@ This setting has further nested options. See the schema for full details.
The onboarding status of the app. The onboarding status of the app.
**Default:** None
##### theme_color
The hue of the primary theme color for the app.
**Default:** None
##### enable_ssao
Whether or not Screen Space Ambient Occlusion (SSAO) is enabled.
**Default:** None **Default:** None
##### dismiss_web_banner ##### dismiss_web_banner
@ -128,13 +114,6 @@ The default unit to use in modeling dimensions.
Highlight edges of 3D objects? Highlight edges of 3D objects?
**Default:** None
##### show_debug_panel
Whether to show the debug panel, which lets you see various states of the app to aid in development. Remove this when we remove backwards compatibility with the old settings file.
**Default:** None **Default:** None
##### enable_ssao ##### enable_ssao

View File

@ -57,34 +57,6 @@ This setting has further nested options. See the schema for full details.
The onboarding status of the app. The onboarding status of the app.
**Default:** None
##### project_directory
Backwards compatible project directory setting.
**Default:** None
##### theme
Backwards compatible theme setting.
**Default:** None
##### theme_color
The hue of the primary theme color for the app.
**Default:** None
##### enable_ssao
Whether or not Screen Space Ambient Occlusion (SSAO) is enabled.
**Default:** None **Default:** None
##### dismiss_web_banner ##### dismiss_web_banner
@ -103,7 +75,7 @@ When the user is idle, teardown the stream after some time.
##### allow_orbit_in_sketch_mode ##### allow_orbit_in_sketch_mode
When the user is idle, and this is true, the stream will be torn down. Allow orbiting in sketch mode.
**Default:** None **Default:** None
@ -159,13 +131,6 @@ The controls for how to navigate the 3D view.
Highlight edges of 3D objects? Highlight edges of 3D objects?
**Default:** None
##### show_debug_panel
Whether to show the debug panel, which lets you see various states of the app to aid in development. Remove this when we remove backwards compatibility with the old settings file.
**Default:** None **Default:** None
##### enable_ssao ##### enable_ssao

View File

@ -8,16 +8,16 @@ layout: manual
There are three levels of settings available in Zoo Design Studio: There are three levels of settings available in Zoo Design Studio:
1. [User Settings](/docs/kcl/settings/user): Global settings that apply to all projects, stored in `user.toml` 1. [User Settings](/docs/kcl/settings-user): Global settings that apply to all projects, stored in `user.toml`
2. [Project Settings](/docs/kcl/settings/project): Settings specific to a project, stored in `project.toml` 2. [Project Settings](/docs/kcl/settings-project): Settings specific to a project, stored in `project.toml`
3. Per-file Settings: Settings that apply to a single KCL file, specified using the `@settings` attribute 3. Per-file Settings: Settings that apply to a single KCL file, specified using the `@settings` attribute
## Configuration Files ## Configuration Files
Zoo Design Studio uses TOML files for configuration: Zoo Design Studio uses TOML files for configuration:
* **User Settings**: `user.toml` - See [complete documentation](/docs/kcl/settings/user) * **User Settings**: `user.toml` - See [complete documentation](/docs/kcl/settings-user)
* **Project Settings**: `project.toml` - See [complete documentation](/docs/kcl/settings/project) * **Project Settings**: `project.toml` - See [complete documentation](/docs/kcl/settings-project)
## Per-file settings ## Per-file settings
@ -25,7 +25,7 @@ Settings which affect a single file are configured using the settings attribute.
This must be at the top of the KCL file (comments before the attribute are permitted). This must be at the top of the KCL file (comments before the attribute are permitted).
For example: For example:
```js ```kcl
// The settings attribute. // The settings attribute.
@settings(defaultLengthUnit = in) @settings(defaultLengthUnit = in)

View File

@ -9,10 +9,6 @@ layout: manual
All these types can be nested in various forms where nesting applies. Like All these types can be nested in various forms where nesting applies. Like
arrays can hold objects and vice versa. arrays can hold objects and vice versa.
## Boolean
`true` or `false` work when defining values.
## Constant declaration ## Constant declaration
Constants are defined with a name and a value, like so: Constants are defined with a name and a value, like so:
@ -23,7 +19,7 @@ myBool = false
Currently you cannot redeclare a constant. Currently you cannot redeclare a constant.
## Array ## Arrays
An array is defined with `[]` braces. What is inside the brackets can An array is defined with `[]` braces. What is inside the brackets can
be of any type. For example, the following is completely valid: be of any type. For example, the following is completely valid:
@ -36,7 +32,7 @@ If you want to get a value from an array you can use the index like so:
`myArray[0]`. `myArray[0]`.
## Object ## Objects
An object is defined with `{}` braces. Here is an example object: An object is defined with `{}` braces. Here is an example object:
@ -47,6 +43,15 @@ myObj = { a = 0, b = "thing" }
We support two different ways of getting properties from objects, you can call We support two different ways of getting properties from objects, you can call
`myObj.a` or `myObj["a"]` both work. `myObj.a` or `myObj["a"]` both work.
## `ImportedGeometry`
Using `import` you can import geometry defined using other CAD software. In KCL,
these objects have type `ImportedGeometry` and can mostly be treated like any
other solid (they can be rotated, scaled, etc.), although there is no access to
their internal components. See the [modules and imports docs](modules) for more
detail on importing geometry.
## Binary expressions ## Binary expressions
You can also do math! Let's show an example below: You can also do math! Let's show an example below:
@ -176,7 +181,7 @@ Check the docs page for each function and look at its examples to see.
Tags are used to give a name (tag) to a specific path. Tags are used to give a name (tag) to a specific path.
### Tag Declaration ### `TagDeclarator`
The syntax for declaring a tag is `$myTag` you would use it in the following The syntax for declaring a tag is `$myTag` you would use it in the following
way: way:
@ -199,14 +204,24 @@ startSketchOn(XZ)
|> close() |> close()
``` ```
### Tag Identifier ### `TagIdentifier`
As per the example above you can use the tag identifier to get a reference to the As per the example above you can use the tag identifier to get a reference to the
tagged object. The syntax for this is `myTag`. tagged object. The syntax for this is `myTag`.
In the example above we use the tag identifier to get the angle of the segment In the example above we use the tag identifier to get the angle of the segment
`segAng(rectangleSegmentA001, %)`. `segAng(rectangleSegmentA001)`.
### `Start`
There is a special tag, `START` (with type `Start`, although under the cover, it's a string)
for identifying the face of a solid which was the start of an extrusion (i.e., the surface which
is extruded).
### `End`
There is a special tag, `END` (with type `End`, although under the cover, it's a string)
for identifying the face of a solid which was finishes an extrusion.
### Tag Scope ### Tag Scope
@ -234,8 +249,8 @@ fn rect(origin) {
|> close() |> close()
} }
rect([0, 0]) rect(origin = [0, 0])
rect([20, 0]) rect(origin = [20, 0])
``` ```
Those tags would only be available in the `rect` function and not globally. Those tags would only be available in the `rect` function and not globally.
@ -264,8 +279,8 @@ fn rect(origin) {
|> close() |> close()
} }
rect([0, 0]) rect(origin = [0, 0])
myRect = rect([20, 0]) myRect = rect(origin = [20, 0])
myRect myRect
|> extrude(length = 10) |> extrude(length = 10)

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

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

View File

@ -1,16 +1,15 @@
--- ---
title: "angledLine" title: "angledLine"
subtitle: "Function in std::sketch"
excerpt: "Draw a line segment relative to the current origin using the polar measure of some angle and distance." 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 measure of some angle and distance. Draw a line segment relative to the current origin using the polar measure of some angle and distance.
```kcl
```js
angledLine( angledLine(
sketch: Sketch, @sketch: Sketch,
angle: number, angle: number,
length?: number, length?: number,
lengthX?: number, lengthX?: number,
@ -22,27 +21,28 @@ angledLine(
``` ```
### Arguments ### Arguments
| 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-std/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
| `angle` | [`number`](/docs/kcl/types/number) | Which angle should the line be drawn at? | Yes | | `angle` | [`number`](/docs/kcl-std/types/std-types-number) | Which angle should the line be drawn at? | Yes |
| `length` | [`number`](/docs/kcl/types/number) | Draw the line this distance along the given angle. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No | | `length` | [`number`](/docs/kcl-std/types/std-types-number) | Draw the line this distance along the given angle. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `lengthX` | [`number`](/docs/kcl/types/number) | Draw the line this distance along the X axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No | | `lengthX` | [`number`](/docs/kcl-std/types/std-types-number) | Draw the line this distance along the X axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `lengthY` | [`number`](/docs/kcl/types/number) | Draw the line this distance along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No | | `lengthY` | [`number`](/docs/kcl-std/types/std-types-number) | Draw the line this distance along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `endAbsoluteX` | [`number`](/docs/kcl/types/number) | Draw the line along the given angle until it reaches this point along the X axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No | | `endAbsoluteX` | [`number`](/docs/kcl-std/types/std-types-number) | Draw the line along the given angle until it reaches this point along the X axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `endAbsoluteY` | [`number`](/docs/kcl/types/number) | Draw the line along the given angle until it reaches this point along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No | | `endAbsoluteY` | [`number`](/docs/kcl-std/types/std-types-number) | Draw the line along the given angle until it reaches this point along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No | | [`tag`](/docs/kcl-std/types/std-types-tag) | [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator) | Create a new tag which refers to this line | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
### Examples ### Examples
```js ```kcl
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0]) |> startProfile(at = [0, 0])
|> yLine(endAbsolute = 15) |> yLine(endAbsolute = 15)

View File

@ -1,16 +1,15 @@
--- ---
title: "angledLineThatIntersects" title: "angledLineThatIntersects"
subtitle: "Function in std::sketch"
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." 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 such that the newly created line intersects the desired target 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.
```kcl
```js
angledLineThatIntersects( angledLineThatIntersects(
sketch: Sketch, @sketch: Sketch,
angle: number, angle: number,
intersectTag: TagIdentifier, intersectTag: TagIdentifier,
offset?: number, offset?: number,
@ -19,24 +18,25 @@ angledLineThatIntersects(
``` ```
### Arguments ### Arguments
| 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-std/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
| `angle` | [`number`](/docs/kcl/types/number) | Which angle should the line be drawn at? | Yes | | `angle` | [`number`](/docs/kcl-std/types/std-types-number) | Which angle should the line be drawn at? | Yes |
| `intersectTag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The tag of the line to intersect with | Yes | | `intersectTag` | [`TagIdentifier`](/docs/kcl-lang/types#TagIdentifier) | The tag of the line to intersect with | Yes |
| `offset` | [`number`](/docs/kcl/types/number) | The offset from the intersecting line. Defaults to 0. | No | | `offset` | [`number`](/docs/kcl-std/types/std-types-number) | The offset from the intersecting line. Defaults to 0. | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No | | [`tag`](/docs/kcl-std/types/std-types-tag) | [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator) | Create a new tag which refers to this line | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
### Examples ### Examples
```js ```kcl
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0]) |> startProfile(at = [0, 0])
|> line(endAbsolute = [5, 10]) |> line(endAbsolute = [5, 10])

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,39 +1,39 @@
--- ---
title: "assert" title: "assert"
subtitle: "Function in std"
excerpt: "Check a value meets some expected conditions at runtime. Program terminates with an error if conditions aren't met. If you provide multiple conditions, they will all be checked and all must be met." excerpt: "Check a value meets some expected conditions at runtime. Program terminates with an error if conditions aren't met. If you provide multiple conditions, they will all be checked and all must be met."
layout: manual layout: manual
--- ---
Check a value meets some expected conditions at runtime. Program terminates with an error if conditions aren't met. If you provide multiple conditions, they will all be checked and all must be met. Check a value meets some expected conditions at runtime. Program terminates with an error if conditions aren't met. If you provide multiple conditions, they will all be checked and all must be met.
```kcl
```js
assert( assert(
actual: number, @actual: number,
isGreaterThan?: number, isGreaterThan?: number,
isLessThan?: number, isLessThan?: number,
isGreaterThanOrEqual?: number, isGreaterThanOrEqual?: number,
isLessThanOrEqual?: number, isLessThanOrEqual?: number,
isEqualTo?: number, isEqualTo?: number,
tolerance?: number, tolerance?: number,
error?: String, error?: string,
): () ): ()
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `actual` | [`number`](/docs/kcl/types/number) | Value to check. It will be compared with one of the comparison arguments. | Yes | | `actual` | [`number`](/docs/kcl-std/types/std-types-number) | Value to check. It will be compared with one of the comparison arguments. | Yes |
| `isGreaterThan` | [`number`](/docs/kcl/types/number) | Comparison argument. If given, checks the `actual` value is greater than this. | No | | `isGreaterThan` | [`number`](/docs/kcl-std/types/std-types-number) | Comparison argument. If given, checks the `actual` value is greater than this. | No |
| `isLessThan` | [`number`](/docs/kcl/types/number) | Comparison argument. If given, checks the `actual` value is less than this. | No | | `isLessThan` | [`number`](/docs/kcl-std/types/std-types-number) | Comparison argument. If given, checks the `actual` value is less than this. | No |
| `isGreaterThanOrEqual` | [`number`](/docs/kcl/types/number) | Comparison argument. If given, checks the `actual` value is greater than or equal to this. | No | | `isGreaterThanOrEqual` | [`number`](/docs/kcl-std/types/std-types-number) | Comparison argument. If given, checks the `actual` value is greater than or equal to this. | No |
| `isLessThanOrEqual` | [`number`](/docs/kcl/types/number) | Comparison argument. If given, checks the `actual` value is less than or equal to this. | No | | `isLessThanOrEqual` | [`number`](/docs/kcl-std/types/std-types-number) | Comparison argument. If given, checks the `actual` value is less than or equal to this. | No |
| `isEqualTo` | [`number`](/docs/kcl/types/number) | Comparison argument. If given, checks the `actual` value is less than or equal to this. | No | | `isEqualTo` | [`number`](/docs/kcl-std/types/std-types-number) | Comparison argument. If given, checks the `actual` value is less than or equal to this. | No |
| `tolerance` | [`number`](/docs/kcl/types/number) | If `isEqualTo` is used, this is the tolerance to allow for the comparison. This tolerance is used because KCL's number system has some floating-point imprecision when used with very large decimal places. | No | | `tolerance` | [`number`](/docs/kcl-std/types/std-types-number) | If `isEqualTo` is used, this is the tolerance to allow for the comparison. This tolerance is used because KCL's number system has some floating-point imprecision when used with very large decimal places. | No |
| `error` | `String` | If the value was false, the program will terminate with this error message | No | | `error` | [`string`](/docs/kcl-std/types/std-types-string) | If the value was false, the program will terminate with this error message | No |
### Returns ### Returns
@ -42,7 +42,7 @@ assert(
### Examples ### Examples
```js ```kcl
n = 10 n = 10
assert(n, isEqualTo = 10) assert(n, isEqualTo = 10)
assert( assert(

View File

@ -1,27 +1,27 @@
--- ---
title: "assertIs" title: "assertIs"
subtitle: "Function in std"
excerpt: "Asserts that a value is the boolean value true." excerpt: "Asserts that a value is the boolean value true."
layout: manual layout: manual
--- ---
Asserts that a value is the boolean value true. Asserts that a value is the boolean value true.
```kcl
```js
assertIs( assertIs(
actual: bool, @actual: bool,
error?: String, error?: string,
): () ): ()
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `actual` | [`bool`](/docs/kcl/types/bool) | Value to check. If this is the boolean value true, assert passes. Otherwise it fails. | Yes | | `actual` | [`bool`](/docs/kcl-std/types/std-types-bool) | Value to check. If this is the boolean value true, assert passes. Otherwise it fails. | Yes |
| `error` | `String` | If the value was false, the program will terminate with this error message | No | | `error` | [`string`](/docs/kcl-std/types/std-types-string) | If the value was false, the program will terminate with this error message | No |
### Returns ### Returns
@ -30,7 +30,7 @@ assertIs(
### Examples ### Examples
```js ```kcl
kclIsFun = true kclIsFun = true
assertIs(kclIsFun) assertIs(kclIsFun)
``` ```

View File

@ -1,42 +1,42 @@
--- ---
title: "bezierCurve" title: "bezierCurve"
subtitle: "Function in std::sketch"
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." 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 the desired (x, y), using a number of control points to shape the curve's shape. 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.
```kcl
```js
bezierCurve( bezierCurve(
sketch: Sketch, @sketch: Sketch,
control1: [number], control1: Point2d,
control2: [number], control2: Point2d,
end: [number], end: Point2d,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ): Sketch
``` ```
### Arguments ### Arguments
| 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-std/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
| `control1` | [`[number]`](/docs/kcl/types/number) | First control point for the cubic | Yes | | `control1` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | First control point for the cubic | Yes |
| `control2` | [`[number]`](/docs/kcl/types/number) | Second control point for the cubic | Yes | | `control2` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | Second control point for the cubic | Yes |
| `end` | [`[number]`](/docs/kcl/types/number) | How far away (along the X and Y axes) should this line go? | Yes | | `end` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | How far away (along the X and Y axes) should this line go? | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No | | [`tag`](/docs/kcl-std/types/std-types-tag) | [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator) | Create a new tag which refers to this line | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
### Examples ### Examples
```js ```kcl
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0]) |> startProfile(at = [0, 0])
|> line(end = [0, 10]) |> line(end = [0, 10])

View File

@ -1,42 +1,42 @@
--- ---
title: "circleThreePoint" title: "circleThreePoint"
subtitle: "Function in std::sketch"
excerpt: "Construct a circle derived from 3 points." excerpt: "Construct a circle derived from 3 points."
layout: manual layout: manual
--- ---
Construct a circle derived from 3 points. Construct a circle derived from 3 points.
```kcl
```js
circleThreePoint( circleThreePoint(
sketchSurfaceOrGroup: SketchOrSurface, @sketchSurfaceOrGroup: Sketch | Plane | Face,
p1: [number], p1: Point2d,
p2: [number], p2: Point2d,
p3: [number], p3: Point2d,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ): Sketch
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes | | `sketchSurfaceOrGroup` | [`Sketch`](/docs/kcl-std/types/std-types-Sketch) or [`Plane`](/docs/kcl-std/types/std-types-Plane) or [`Face`](/docs/kcl-std/types/std-types-Face) | Plane or surface to sketch on. | Yes |
| `p1` | [`[number]`](/docs/kcl/types/number) | 1st point to derive the circle. | Yes | | `p1` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | 1st point to derive the circle. | Yes |
| `p2` | [`[number]`](/docs/kcl/types/number) | 2nd point to derive the circle. | Yes | | `p2` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | 2nd point to derive the circle. | Yes |
| `p3` | [`[number]`](/docs/kcl/types/number) | 3rd point to derive the circle. | Yes | | `p3` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | 3rd point to derive the circle. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Identifier for the circle to reference elsewhere. | No | | [`tag`](/docs/kcl-std/types/std-types-tag) | [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator) | Identifier for the circle to reference elsewhere. | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
### Examples ### Examples
```js ```kcl
exampleSketch = startSketchOn(XY) exampleSketch = startSketchOn(XY)
|> circleThreePoint(p1 = [10, 10], p2 = [20, 8], p3 = [15, 5]) |> circleThreePoint(p1 = [10, 10], p2 = [20, 8], p3 = [15, 5])
|> extrude(length = 5) |> extrude(length = 5)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,15 +1,16 @@
--- ---
title: "std::END" title: "END"
subtitle: "Constant in prelude"
excerpt: "Identifies the ending face of an extrusion. I.e., the new face created by an extrusion." excerpt: "Identifies the ending face of an extrusion. I.e., the new face created by an extrusion."
layout: manual layout: manual
--- ---
Identifies the ending face of an extrusion. I.e., the new face created by an extrusion. Identifies the ending face of an extrusion. I.e., the new face created by an extrusion.
```kcl
END: string = 'end'
```js
std::END: string = 'end'
``` ```

View File

@ -1,15 +1,16 @@
--- ---
title: "std::START" title: "START"
subtitle: "Constant in prelude"
excerpt: "Identifies the starting face of an extrusion. I.e., the face which is extruded." excerpt: "Identifies the starting face of an extrusion. I.e., the face which is extruded."
layout: manual layout: manual
--- ---
Identifies the starting face of an extrusion. I.e., the face which is extruded. Identifies the starting face of an extrusion. I.e., the face which is extruded.
```kcl
START: string = 'start'
```js
std::START: string = 'start'
``` ```

View File

@ -0,0 +1,16 @@
---
title: "X"
subtitle: "Constant in prelude"
excerpt: ""
layout: manual
---
```kcl
X
```

View File

@ -0,0 +1,16 @@
---
title: "XY"
subtitle: "Constant in prelude"
excerpt: ""
layout: manual
---
```kcl
XY
```

View File

@ -0,0 +1,16 @@
---
title: "XZ"
subtitle: "Constant in prelude"
excerpt: ""
layout: manual
---
```kcl
XZ
```

View File

@ -0,0 +1,16 @@
---
title: "Y"
subtitle: "Constant in prelude"
excerpt: ""
layout: manual
---
```kcl
Y
```

View File

@ -0,0 +1,16 @@
---
title: "YZ"
subtitle: "Constant in prelude"
excerpt: ""
layout: manual
---
```kcl
YZ
```

View File

@ -0,0 +1,16 @@
---
title: "Z"
subtitle: "Constant in prelude"
excerpt: ""
layout: manual
---
```kcl
Z
```

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,16 @@
---
title: "turns::HALF_TURN"
subtitle: "Constant in turns"
excerpt: ""
layout: manual
---
```kcl
turns::HALF_TURN: number(deg) = 180deg
```

View File

@ -0,0 +1,16 @@
---
title: "turns::QUARTER_TURN"
subtitle: "Constant in turns"
excerpt: ""
layout: manual
---
```kcl
turns::QUARTER_TURN: number(deg) = 90deg
```

View File

@ -0,0 +1,16 @@
---
title: "turns::THREE_QUARTER_TURN"
subtitle: "Constant in turns"
excerpt: ""
layout: manual
---
```kcl
turns::THREE_QUARTER_TURN: number(deg) = 270deg
```

View File

@ -0,0 +1,16 @@
---
title: "turns::ZERO"
subtitle: "Constant in turns"
excerpt: ""
layout: manual
---
```kcl
turns::ZERO: number = 0
```

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,17 +1,17 @@
--- ---
title: "std::math::atan" title: "atan"
subtitle: "Function in math"
excerpt: "Compute the arctangent of a number." excerpt: "Compute the arctangent of a number."
layout: manual layout: manual
--- ---
Compute the arctangent of a number. Compute the arctangent of a number.
Consider using `atan2()` instead for the true inverse of tangent. ```kcl
```js
atan(@num: number(_)): number(rad) atan(@num: number(_)): number(rad)
``` ```
Consider using `atan2()` instead for the true inverse of tangent.
### Arguments ### Arguments
@ -26,11 +26,11 @@ atan(@num: number(_)): number(rad)
### Examples ### Examples
```js ```kcl
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
|> startProfile(at = [0, 0]) |> startProfile(at = [0, 0])
|> angledLine( |> angledLine(
angle = math::atan(1.25), angle = atan(1.25),
length = 20, length = 20,
) )
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,18 +1,18 @@
--- ---
title: "std::units::toCentimeters" title: "units::toCentimeters"
subtitle: "Function in units"
excerpt: "Convert a number to centimeters from its current units." excerpt: "Convert a number to centimeters from its current units."
layout: manual layout: manual
--- ---
Convert a number to centimeters from its current units. Convert a number to centimeters from its current units.
```kcl
units::toCentimeters(@num: number(cm)): number(cm)
```js
toCentimeters(@num: number(cm)): number(cm)
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |

File diff suppressed because one or more lines are too long

View File

@ -1,18 +1,18 @@
--- ---
title: "std::units::toFeet" title: "units::toFeet"
subtitle: "Function in units"
excerpt: "Convert a number to feet from its current units." excerpt: "Convert a number to feet from its current units."
layout: manual layout: manual
--- ---
Convert a number to feet from its current units. Convert a number to feet from its current units.
```kcl
units::toFeet(@num: number(ft)): number(ft)
```js
toFeet(@num: number(ft)): number(ft)
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |

View File

@ -1,18 +1,18 @@
--- ---
title: "std::units::toInches" title: "units::toInches"
subtitle: "Function in units"
excerpt: "Convert a number to inches from its current units." excerpt: "Convert a number to inches from its current units."
layout: manual layout: manual
--- ---
Convert a number to inches from its current units. Convert a number to inches from its current units.
```kcl
units::toInches(@num: number(in)): number(in)
```js
toInches(@num: number(in)): number(in)
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |

View File

@ -1,18 +1,18 @@
--- ---
title: "std::units::toMeters" title: "units::toMeters"
subtitle: "Function in units"
excerpt: "Convert a number to meters from its current units." excerpt: "Convert a number to meters from its current units."
layout: manual layout: manual
--- ---
Convert a number to meters from its current units. Convert a number to meters from its current units.
```kcl
units::toMeters(@num: number(m)): number(m)
```js
toMeters(@num: number(m)): number(m)
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |

View File

@ -1,18 +1,18 @@
--- ---
title: "std::units::toMillimeters" title: "units::toMillimeters"
subtitle: "Function in units"
excerpt: "Convert a number to millimeters from its current units." excerpt: "Convert a number to millimeters from its current units."
layout: manual layout: manual
--- ---
Convert a number to millimeters from its current units. Convert a number to millimeters from its current units.
```kcl
units::toMillimeters(@num: number(mm)): number(mm)
```js
toMillimeters(@num: number(mm)): number(mm)
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |

File diff suppressed because one or more lines are too long

View File

@ -1,18 +1,18 @@
--- ---
title: "std::units::toYards" title: "units::toYards"
subtitle: "Function in units"
excerpt: "Converts a number to yards from its current units." excerpt: "Converts a number to yards from its current units."
layout: manual layout: manual
--- ---
Converts a number to yards from its current units. Converts a number to yards from its current units.
```kcl
units::toYards(@num: number(yd)): number(yd)
```js
toYards(@num: number(yd)): number(yd)
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |

View File

@ -1,23 +1,23 @@
--- ---
title: "getCommonEdge" title: "getCommonEdge"
subtitle: "Function in std::sketch"
excerpt: "Get the shared edge between two faces." excerpt: "Get the shared edge between two faces."
layout: manual layout: manual
--- ---
Get the shared edge between two faces. Get the shared edge between two faces.
```kcl
```js
getCommonEdge(faces: [TagIdentifier]): Uuid getCommonEdge(faces: [TagIdentifier]): Uuid
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `faces` | `[TagIdentifier]` | The tags of the faces you want to find the common edge between | Yes | | `faces` | [`[TagIdentifier]`](/docs/kcl-lang/types#TagIdentifier) | The tags of the faces you want to find the common edge between | Yes |
### Returns ### Returns
@ -26,7 +26,7 @@ getCommonEdge(faces: [TagIdentifier]): Uuid
### Examples ### Examples
```js ```kcl
// Get an edge shared between two faces, created after a chamfer. // Get an edge shared between two faces, created after a chamfer.

View File

@ -1,23 +1,23 @@
--- ---
title: "getNextAdjacentEdge" title: "getNextAdjacentEdge"
subtitle: "Function in std::sketch"
excerpt: "Get the next adjacent edge to the edge given." excerpt: "Get the next adjacent edge to the edge given."
layout: manual layout: manual
--- ---
Get the next adjacent edge to the edge given. Get the next adjacent edge to the edge given.
```kcl
getNextAdjacentEdge(@edge: TagIdentifier): Uuid
```js
getNextAdjacentEdge(edge: TagIdentifier): Uuid
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `edge` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The tag of the edge you want to find the next adjacent edge of. | Yes | | `edge` | [`TagIdentifier`](/docs/kcl-lang/types#TagIdentifier) | The tag of the edge you want to find the next adjacent edge of. | Yes |
### Returns ### Returns
@ -26,7 +26,7 @@ getNextAdjacentEdge(edge: TagIdentifier): Uuid
### Examples ### Examples
```js ```kcl
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0]) |> startProfile(at = [0, 0])
|> line(end = [10, 0]) |> line(end = [10, 0])

View File

@ -1,23 +1,23 @@
--- ---
title: "getOppositeEdge" title: "getOppositeEdge"
subtitle: "Function in std::sketch"
excerpt: "Get the opposite edge to the edge given." excerpt: "Get the opposite edge to the edge given."
layout: manual layout: manual
--- ---
Get the opposite edge to the edge given. Get the opposite edge to the edge given.
```kcl
getOppositeEdge(@edge: TagIdentifier): Uuid
```js
getOppositeEdge(edge: TagIdentifier): Uuid
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `edge` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The tag of the edge you want to find the opposite edge of. | Yes | | `edge` | [`TagIdentifier`](/docs/kcl-lang/types#TagIdentifier) | The tag of the edge you want to find the opposite edge of. | Yes |
### Returns ### Returns
@ -26,7 +26,7 @@ getOppositeEdge(edge: TagIdentifier): Uuid
### Examples ### Examples
```js ```kcl
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0]) |> startProfile(at = [0, 0])
|> line(end = [10, 0]) |> line(end = [10, 0])

View File

@ -1,23 +1,23 @@
--- ---
title: "getPreviousAdjacentEdge" title: "getPreviousAdjacentEdge"
subtitle: "Function in std::sketch"
excerpt: "Get the previous adjacent edge to the edge given." excerpt: "Get the previous adjacent edge to the edge given."
layout: manual layout: manual
--- ---
Get the previous adjacent edge to the edge given. Get the previous adjacent edge to the edge given.
```kcl
getPreviousAdjacentEdge(@edge: TagIdentifier): Uuid
```js
getPreviousAdjacentEdge(edge: TagIdentifier): Uuid
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `edge` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The tag of the edge you want to find the previous adjacent edge of. | Yes | | `edge` | [`TagIdentifier`](/docs/kcl-lang/types#TagIdentifier) | The tag of the edge you want to find the previous adjacent edge of. | Yes |
### Returns ### Returns
@ -26,7 +26,7 @@ getPreviousAdjacentEdge(edge: TagIdentifier): Uuid
### Examples ### Examples
```js ```kcl
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0]) |> startProfile(at = [0, 0])
|> line(end = [10, 0]) |> line(end = [10, 0])

162
docs/kcl-std/index.md Normal file
View File

@ -0,0 +1,162 @@
---
title: "KCL Standard Library"
excerpt: "Documentation for the KCL standard library for the Zoo Design Studio."
layout: manual
---
## Table of Contents
### Functions
* [**std**](/docs/kcl-std/modules/std)
* [`appearance`](/docs/kcl-std/appearance)
* [`assert`](/docs/kcl-std/assert)
* [`assertIs`](/docs/kcl-std/assertIs)
* [`clone`](/docs/kcl-std/clone)
* [`helix`](/docs/kcl-std/functions/std-helix)
* [`offsetPlane`](/docs/kcl-std/functions/std-offsetPlane)
* [`patternLinear2d`](/docs/kcl-std/patternLinear2d)
* [**std::array**](/docs/kcl-std/modules/std-array)
* [`map`](/docs/kcl-std/map)
* [`pop`](/docs/kcl-std/pop)
* [`push`](/docs/kcl-std/push)
* [`reduce`](/docs/kcl-std/reduce)
* [**std::math**](/docs/kcl-std/modules/std-math)
* [`abs`](/docs/kcl-std/functions/std-math-abs)
* [`acos`](/docs/kcl-std/functions/std-math-acos)
* [`asin`](/docs/kcl-std/functions/std-math-asin)
* [`atan`](/docs/kcl-std/functions/std-math-atan)
* [`atan2`](/docs/kcl-std/functions/std-math-atan2)
* [`ceil`](/docs/kcl-std/functions/std-math-ceil)
* [`cos`](/docs/kcl-std/functions/std-math-cos)
* [`floor`](/docs/kcl-std/functions/std-math-floor)
* [`legAngX`](/docs/kcl-std/legAngX)
* [`legAngY`](/docs/kcl-std/legAngY)
* [`legLen`](/docs/kcl-std/legLen)
* [`ln`](/docs/kcl-std/functions/std-math-ln)
* [`log`](/docs/kcl-std/functions/std-math-log)
* [`log10`](/docs/kcl-std/functions/std-math-log10)
* [`log2`](/docs/kcl-std/functions/std-math-log2)
* [`max`](/docs/kcl-std/functions/std-math-max)
* [`min`](/docs/kcl-std/functions/std-math-min)
* [`polar`](/docs/kcl-std/functions/std-math-polar)
* [`pow`](/docs/kcl-std/functions/std-math-pow)
* [`rem`](/docs/kcl-std/functions/std-math-rem)
* [`round`](/docs/kcl-std/functions/std-math-round)
* [`sin`](/docs/kcl-std/functions/std-math-sin)
* [`sqrt`](/docs/kcl-std/functions/std-math-sqrt)
* [`tan`](/docs/kcl-std/functions/std-math-tan)
* [**std::sketch**](/docs/kcl-std/modules/std-sketch)
* [`angledLine`](/docs/kcl-std/angledLine)
* [`angledLineThatIntersects`](/docs/kcl-std/angledLineThatIntersects)
* [`arc`](/docs/kcl-std/arc)
* [`bezierCurve`](/docs/kcl-std/bezierCurve)
* [`circle`](/docs/kcl-std/functions/std-sketch-circle)
* [`circleThreePoint`](/docs/kcl-std/circleThreePoint)
* [`close`](/docs/kcl-std/close)
* [`extrude`](/docs/kcl-std/extrude)
* [`getCommonEdge`](/docs/kcl-std/getCommonEdge)
* [`getNextAdjacentEdge`](/docs/kcl-std/getNextAdjacentEdge)
* [`getOppositeEdge`](/docs/kcl-std/getOppositeEdge)
* [`getPreviousAdjacentEdge`](/docs/kcl-std/getPreviousAdjacentEdge)
* [`involuteCircular`](/docs/kcl-std/involuteCircular)
* [`lastSegX`](/docs/kcl-std/lastSegX)
* [`lastSegY`](/docs/kcl-std/lastSegY)
* [`line`](/docs/kcl-std/line)
* [`loft`](/docs/kcl-std/loft)
* [`patternCircular2d`](/docs/kcl-std/patternCircular2d)
* [`patternTransform2d`](/docs/kcl-std/patternTransform2d)
* [`polygon`](/docs/kcl-std/polygon)
* [`profileStart`](/docs/kcl-std/profileStart)
* [`profileStartX`](/docs/kcl-std/profileStartX)
* [`profileStartY`](/docs/kcl-std/profileStartY)
* [`revolve`](/docs/kcl-std/functions/std-sketch-revolve)
* [`segAng`](/docs/kcl-std/segAng)
* [`segEnd`](/docs/kcl-std/segEnd)
* [`segEndX`](/docs/kcl-std/segEndX)
* [`segEndY`](/docs/kcl-std/segEndY)
* [`segLen`](/docs/kcl-std/segLen)
* [`segStart`](/docs/kcl-std/segStart)
* [`segStartX`](/docs/kcl-std/segStartX)
* [`segStartY`](/docs/kcl-std/segStartY)
* [`startProfile`](/docs/kcl-std/startProfile)
* [`startSketchOn`](/docs/kcl-std/startSketchOn)
* [`subtract2d`](/docs/kcl-std/subtract2d)
* [`sweep`](/docs/kcl-std/sweep)
* [`tangentToEnd`](/docs/kcl-std/tangentToEnd)
* [`tangentialArc`](/docs/kcl-std/tangentialArc)
* [`xLine`](/docs/kcl-std/xLine)
* [`yLine`](/docs/kcl-std/yLine)
* [**std::solid**](/docs/kcl-std/modules/std-solid)
* [`chamfer`](/docs/kcl-std/functions/std-solid-chamfer)
* [`fillet`](/docs/kcl-std/functions/std-solid-fillet)
* [`hollow`](/docs/kcl-std/functions/std-solid-hollow)
* [`intersect`](/docs/kcl-std/intersect)
* [`patternCircular3d`](/docs/kcl-std/patternCircular3d)
* [`patternLinear3d`](/docs/kcl-std/patternLinear3d)
* [`patternTransform`](/docs/kcl-std/patternTransform)
* [`shell`](/docs/kcl-std/functions/std-solid-shell)
* [`subtract`](/docs/kcl-std/subtract)
* [`union`](/docs/kcl-std/union)
* [**std::transform**](/docs/kcl-std/modules/std-transform)
* [`mirror2d`](/docs/kcl-std/functions/std-transform-mirror2d)
* [`rotate`](/docs/kcl-std/rotate)
* [`scale`](/docs/kcl-std/scale)
* [`translate`](/docs/kcl-std/translate)
* [**std::units**](/docs/kcl-std/modules/std-units)
* [`units::toCentimeters`](/docs/kcl-std/functions/std-units-toCentimeters)
* [`units::toDegrees`](/docs/kcl-std/functions/std-units-toDegrees)
* [`units::toFeet`](/docs/kcl-std/functions/std-units-toFeet)
* [`units::toInches`](/docs/kcl-std/functions/std-units-toInches)
* [`units::toMeters`](/docs/kcl-std/functions/std-units-toMeters)
* [`units::toMillimeters`](/docs/kcl-std/functions/std-units-toMillimeters)
* [`units::toRadians`](/docs/kcl-std/functions/std-units-toRadians)
* [`units::toYards`](/docs/kcl-std/functions/std-units-toYards)
### Constants
* [**std**](/docs/kcl-std/modules/std)
* [`END`](/docs/kcl-std/consts/std-END)
* [`START`](/docs/kcl-std/consts/std-START)
* [`X`](/docs/kcl-std/consts/std-X)
* [`XY`](/docs/kcl-std/consts/std-XY)
* [`XZ`](/docs/kcl-std/consts/std-XZ)
* [`Y`](/docs/kcl-std/consts/std-Y)
* [`YZ`](/docs/kcl-std/consts/std-YZ)
* [`Z`](/docs/kcl-std/consts/std-Z)
* [**std::math**](/docs/kcl-std/modules/std-math)
* [`E`](/docs/kcl-std/consts/std-math-E)
* [`PI`](/docs/kcl-std/consts/std-math-PI)
* [`TAU`](/docs/kcl-std/consts/std-math-TAU)
* [**std::turns**](/docs/kcl-std/modules/std-turns)
* [`turns::HALF_TURN`](/docs/kcl-std/consts/std-turns-HALF_TURN)
* [`turns::QUARTER_TURN`](/docs/kcl-std/consts/std-turns-QUARTER_TURN)
* [`turns::THREE_QUARTER_TURN`](/docs/kcl-std/consts/std-turns-THREE_QUARTER_TURN)
* [`turns::ZERO`](/docs/kcl-std/consts/std-turns-ZERO)
### Types
See also the [types overview](/docs/kcl-lang/types)
* [**Primitive types**](/docs/kcl-lang/types)
* [`End`](/docs/kcl-lang/types#End)
* [`ImportedGeometry`](/docs/kcl-lang/types#ImportedGeometry)
* [`Start`](/docs/kcl-lang/types#Start)
* [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator)
* [`TagIdentifier`](/docs/kcl-lang/types#TagIdentifier)
* [`any`](/docs/kcl-std/types/std-types-any)
* [`bool`](/docs/kcl-std/types/std-types-bool)
* [`number`](/docs/kcl-std/types/std-types-number)
* [`string`](/docs/kcl-std/types/std-types-string)
* [`tag`](/docs/kcl-std/types/std-types-tag)
* [**std::types**](/docs/kcl-std/modules/std-types)
* [`Axis2d`](/docs/kcl-std/types/std-types-Axis2d)
* [`Axis3d`](/docs/kcl-std/types/std-types-Axis3d)
* [`Edge`](/docs/kcl-std/types/std-types-Edge)
* [`Face`](/docs/kcl-std/types/std-types-Face)
* [`Helix`](/docs/kcl-std/types/std-types-Helix)
* [`Plane`](/docs/kcl-std/types/std-types-Plane)
* [`Point2d`](/docs/kcl-std/types/std-types-Point2d)
* [`Point3d`](/docs/kcl-std/types/std-types-Point3d)
* [`Sketch`](/docs/kcl-std/types/std-types-Sketch)
* [`Solid`](/docs/kcl-std/types/std-types-Solid)

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,15 @@
--- ---
title: "involuteCircular" title: "involuteCircular"
subtitle: "Function in std::sketch"
excerpt: "Extend the current sketch with a new involute circular curve." excerpt: "Extend the current sketch with a new involute circular curve."
layout: manual layout: manual
--- ---
Extend the current sketch with a new involute circular curve. Extend the current sketch with a new involute circular curve.
```kcl
```js
involuteCircular( involuteCircular(
sketch: Sketch, @sketch: Sketch,
startRadius: number, startRadius: number,
endRadius: number, endRadius: number,
angle: number, angle: number,
@ -20,25 +19,26 @@ involuteCircular(
``` ```
### Arguments ### Arguments
| 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-std/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
| `startRadius` | [`number`](/docs/kcl/types/number) | The involute is described between two circles, start_radius is the radius of the inner circle. | Yes | | `startRadius` | [`number`](/docs/kcl-std/types/std-types-number) | The involute is described between two circles, start_radius is the radius of the inner circle. | Yes |
| `endRadius` | [`number`](/docs/kcl/types/number) | The involute is described between two circles, end_radius is the radius of the outer circle. | Yes | | `endRadius` | [`number`](/docs/kcl-std/types/std-types-number) | The involute is described between two circles, end_radius is the radius of the outer circle. | Yes |
| `angle` | [`number`](/docs/kcl/types/number) | The angle to rotate the involute by. A value of zero will produce a curve with a tangent along the x-axis at the start point of the curve. | Yes | | `angle` | [`number`](/docs/kcl-std/types/std-types-number) | The angle to rotate the involute by. A value of zero will produce a curve with a tangent along the x-axis at the start point of the curve. | Yes |
| `reverse` | [`bool`](/docs/kcl/types/bool) | If reverse is true, the segment will start from the end of the involute, otherwise it will start from that start. Defaults to false. | No | | `reverse` | [`bool`](/docs/kcl-std/types/std-types-bool) | If reverse is true, the segment will start from the end of the involute, otherwise it will start from that start. Defaults to false. | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No | | [`tag`](/docs/kcl-std/types/std-types-tag) | [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator) | Create a new tag which refers to this line | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
### Examples ### Examples
```js ```kcl
a = 10 a = 10
b = 14 b = 14
startSketchOn(XZ) startSketchOn(XZ)

View File

@ -1,32 +1,32 @@
--- ---
title: "lastSegX" title: "lastSegX"
subtitle: "Function in std::sketch"
excerpt: "Extract the 'x' axis value of the last line segment in the provided 2-d sketch." 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 sketch. Extract the 'x' axis value of the last line segment in the provided 2-d sketch.
```kcl
lastSegX(@sketch: Sketch): number
```js
lastSegX(sketch: Sketch): number
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | The sketch whose line segment is being queried | Yes | | `sketch` | [`Sketch`](/docs/kcl-std/types/std-types-Sketch) | The sketch whose line segment is being queried | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) [`number`](/docs/kcl-std/types/std-types-number) - A number
### Examples ### Examples
```js ```kcl
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0]) |> startProfile(at = [0, 0])
|> line(end = [5, 0]) |> line(end = [5, 0])

View File

@ -1,32 +1,32 @@
--- ---
title: "lastSegY" title: "lastSegY"
subtitle: "Function in std::sketch"
excerpt: "Extract the 'y' axis value of the last line segment in the provided 2-d sketch." 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 sketch. Extract the 'y' axis value of the last line segment in the provided 2-d sketch.
```kcl
lastSegY(@sketch: Sketch): number
```js
lastSegY(sketch: Sketch): number
``` ```
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | The sketch whose line segment is being queried | Yes | | `sketch` | [`Sketch`](/docs/kcl-std/types/std-types-Sketch) | The sketch whose line segment is being queried | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) [`number`](/docs/kcl-std/types/std-types-number) - A number
### Examples ### Examples
```js ```kcl
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0]) |> startProfile(at = [0, 0])
|> line(end = [5, 0]) |> line(end = [5, 0])

View File

@ -1,41 +1,38 @@
--- ---
title: "legAngX" title: "legAngX"
subtitle: "Function in std::math"
excerpt: "Compute the angle of the given leg for x." excerpt: "Compute the angle of the given leg for x."
layout: manual layout: manual
--- ---
Compute the angle of the given leg for x. Compute the angle of the given leg for x.
```kcl
```js
legAngX( legAngX(
hypotenuse: number, hypotenuse: number,
leg: number, leg: number,
): number ): number
``` ```
### Tags
* `utilities`
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `hypotenuse` | [`number`](/docs/kcl/types/number) | The length of the triangle's hypotenuse | Yes | | `hypotenuse` | [`number`](/docs/kcl-std/types/std-types-number) | The length of the triangle's hypotenuse | Yes |
| `leg` | [`number`](/docs/kcl/types/number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes | | `leg` | [`number`](/docs/kcl-std/types/std-types-number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) [`number`](/docs/kcl-std/types/std-types-number) - A number
### Examples ### Examples
```js ```kcl
legAngX(hypotenuse = 5, leg = 3) legAngX(hypotenuse = 5, leg = 3)
``` ```

View File

@ -1,41 +1,38 @@
--- ---
title: "legAngY" title: "legAngY"
subtitle: "Function in std::math"
excerpt: "Compute the angle of the given leg for y." excerpt: "Compute the angle of the given leg for y."
layout: manual layout: manual
--- ---
Compute the angle of the given leg for y. Compute the angle of the given leg for y.
```kcl
```js
legAngY( legAngY(
hypotenuse: number, hypotenuse: number,
leg: number, leg: number,
): number ): number
``` ```
### Tags
* `utilities`
### Arguments ### Arguments
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `hypotenuse` | [`number`](/docs/kcl/types/number) | The length of the triangle's hypotenuse | Yes | | `hypotenuse` | [`number`](/docs/kcl-std/types/std-types-number) | The length of the triangle's hypotenuse | Yes |
| `leg` | [`number`](/docs/kcl/types/number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes | | `leg` | [`number`](/docs/kcl-std/types/std-types-number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) [`number`](/docs/kcl-std/types/std-types-number) - A number
### Examples ### Examples
```js ```kcl
legAngY(hypotenuse = 5, leg = 3) legAngY(hypotenuse = 5, leg = 3)
``` ```

38
docs/kcl-std/legLen.md Normal file
View File

@ -0,0 +1,38 @@
---
title: "legLen"
subtitle: "Function in std::math"
excerpt: "Compute the length of the given leg."
layout: manual
---
Compute the length of the given leg.
```kcl
legLen(
hypotenuse: number,
leg: number,
): number
```
### Arguments
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `hypotenuse` | [`number`](/docs/kcl-std/types/std-types-number) | The length of the triangle's hypotenuse | Yes |
| `leg` | [`number`](/docs/kcl-std/types/std-types-number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes |
### Returns
[`number`](/docs/kcl-std/types/std-types-number) - A number
### Examples
```kcl
legLen(hypotenuse = 5, leg = 3)
```

View File

@ -1,40 +1,40 @@
--- ---
title: "line" title: "line"
subtitle: "Function in std::sketch"
excerpt: "Extend the current sketch with a new straight line." excerpt: "Extend the current sketch with a new straight line."
layout: manual layout: manual
--- ---
Extend the current sketch with a new straight line. Extend the current sketch with a new straight line.
```kcl
```js
line( line(
sketch: Sketch, @sketch: Sketch,
endAbsolute?: [number], endAbsolute?: Point2d,
end?: [number], end?: Point2d,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ): Sketch
``` ```
### Arguments ### Arguments
| 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-std/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
| `endAbsolute` | [`[number]`](/docs/kcl/types/number) | Which absolute point should this line go to? Incompatible with `end`. | No | | `endAbsolute` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | Which absolute point should this line go to? Incompatible with `end`. | No |
| `end` | [`[number]`](/docs/kcl/types/number) | How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`. | No | | `end` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`. | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No | | [`tag`](/docs/kcl-std/types/std-types-tag) | [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator) | Create a new tag which refers to this line | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
### Examples ### Examples
```js ```kcl
triangle = startSketchOn(XZ) triangle = startSketchOn(XZ)
|> startProfile(at = [0, 0]) |> startProfile(at = [0, 0])
// The END argument means it ends at exactly [10, 0]. // The END argument means it ends at exactly [10, 0].

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
--- ---
title: "std::Y" title: "array"
subtitle: "Module in std"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---
@ -8,8 +9,5 @@ layout: manual
```js
std::Y
```

View File

@ -0,0 +1,39 @@
---
title: "math"
subtitle: "Module in std"
excerpt: ""
layout: manual
---
## Functions and constants
* [`E`](/docs/kcl-std/consts/std-math-E)
* [`PI`](/docs/kcl-std/consts/std-math-PI)
* [`TAU`](/docs/kcl-std/consts/std-math-TAU)
* [`abs`](/docs/kcl-std/functions/std-math-abs)
* [`acos`](/docs/kcl-std/functions/std-math-acos)
* [`asin`](/docs/kcl-std/functions/std-math-asin)
* [`atan`](/docs/kcl-std/functions/std-math-atan)
* [`atan2`](/docs/kcl-std/functions/std-math-atan2)
* [`ceil`](/docs/kcl-std/functions/std-math-ceil)
* [`cos`](/docs/kcl-std/functions/std-math-cos)
* [`floor`](/docs/kcl-std/functions/std-math-floor)
* [`ln`](/docs/kcl-std/functions/std-math-ln)
* [`log`](/docs/kcl-std/functions/std-math-log)
* [`log10`](/docs/kcl-std/functions/std-math-log10)
* [`log2`](/docs/kcl-std/functions/std-math-log2)
* [`max`](/docs/kcl-std/functions/std-math-max)
* [`min`](/docs/kcl-std/functions/std-math-min)
* [`polar`](/docs/kcl-std/functions/std-math-polar)
* [`pow`](/docs/kcl-std/functions/std-math-pow)
* [`rem`](/docs/kcl-std/functions/std-math-rem)
* [`round`](/docs/kcl-std/functions/std-math-round)
* [`sin`](/docs/kcl-std/functions/std-math-sin)
* [`sqrt`](/docs/kcl-std/functions/std-math-sqrt)
* [`tan`](/docs/kcl-std/functions/std-math-tan)

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