* 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>
* 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>
* fix length constrainting
* conflicet
* fix circle center constraints
* fix up circle remove constraints more and add test
* fix three point arc overlays and add test for it
* fixes
* console log
* fix tangential arc stuff
* fmt
* fix unit test
* fix console error when selectiong arc
* Remove deprecated syntax
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* fix one test
* fix sketch on revolved face test
* fix test: empty-scene default-planes act as expected
* fix up more tests
* another fix
* remove another const
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch>
* Partition nextest runs
* move name back to 'cargo test'
* Fix duplicate name
There were two jobs both named `build-test-artifacts`. Changed the latter
to `run-test-artifacts`
* cd into rust/ before running nextest
* Get token when running the tests
* Try getting archive into correct dir via different method
* Bump shards to 6
* Replace llvm-cov with nextest
* Adjust job name
* Remove unnecessary comments
---------
Co-authored-by: Jace Browning <jacebrowning@gmail.com>
* chore: saving off skeleton
* fix: saving skeleton
* chore: skeleton for loading projects from project directory path
* chore: cleaning up useless state transition to be an on event direct to action state
* fix: new structure for web vs desktop vs react machine provider code
* chore: saving off skeleton
* fix: skeleton logic for react? going to move it from a string to obj.string
* fix: trying to prevent error element unmount on global react components. This is bricking JS state
* fix: we are so back
* chore: implemented navigating to specfic KCL file
* chore: implementing renaming project
* chore: deleting project
* fix: auto fixes
* fix: old debug/testing file oops
* chore: generic create new file
* chore: skeleton for web create file provide
* chore: basic machine vitest... need to figure out how to get window.electron implemented in vitest?
* chore: save off progress before deleting other project implementation, a few missing features still
* chore: trying a different init skeleton? most likely will migrate
* chore: first attempt of purging projects context provider
* chore: enabling toast for some machine state
* chore: enabling more toast success and error
* chore: writing read write state to the system io based on the project path
* fix: tsc fixes
* fix: use file system watcher, navigate to project after creation via the requestProjectName
* chore: open project command, hooks vs snapshot context helpers
* chore: implemented open and create project for e2e testing. They are hard coded in poor spot for now.
* fix: codespell fixes
* chore: implementing more project commands
* chore: PR improvements for root.tsx
* chore: leaving comment about new Router.tsx layout
* fix: removing debugging code
* fix: rewriting component for readability
* fix: improving web initialization
* chore: implementing import file from url which is not actually that?
* fix: clearing search params on import file from url
* fix: fixed two e2e tests, forgot needsReview when making new command
* fix: fixing some import from url business logic to pass e2e tests
* chore: script for diffing circular deps +/-
* fix: formatting
* fix: massive fix for circular depsga!
* fix: trying to fix some errors and auto fmt
* fix: updating deps
* fix: removing debugging code
* fix: big clean up
* fix: more deletion
* fix: tsc cleanup
* fix: TSC TSC TSC TSC!
* fix: typo fix
* fix: clear query params on web only, desktop not required
* fix: removing unused code
* fmt
* Bring back `trap` removed in merge
* Use explicit types instead of `any`s on arg configs
* Add project commands directly to command palette
* fix: deleting debugging code, from PR review
* fix: this got added back(?)
* fix: using referred type
* fix: more PR clean up
* fix: big block comment for xstate architecture decision
* fix: more pr comment fixes
* fix: saving off logic, need a big cleanup because I hacked it together to get a POC
* fix: extra business?
* fix: merge conflict just added them back why dude
* fix: more PR comments
* fix: big ciruclar deps fix, commandBarActor in appActor
* chore: writing e2e test, still need to fix 3 bugs
* chore: adding more scenarios
* fix: formatting
* fix: fixing tsc errors
* chore: deleting the old text to cad and using the new application level one, almost there
* fix: prompt to edit works
* fix: large push to get 1 text to cad command... the usage is a little buggy with delete and navigate within /file
* fix: settings for highlight edges now works
* chore: adding another e2e test
* fix: cleaning up e2e tests and writing more of them
* fix: tsc type
* chore: more e2e improvements, unique project name in text to cad
* chore: e2e tests should be good to go
* fix: gotcha comment
* fix: enabled web t2c, codespell fixes
* fix: fixing merge conflcits??
* feat: implemented load external for kcl samples
* feat: load external model from disk
* fix: trying to delete old stuff
* fix: all command trigger locations now have defaults for current project
* fix: gotcha comment for the future
* chore: hiding import file from url command, two separate commands for 3d and kcl file adding
* chore: commands are now add file to project, 3rd iteration
* fix: t2c in file menu fixed
* chore: updating file menu for new global actions
* fix: auto fixes
* fix: the command bar arg flow for web add kcl file seems backwards?
* chore: updated home layout, added create from kcl sample button
* chore: remapping some menu actions
* fix: fixing open dialog copy
* fix: an e2e test
* fix: fixed e2e tests
* fix: fixed e2e tests
* fix: auto fixes
* fix: pr clean up
* fix: removing console log
* fix: PR updates
* fix: the reviewed stage boolean required the expected state to change. Also I progressed the command bar too soon
* fix: no idea how this passed locally yesterday? I removed the {dir} unused but I need the function's logic but not the return value...
* fix: should be good to go?
---------
Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
These little helper functions (legAng, segLen etc) were already using keyword arguments, but when the frontend created AST nodes, it was creating them as CallExpression not CallExpressionKw. We have backwards-compatibility so it's fine, but we should not be relying on that anymore.
This PR should not have any user-observable change.
* wip hack to delete line segments
* unrelated: clean up console
* better check if current selection is segment before deletion
* lint
* add test for delete segment with key
* Declare chamfer in KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Ignore more in the simulation tests
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Declare fillet in KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move shell and hollow to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* WIP: Assemblies: Point-and-click Clone
Fixes#6209
* Make assemblies commands available for release
Fixes#6497
* Break insert out of the group, new icon, add Clone disabled
* Add rotate thanks to @franknoirot
* Update relevant snapshots
* Fix pathToNode
* Add clone to stdlibmap
* Cleaned more things
* Add custom icon
* Add variable name for clone
* Add e2e test for import and translated import
* Remove stale comment
* Add test for selection based extrude clone
* First batch of suggestions from @lee-at-zoo-corp, tysm!
* Clean up test names
* Second batch of @lee-at-zoo-corp's suggestion for modelingMachine error handling
* chore: saving off skeleton
* fix: saving skeleton
* chore: skeleton for loading projects from project directory path
* chore: cleaning up useless state transition to be an on event direct to action state
* fix: new structure for web vs desktop vs react machine provider code
* chore: saving off skeleton
* fix: skeleton logic for react? going to move it from a string to obj.string
* fix: trying to prevent error element unmount on global react components. This is bricking JS state
* fix: we are so back
* chore: implemented navigating to specfic KCL file
* chore: implementing renaming project
* chore: deleting project
* fix: auto fixes
* fix: old debug/testing file oops
* chore: generic create new file
* chore: skeleton for web create file provide
* chore: basic machine vitest... need to figure out how to get window.electron implemented in vitest?
* chore: save off progress before deleting other project implementation, a few missing features still
* chore: trying a different init skeleton? most likely will migrate
* chore: first attempt of purging projects context provider
* chore: enabling toast for some machine state
* chore: enabling more toast success and error
* chore: writing read write state to the system io based on the project path
* fix: tsc fixes
* fix: use file system watcher, navigate to project after creation via the requestProjectName
* chore: open project command, hooks vs snapshot context helpers
* chore: implemented open and create project for e2e testing. They are hard coded in poor spot for now.
* fix: codespell fixes
* chore: implementing more project commands
* chore: PR improvements for root.tsx
* chore: leaving comment about new Router.tsx layout
* fix: removing debugging code
* fix: rewriting component for readability
* fix: improving web initialization
* chore: implementing import file from url which is not actually that?
* fix: clearing search params on import file from url
* fix: fixed two e2e tests, forgot needsReview when making new command
* fix: fixing some import from url business logic to pass e2e tests
* chore: script for diffing circular deps +/-
* fix: formatting
* fix: massive fix for circular depsga!
* fix: trying to fix some errors and auto fmt
* fix: updating deps
* fix: removing debugging code
* fix: big clean up
* fix: more deletion
* fix: tsc cleanup
* fix: TSC TSC TSC TSC!
* fix: typo fix
* fix: clear query params on web only, desktop not required
* fix: removing unused code
* fmt
* Bring back `trap` removed in merge
* Use explicit types instead of `any`s on arg configs
* Add project commands directly to command palette
* fix: deleting debugging code, from PR review
* fix: this got added back(?)
* fix: using referred type
* fix: more PR clean up
* fix: big block comment for xstate architecture decision
* fix: more pr comment fixes
* fix: saving off logic, need a big cleanup because I hacked it together to get a POC
* fix: extra business?
* fix: merge conflict just added them back why dude
* fix: more PR comments
* fix: big ciruclar deps fix, commandBarActor in appActor
* chore: writing e2e test, still need to fix 3 bugs
* chore: adding more scenarios
* fix: formatting
* fix: fixing tsc errors
* chore: deleting the old text to cad and using the new application level one, almost there
* fix: prompt to edit works
* fix: large push to get 1 text to cad command... the usage is a little buggy with delete and navigate within /file
* fix: settings for highlight edges now works
* chore: adding another e2e test
* fix: cleaning up e2e tests and writing more of them
* fix: tsc type
* chore: more e2e improvements, unique project name in text to cad
* chore: e2e tests should be good to go
* fix: gotcha comment
* fix: enabled web t2c, codespell fixes
* fix: fixing merge conflcits??
* fix: t2c is back
* Rework home layout to have a sidebar
fmt I think
* Add two links to the bottom of the sidebar
Mostly to visually anchor it
* Tweak some style things
* update test util whose locator needs to change
* tsc and fmt
* Stupid heading change broke the dang E2E tests
* Make that heading locator a part of the home page fixture
* pierremtb/new-snaps-for-frank (#6516)
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
---------
Co-authored-by: Kevin Nadro <kevin@zoo.dev>
Co-authored-by: Kevin Nadro <nadr0@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Common edge faces into artifact graph
* clean up
* kingdom of tags
* add tests
* hook up tags with edge treatments
* update unit tests
* update e2e
* clean up
* more fix up after main merge
* fmt
* revolve fix
* fix new circular dependency
* fix revolve
* remove numbers from circ deps, makes diffs bad
* sim test updates
* try and get tests working
* update
* Fix tsc error
---------
Co-authored-by: max-mrgrsk <156543465+max-mrgrsk@users.noreply.github.com>
Co-authored-by: max <margorskyi@gmail.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* chore: saving off skeleton
* fix: saving skeleton
* chore: skeleton for loading projects from project directory path
* chore: cleaning up useless state transition to be an on event direct to action state
* fix: new structure for web vs desktop vs react machine provider code
* chore: saving off skeleton
* fix: skeleton logic for react? going to move it from a string to obj.string
* fix: trying to prevent error element unmount on global react components. This is bricking JS state
* fix: we are so back
* chore: implemented navigating to specfic KCL file
* chore: implementing renaming project
* chore: deleting project
* fix: auto fixes
* fix: old debug/testing file oops
* chore: generic create new file
* chore: skeleton for web create file provide
* chore: basic machine vitest... need to figure out how to get window.electron implemented in vitest?
* chore: save off progress before deleting other project implementation, a few missing features still
* chore: trying a different init skeleton? most likely will migrate
* chore: first attempt of purging projects context provider
* chore: enabling toast for some machine state
* chore: enabling more toast success and error
* chore: writing read write state to the system io based on the project path
* fix: tsc fixes
* fix: use file system watcher, navigate to project after creation via the requestProjectName
* chore: open project command, hooks vs snapshot context helpers
* chore: implemented open and create project for e2e testing. They are hard coded in poor spot for now.
* fix: codespell fixes
* chore: implementing more project commands
* chore: PR improvements for root.tsx
* chore: leaving comment about new Router.tsx layout
* fix: removing debugging code
* fix: rewriting component for readability
* fix: improving web initialization
* chore: implementing import file from url which is not actually that?
* fix: clearing search params on import file from url
* fix: fixed two e2e tests, forgot needsReview when making new command
* fix: fixing some import from url business logic to pass e2e tests
* chore: script for diffing circular deps +/-
* fix: formatting
* fix: massive fix for circular depsga!
* fix: trying to fix some errors and auto fmt
* fix: updating deps
* fix: removing debugging code
* fix: big clean up
* fix: more deletion
* fix: tsc cleanup
* fix: TSC TSC TSC TSC!
* fix: typo fix
* fix: clear query params on web only, desktop not required
* fix: removing unused code
* fmt
* Bring back `trap` removed in merge
* Use explicit types instead of `any`s on arg configs
* Add project commands directly to command palette
* fix: deleting debugging code, from PR review
* fix: this got added back(?)
* fix: using referred type
* fix: more PR clean up
* fix: big block comment for xstate architecture decision
* fix: more pr comment fixes
* fix: saving off logic, need a big cleanup because I hacked it together to get a POC
* fix: extra business?
* fix: merge conflict just added them back why dude
* fix: more PR comments
* fix: big ciruclar deps fix, commandBarActor in appActor
* chore: writing e2e test, still need to fix 3 bugs
* chore: adding more scenarios
* fix: formatting
* fix: fixing tsc errors
* chore: deleting the old text to cad and using the new application level one, almost there
* fix: prompt to edit works
* fix: large push to get 1 text to cad command... the usage is a little buggy with delete and navigate within /file
* fix: settings for highlight edges now works
* chore: adding another e2e test
* fix: cleaning up e2e tests and writing more of them
* fix: tsc type
* chore: more e2e improvements, unique project name in text to cad
* chore: e2e tests should be good to go
* fix: gotcha comment
* fix: enabled web t2c, codespell fixes
* fix: fixing merge conflcits??
* fix: t2c is back
* Remove spaces in command bar test
* fmt
---------
Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
Co-authored-by: lee-at-zoo-corp <lee@zoo.dev>
* Change so that var definitions can be a module's return value
* Change car wheel assembly to use the new return mechanism
* Add sim test
* Update output
* Update module docs
* Add safety check to only work with modules
* Fix to use updated keyword args
* Make assemblies commands available for release
Fixes#6497
* Break insert out of the group, new icon, add Clone disabled
* Add rotate thanks to @franknoirot
* Update relevant snapshots
* Trigger CI
* add first version of DefaultPlanes to FeatureTreePane
* fix lint issues
* don't show default planes UI in sketch mode
* lint
* toggling default planes: implementation in xstate
* revert malformed modelingMachine.ts
* lint
* save and restore default plane visibility when returning to modeling mode
* fmt
* tsc
* introduce new cleanup state with actor when exiting sketch mode
* temp remove restore default plane visibility - causes error on starting up a project
* set selection filter after executeAst - this is a wip hacky fix
* remove unused early return: this also caused plane selection to only work with double click
* lint
* no need to set selection filter to curves only, we want faces to be selectable in modeling mode, even though this means default planes are also selectable
* tightening types for visibility map
* lint
* cleanups
* fix border issue when visibility toggle is not active and props.visible === true
* ui updates on FeatureTreePane/default planes
* no pointer cursor for unselectable default planes
* show default planes initially even for non-empty projects
* dont show default planes initially when project is not empty
* fix test: Only show axis planes when there are no errors
* fixes for sketch tests
* better initialize for planes
* lint
* fix uneccessary 'reset camera position' in sketch entry
* revert hiding/showing content depending on artifact graph for tests
* only show default planes when there are no errors
* disable Restore default plane visibility, was causing temporary flashing of default planes when exiting sketch mode
* Always show default plane visibility toggles, regardless of being on/off
* revert modelingMachine to original idle states to avoid 'zoom_to_fit' test regression - probably racing condition
* fmt
* Quick prototype: open in new window in file tree
* WIP: refresh on imported file change
* Fix up reexecution
* Clean up
* Add test 'Assembly gets reexecuted when imported models are updated externally'
* Clean up
* bump three point arc up
* Update tests to select tangential arc from dropdown
* Fix another test that used tangential arc
* Fix up snapshot tests' use of Tangential Arc
---------
Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
* chore: saving off skeleton
* fix: saving skeleton
* chore: skeleton for loading projects from project directory path
* chore: cleaning up useless state transition to be an on event direct to action state
* fix: new structure for web vs desktop vs react machine provider code
* chore: saving off skeleton
* fix: skeleton logic for react? going to move it from a string to obj.string
* fix: trying to prevent error element unmount on global react components. This is bricking JS state
* fix: we are so back
* chore: implemented navigating to specfic KCL file
* chore: implementing renaming project
* chore: deleting project
* fix: auto fixes
* fix: old debug/testing file oops
* chore: generic create new file
* chore: skeleton for web create file provide
* chore: basic machine vitest... need to figure out how to get window.electron implemented in vitest?
* chore: save off progress before deleting other project implementation, a few missing features still
* chore: trying a different init skeleton? most likely will migrate
* chore: first attempt of purging projects context provider
* chore: enabling toast for some machine state
* chore: enabling more toast success and error
* chore: writing read write state to the system io based on the project path
* fix: tsc fixes
* fix: use file system watcher, navigate to project after creation via the requestProjectName
* chore: open project command, hooks vs snapshot context helpers
* chore: implemented open and create project for e2e testing. They are hard coded in poor spot for now.
* fix: codespell fixes
* chore: implementing more project commands
* chore: PR improvements for root.tsx
* chore: leaving comment about new Router.tsx layout
* fix: removing debugging code
* fix: rewriting component for readability
* fix: improving web initialization
* chore: implementing import file from url which is not actually that?
* fix: clearing search params on import file from url
* fix: fixed two e2e tests, forgot needsReview when making new command
* fix: fixing some import from url business logic to pass e2e tests
* chore: script for diffing circular deps +/-
* fix: formatting
* fix: massive fix for circular depsga!
* fix: trying to fix some errors and auto fmt
* fix: updating deps
* fix: removing debugging code
* fix: big clean up
* fix: more deletion
* fix: tsc cleanup
* fix: TSC TSC TSC TSC!
* fix: typo fix
* fix: clear query params on web only, desktop not required
* fix: removing unused code
* fmt
* Bring back `trap` removed in merge
* Use explicit types instead of `any`s on arg configs
* Add project commands directly to command palette
* fix: deleting debugging code, from PR review
* fix: this got added back(?)
* fix: using referred type
* fix: more PR clean up
* fix: big block comment for xstate architecture decision
* fix: more pr comment fixes
* fix: merge conflict just added them back why dude
* fix: more PR comments
* fix: big ciruclar deps fix, commandBarActor in appActor
---------
Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
* Declare std::offsetPlane in KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Use two axes to define planes in KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* shorten tron app setup fail
* fmt
* more tweaks to tronapp setup
* bump initial timeout back to 120s
* Update e2e/playwright/zoo-test.ts
---------
Co-authored-by: Zookeeper Lee <lee@zoo.dev>
* dodec
* fmt
* comment
* Update kcl-samples simulation test output
* Update kcl-samples simulation test output
* Fix so that just commands regenerate ast output
* overwrite
* Update just command to include manifest
* Update generated output
* merge main post
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* Remove bug button from LowerRightControls
There is a "report a bug" button in the help menus, both native and
lower-right corner. This is overkill, and users are not using coredump
well.
* Remove coredump from refresh UI button
* Add a "Refresh app" command to palette
* Update snapshots
* Rework "Refresh and report bug" menu item to "Report a bug"
* Add refresh button to sidebar
* Convert upper-right refresh button to Share
* Tweak styles of command button
* Make anonymous user icon same size as known user image
* Remove ModelStateIndicator
* Use hotkeyDisplay for the sidebar too
* Update snapshots
* Remove tooltip from command bar open button
* tsc, lint, and fmt
* Back button on SignIn page leads to Home page
Fixes#6413
* Add regression test for the bug, and for new cancel button
* Full sign in e2e test
* Good bot
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
---------
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
* Turn on uom checks
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Convert all lengths to mm for engine calls
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Change polygon to keyword args
* Update docs
* Update generated output
* Update docs to mention the default for inscribed
* Appease clippy
* Remove tag parameter
* Update docs since removing tag
* Remove inscribed from autocomplete snippet since the default is true
Update onboarding interactive numbers test to use editor fixture
Trying to bring it down from the leaderboard of failed tests.
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Update test to check for deletion of only operation
* Allow updateEditorWithAstAndWriteToFile to clear AST
* Update src/lang/codeManager.ts
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* Weave `isDeleting` through to `deleteSelectionPromise`
* fmt
---------
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
cargo nextest run --workspace --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=2 --no-fail-fast --profile ci simulation_tests::kcl_samples 2>&1 | tee /tmp/github-actions.log
| `lengthY` | [`number`](/docs/kcl/types/number) | Draw the line this distance along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `endAbsoluteX` | [`number`](/docs/kcl/types/number) | Draw the line along the given angle until it reaches this point along the X axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| `endAbsoluteY` | [`number`](/docs/kcl/types/number) | Draw the line along the given angle until it reaches this point along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
@ -4,8 +4,12 @@ excerpt: "Converts a number from centimeters to the current default unit."
layout: manual
---
**WARNING:** This function is deprecated.
Converts a number from centimeters to the current default unit.
*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42cm`) or the `to...` conversion functions.
No matter what units the current file uses, this function will always return a number equivalent to the input in centimeters.
For example, if the current file uses inches, `fromCm(1)` will return `0.393701`. If the current file uses millimeters, `fromCm(1)` will return `10`. If the current file uses centimeters, `fromCm(1)` will return `1`.
@ -4,8 +4,12 @@ excerpt: "Converts a number from feet to the current default unit."
layout: manual
---
**WARNING:** This function is deprecated.
Converts a number from feet to the current default unit.
*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42ft`) or the `to...` conversion functions.
No matter what units the current file uses, this function will always return a number equivalent to the input in feet.
For example, if the current file uses inches, `fromFt(1)` will return `12`. If the current file uses millimeters, `fromFt(1)` will return `304.8`. If the current file uses feet, `fromFt(1)` will return `1`.
@ -4,8 +4,12 @@ excerpt: "Converts a number from inches to the current default unit."
layout: manual
---
**WARNING:** This function is deprecated.
Converts a number from inches to the current default unit.
*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42inch`) or the `to...` conversion functions.
No matter what units the current file uses, this function will always return a number equivalent to the input in inches.
For example, if the current file uses inches, `fromInches(1)` will return `1`. If the current file uses millimeters, `fromInches(1)` will return `25.4`.
@ -4,8 +4,12 @@ excerpt: "Converts a number from meters to the current default unit."
layout: manual
---
**WARNING:** This function is deprecated.
Converts a number from meters to the current default unit.
*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42m`) or the `to...` conversion functions.
No matter what units the current file uses, this function will always return a number equivalent to the input in meters.
For example, if the current file uses inches, `fromM(1)` will return `39.3701`. If the current file uses millimeters, `fromM(1)` will return `1000`. If the current file uses meters, `fromM(1)` will return `1`.
@ -4,8 +4,12 @@ excerpt: "Converts a number from yards to the current default unit."
layout: manual
---
**WARNING:** This function is deprecated.
Converts a number from yards to the current default unit.
*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42yd`) or the `to...` conversion functions.
No matter what units the current file uses, this function will always return a number equivalent to the input in yards.
For example, if the current file uses inches, `fromYd(1)` will return `36`. If the current file uses millimeters, `fromYd(1)` will return `914.4`. If the current file uses yards, `fromYd(1)` will return `1`.
| `endRadius` | [`number`](/docs/kcl/types/number) | The involute is described between two circles, end_radius is the radius of the outer circle. | Yes |
| `angle` | [`number`](/docs/kcl/types/number) | The angle to rotate the involute by. A value of zero will produce a curve with a tangent along the x-axis at the start point of the curve. | Yes |
| `reverse` | [`bool`](/docs/kcl/types/bool) | If reverse is true, the segment will start from the end of the involute, otherwise it will start from that start. Defaults to false. | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
### Returns
@ -38,11 +38,11 @@ involuteCircular(
### Examples
```js
```kcl
a = 10
b = 14
startSketchOn(XZ)
|> startProfileAt([0,0],%)
|>startProfile(at = [0, 0])
|> involuteCircular(startRadius = a, endRadius = b, angle = 60)
If `main.kcl` waits until the very end to call `makeBolt`, *none* of that work was parallelised – you’ve pushed the cost back onto the serial tail of your script.
**Better:** call it early or move the invocation into another module.
```norun
// bolt_instance.kcl
import makeBolt from "util.kcl"
bolt = makeBolt(5) // executed in parallel
bolt
```
Now `main.kcl` can `import "bolt_instance.kcl" as bolt` and get the result that was rendered while it was busy doing other things.
---
## Whole module import
You can also import the whole module. This is useful if you want to use the
result of a module as a variable, like a part.
```norun
import "tests/inputs/cube.kcl" as cube
cube
|> translate(x=10)
```
This imports the whole module and makes it available as `cube`. You can then
use it like any other object. The `cube` variable is now a reference to the
result of the module. This means that if you change the module, the `cube`
variable will change as well.
In `cube.kcl`, you cannot have multiple objects. It has to be a single part. If
you have multiple objects, you will get an error. This is because the module is
expected to return a single object that can be used as a variable.
The last expression or variable definition becomes the module's return value.
The module is expected to return a single object that can be used as a variable
by whatever imports it.
So for example, this is allowed:
```norun
... a bunch of code to create cube and cube2 ...
myUnion = union([cube, cube2])
```
You can also do this:
```norun
... a bunch of code to create cube and cube2 ...
union([cube, cube2])
```
Either way, the last line will return the union of the two objects.
Or what you could do instead is:
```norun
... a bunch of code to create cube and cube2 ...
myUnion = union([cube, cube2])
myUnion
```
This will assign the union of the two objects to a variable, and then return it
on the last statement. It's simply another way of doing the same thing.
The final statement is what's important because it's the return value of the
entire module. The module is expected to return a single object that can be used
as a variable by the file that imports it.
---
## Multiple instances of the same import
Whether you are importing a file from another CAD system or a KCL file, that
file represents object(s) in memory. If you import the same file multiple times,
it will only be rendered once.
If you want to have multiple instances of the same object, you can use the
[`clone`](/docs/kcl/clone) function. This will render a new instance of the object in memory.
```norun
import cube from "tests/inputs/cube.kcl"
cube
|> translate(x=10)
clone(cube)
|> translate(x=20)
```
In the sample above, the `cube` object is imported from a KCL file. The first
instance is translated 10 units in the x direction. The second instance is
cloned and translated 20 units in the x direction. The two instances are now
separate objects in memory, and can be manipulated independently.
Here is an example with a file from another CAD system:
```kcl
import "tests/inputs/cube.step" as cube
cube
|> translate(x=10)
clone(cube)
|> translate(x=20)
```
---
## Importing files from other CAD systems
`import` can also be used to import files from other CAD systems. The format of the statement is the
You can make the file format explicit using a format attribute (useful if using a different
extension), e.g.,
```norun
@(format = obj)
import "tests/inputs/cube"
```
For formats lacking unit data (such as STL, OBJ, or PLY files), the default
unit of measurement is millimeters. Alternatively you may specify the unit
by using an attirbute. Likewise, you can also specify a coordinate system. E.g.,
by using an attribute. Likewise, you can also specify a coordinate system. E.g.,
```norun
@(unitLength = ft, coords = opengl)
```kcl
@(lengthUnit = ft, coords = opengl)
import "tests/inputs/cube.obj"
```
@ -110,97 +311,55 @@ Coordinate systems:
-`opengl`, forward: +Z, up: +Y, handedness: right
-`vulkan`, forward: +Z, up: -Y, handedness: left
### Performance
---
Parallelized foreign-file imports now let you overlap file reads, initialization,
## Performance deep‑dive for foreign‑file imports
Parallelized foreign‑file imports now let you overlap file reads, initialization,
and rendering. To maximize throughput, you need to understand the three distinct
stages—reading, initializing (background render start), and invocation (blocking)
—and structure your code to defer blocking operations until the end.
#### Foreign Import Execution Stages
### Foreign import execution stages
1.**Import (Read) Stage**
```norun
1.**Import (Read / Initialization) Stage**
```kcl
import "tests/inputs/cube.step" as cube
```
- Reads the file from disk and makes its API available.
- **Does _not_** start Engine rendering or block your script.
```
- Reads the file from disk and makes its API available.
- Starts engine rendering but **does not block** your script.
- This kick‑starts the render pipeline while you keep executing other code.
2. **Initialization (Background Render) Stage**
```norun
2. **Invocation (Blocking) Stage**
```kcl
import "tests/inputs/cube.step" as cube
myCube = cube // <- This line starts background rendering
```
- Invoking the imported symbol (assignment or plain call) triggers Engine rendering _in the background_.
- This kick‑starts the render pipeline but doesn’t block—you can continue other work while the Engine processes the model.
cube
|> translate(z=10) // ← blocks here only
```
- Any method call (e.g., `translate`, `scale`, `rotate`) waits for the background render to finish before applying transformations.
3. **Invocation (Blocking) Stage**
```norun
import "tests/inputs/cube.step" as cube
### Best practices
myCube = cube
#### 1. Defer blocking calls
myCube
|> translate(z=10) // <- This line blocks
```
- Any method call (e.g., `translate`, `scale`, `rotate`) waits for the background render to finish before applying transformations.
- This is the only point where your script will block.
> **Nuance:** Foreign imports differ from pure KCL modules—calling the same import symbol multiple times (e.g., `screw` twice) starts background rendering twice.
#### Best Practices
##### 1. Defer Blocking Calls
Initialize early but delay all transformations until after your heavy computation:
```norun
import "tests/inputs/cube.step" as cube // 1) Read
Both calling methods right on `cube` immediately or leaving an implicit import without assignment introduce blocking.
#### 2. Split heavy work into separate modules
#### Future Improvements
Place computationally expensive or IO‑heavy work into its own module so it can render in parallel while `main.kcl` continues.
#### Future improvements
Upcoming releases will auto‑analyse dependencies and only block when truly necessary. Until then, explicit deferral will give you the best performance.
Upcoming releases will auto‑analyze dependencies and only block when truly necessary. Until then, explicit deferral and modular wrapping give you the best performance.
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.