* fix: clear scene and bust cache if rust panics
* Update onboarding following @jgomez720
* chore: hopefully made a safe navigate to kcl file to call executeAST without a race condition
* chore: hopefully made a safe navigate to kcl file to call executeAST without a race condition
* fix: clean up
* fix: FUCK
* fix: FUCK 2.0
* fix: oh boi
* fix: oh boi
* fix: idk man
* updates
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* fix: take main on this, do not need a single line from my testing code
* fix: more PR cleanup from all of the testing code
* fix: trying to clean up more, ope this has a lot of other code
* fix: PR clean up
* fix: trying to get a clean branch, I had multiple other branches in here ope
* fix: more cleanup
* fix: another one
* fix: fixed the comment to be accurate
* fix: removed confusing comment
---------
Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
Co-authored-by: Jess Frazelle <github@jessfraz.com>
Only include the file pane on desktop. This should encourage users to
try point-and-click and feature tree workflows. After #6629 is
completed, we should default to the code pane being closed.
* Change Fn to fn for function types
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Support args and return types in function types
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Use fancy function types in the docs
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Allow adding and removing commands from any command bar state
* Allow commands to be configured disabled in the combobox
* Set up modeling commands to toggle `disabled` based on network status, instead of filtering
* Fix tsc
**Problem:**
KCL's xLine and yLine functions were telling users to supply either "end" or "endAbsolute" arguments. But "end" is not a valid argument for xLine/yLine, it's actually "length" instead.
**Cause:**
xLine/yLine were using a helper function designed for `line` KCL stdlib functions, which do use `end`.
**Solution**
Add a new param to the helper function, indicating what the label should be for relative lines. "end" for `line` calls, `length` for x/yline
* Move the leg functions to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move array functions to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move clone to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Add a function type
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* fix going into rename mode for files with parents
* lastDirectoryClicked is not used
* fix file/folder rename bugs: renaming within folders
* Turn form into div to fix issue of child renaming continues into renaming the parent folder when hitting enter
* ContextMenu stopPropagation not needed anymore, maybe because of form refactor
* ContextMenu IS needed actually, with multiple nested folders
* make lint happy
* Update src/components/ContextMenu.tsx
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
* re-add <form> instead of <div> for file renaming
---------
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* pierremtb/adhoc/clean-up-nightly-on-merge
* To revert: test to upload builds at test/nightly
* Remove + suffix trim that's not needed anymore
* Revert "To revert: test to upload builds at test/nightly"
This reverts commit b0549d426f.
* Fix bug with `undo startSketchOn` removing existing sketch
Fixes#6822, I believe. in this case the `variableName` was not being
marked as in-use, so I just logged out the AST and made sure this case
was covered. @Irev-Dev this is probably worth a check from you.
* Add a regression test
It's an E2E test because I'm being lazy, but it should probably be an
XState unit test at some point.
* check what's checked
---------
Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
* Treat number as any rather than default
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Don't square root negative numbers
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Add sim test for any type
* Fix doc comments to match code
* Add array ascription tests
* Commit new test output
* Fix to not panic when type is undefined
* Fix to not panic on use of the any type
* Update test and generated output
* Fix error message after rebase
* Fix subtype of any
* Fix KCL to use new keyword args
* Fix to not nest MixedArray in HomArray
* Update output
* Remove all creation of MixedArray and use HomArray instead
* Rename MixedArray to Tuple
* Fix to coerce arrays the way tuples are done
* Restructure to appease the type signature extraction
* Fix TS unit test
* Update output after switch to HomArray
* Update docs
* Fix to remove edge case when creating points
* Update docs with broken point signature
* Fix display of tuples to not collide with arrays
* Change push to an array with type mismatch to be an error
* Add sim test for push type error
* Fix acription to more general array element type
* Fix to coerce point types
* Change array push to not error when item type differs
* Fix coercion tests
* Change to only flatten as a last resort and remove flattening tuples
* Contort code to appease doc generation
* Update docs
* Fix coerce axes
* Fix flattening test to test arrays instead of tuples
* Remove special subtype case for singleton coercion
* Document the units of PI
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Add links between lang and std references
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Change signature of conversion functions
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Split foreign imports out of modules docs
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* More docs for Plane
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Update docs/kcl-std/consts/std-math-PI.md
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
* Update rust/kcl-lib/std/math.kcl
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
* Add documentation to modules, and some constants and types
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Improve the language reference
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Hide "Allow orbit in sketch mode" setting from the app
The ability to orbit while in sketch mode is not well-tested or
well-used, so we should pull it from the app. The easiest way to do that
is leave the setting in the WASM definition, but configure the setting
to be uneditable from the interface.
* pierremtb/adhoc/force-idle-stream-and-hide
---------
Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
Co-authored-by: Frank Noirot <frank@zoo.dev>
* oops, make it nicer for no reason
* tests
* deleteTopLevelStatement
* little swap
* astMod edits
* typos
* add playwright test for chamfers
* scene.settled instead of page.waitForTimeout
* unfuck circular dep - move locateExtrudeDeclarator
* locateExtrudeDeclarator > locateVariableWithCallOrPipe
* fmt
* edit the comment
* constrain profile start
* add test
* make sure it works on segment drag too, fix tests
* remove old log
* some tests fixes
* Bump more segment counters
* Two more fixes
* Two more test fixes
* small test fix
* moretest fixes
* another test
---------
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
The ability to orbit while in sketch mode is not well-tested or
well-used, so we should pull it from the app. The easiest way to do that
is leave the setting in the WASM definition, but configure the setting
to be uneditable from the interface.
* Remove gnarly fake union hotkeys
* Enable hotkey for items buried in ActionButtonDropdown
I'm kinda over `useHotkeys` as a hook
* Add hotkeys for other sketch tools
* Fix lint and tsc
* Fix duplicate locator
* The circular dependecies got reordered somehow
* Update src/lib/toolbar.ts
* Add `cursor-not-allowed` to onboarding backdrops that block clicks
Some follow-up feedback after #6714 from @jacebrowning, so that users
know why they can't click around.
* Make anything in the onboarding card `cursor-auto`
* Remove snapshottoken
Fixes#6800
* Add placeholder in .env.development
* Clean up language
* Update CONTRIBUTING.md
Co-authored-by: Jace Browning <jacebrowning@gmail.com>
* Add dotenv to secrets for local testing
* Lint
* Reorg things
* Quick fix
* Last one for windows
---------
Co-authored-by: Jace Browning <jacebrowning@gmail.com>
* 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
* Update `OnboardingStatus` type on WASM side
* Make onboarding different on browser and web, placeholder component
* Show proof of concept with custom content per route
* Make text type args not insta dismiss when you click anywhere
* Make some utility hooks for the onboarding
* Update requestedProjectName along with requestedProjectName
* Build out a rough draft of desktop onboarding
* Remove unused onboarding route files
* Build out rough draft of browser onboarding content
* @jgomez720 browser flow feedback
* @jgomez420 desktop feedback
* tsc and lints
* Tweaks
* Import is dead, long live Add files
* What's up with my inability to type "highlight"?
* Codespell and String casting
* Update browser sample to be axial fan
* lint and tsc
* codespell again
* Remove unused nightmare function `useDemoCode`
* Add a few unit tests
* Update desktop to use bulk file creation from #6747
* Oops overwrote main.kcl on the modify with text-to-cad step
* Undo the dumb use of `sep` that I introduced
* Fix up project test
which was fragile to the number of steps in the onboarding smh
* Fix up onboarding flow test
* typo
---------
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Kevin Nadro <kevin@zoo.dev>
* fix: how?
* fix: 0 byte thumbnail png loading bug
* fix: adding navigate to single file back
* fix: cargo fmt
* fix: sorting files to match manifest and unit test
* fix: restoring back to main
* fix: cargo fmt
* fix: ope, I forgot I deleted some code that renamed single files to the samples name to track easier within the file tree
* fix: ope
* Update src/lib/commandBarConfigs/applicationCommandConfig.ts
Co-authored-by: Frank Noirot <frank@zoo.dev>
* fix: unique name for project, ope
* fix: filtered samples for web and skeleton create a sample command
* fix: Create A Sample specifically desktop home page instead of overloading the add to file
* fix: hiding source
* fix: gotcha on add to file with existing project default args and assemblies
---------
Co-authored-by: Frank Noirot <frank@zoo.dev>
* Change array functions to call user function with keyword args
* Fix KCL to use keyword params
* Remove unneeded positional call code
* Update docs
* Update output
* Fix trackball camera by weaving through EngineStream
Fixes#6472. Just a missing setting moved in #5312, which wasn't caught
because testing that the orbit maneuver is actually performing a
"trackball-like" movement is nonexistent. I don't know how to test that
reliably, but typing this object provides the red squiggles to reveal
the missing property.
* Update src/components/EngineStream.tsx
---------
Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
Breaking changes:
- Fully removed positional arguments from function calls. Keyword arguments are now the only way to call a function.
Added:
- Warn on usage of the unknown numeric suffix (#6690)
Fixed:
- Fix units bug with involuteCircular (#6711)
- Importing 3D files on Windows (#6697)
* Fix various docs errors around std module
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* remove KCL from lang docs titles and move settings docs
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Include functions declared in Rust in module docs
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* start of migrate to multi file endpoint
* get some relative path stuff sorted
* blobifying files, and making selections work with imports working
* add write to disk
* warn about big projects
* update known circular
* update snapshot
* remove log
* tweak selection filters
* Update src/components/ModelingMachineProvider.tsx
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
* fmt
* fix one thing
* typo
* raw dog form data like a fucking peasant
* remove fake data
* fmt
* steal Kevin's stuff
* good progress
* clean up
* fix writing to files when response returns
* comment the terriable code
* push fix of sorts
* better fix
* spot of clean up
* fix: Needed to support the bad request flow, the toast will hang forever, the return control flows don't dismiss a forever toast
* fix: handling more error flows by dismissing the toast
* chore: leaving a comment for a confusing workflow
* fix: trying to clean up some async logic
* fix: trying to fix a few things at once...
* fix: fixing toast success
* fix: how did this desync?
* fix: removing useless logic, we write to disk ahead of time, the continue is to say ya no problem
* fix: typo
* Change back to `spawnChild`, forego `actors` by reference
* fix: updating PR comments
* fix: found a bug with paths from rust! it is actually OS paths!
* fix: updated type still is failing tsc
* fix: the type of the machine was wrong, we always set it to at least ''
* fix: idk man
* Fix happy path test (button labels)
---------
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Kevin Nadro <kevin@zoo.dev>
Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
Co-authored-by: Kevin Nadro <nadr0@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
* put xy back into default plane feature tree
* color code
* Update src/components/ModelingSidebar/ModelingPanes/FeatureTreePane.tsx
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>
* 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
* 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
* 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>
* 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>
* 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
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.
* 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>
* 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
* 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
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.
* 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>
* 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>
* Add error to console exception
* Ignore in codespell
* Increase retry on snapshots
* Fixme's all around
---------
Co-authored-by: Jace Browning <jacebrowning@gmail.com>
Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
* Add fixmes to bad snapshots tests
* max attempts to 5 on snapshots
* Skip revolve on windows
* Another one
* Add fixme to edit with ML snapshot test
* fmt
* Use absolute import, fix lint
* Disable another test
---------
Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
* Remove all use of bold mono font
A few mono font points are left, mostly for numbers which look better in
monospace.
* make React happy with `clipRule`
* WIP: Add point-and-click Import for geometry
Will eventually fix#6120
Right now the whole loop is there but the codemod doesn't work yet
* Better pathToNOde, log on non-working cm dispatch call
* Add workaround to updateModelingState not working
* Back to updateModelingState with a skip flag
* Better todo
* Change working from Import to Insert, cleanups
* Sister command in kclCommands to populate file options
* Improve path selector
* Unsure: move importAstMod to kclCommands onSubmit 😶
* Add e2e test
* Clean up for review
* Add native file menu entry and test
* No await yo lint said so
* WIP: UX improvements around foreign file imports
Fixes#6152
* WIP: Set translate and rotate via point-and-click on imports. Boilerplate code
Will eventually close#6020
* Full working loop of rotate and translate pipe mutation, including edits, only on module imports. VERY VERBOSE
* Add first e2e test for set transform. Bunch of caveats listed as TODOs
* @lrev-Dev's suggestion to remove a comment
Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
* Update to scene.settled(cmdBar)
* Add partNNN default name for alias
* Lint
* Lint
* Fix unit tests
* Add sad path insert test
Thanks @Irev-Dev for the suggestion
* Add step insert test
* Lint
* Add test for second foreign import thru file tree click
* WIP: Add point-and-click Load to copy files from outside the project into the project
Towards #6210
* Move Insert button to modeling toolbar, update menus and toolbars
* Add default value for local name alias
* Aligning tests
* Fix tests
* Add padding for filenames starting with a digit
* Lint
* Lint
* Update snapshots
* Merge branch 'main' into pierremtb/issue6210-Add-point-and-click-Load-to-copy-files-from-outside-the-project-into-the-project
* Add disabled transform subbutton
* Allow start of Transform flow from toolbar with selection
* Merge kcl-samples and local disk load into one 'Load external model' command
* Fix em tests
* Fix test
* Add test for file pick import, better input
* Fix non .kcl loading
* Lint
* Update snapshots
* Fix issue leading to test failure
* Fix clone test
* Add note
* Fix nested clone issue
* Clean up for review
* Add valueSummary for path
* Fix test after path change
* Clean up for review
* Support much wider range for transform
* Set display names
* Bug fixed itself moment...
* Add test for extrude tranform
* Oops missed a thing
* Clean up selection arg
* More tests incl for variable stuff
* Fix imports
* Add supportsTransform: true on all solids returning operations
* Fix edit flow on variables, add test
* Split transform command into translate and rotate
* Clean up and comment
* Clean up operations.ts
* Add comment
* Improve assemblies test
* Support more things
* Typo
* Fix test after unit change on import
* Last clean up for review
* Fix remaining test
---------
Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
* Use the engineStreamState that's available right there silly
* fix lint
* Just look at playing/paused
---------
Co-authored-by: Jace Browning <jacebrowning@gmail.com>
* Fix so that just commands regenerate ast output
* Update just command to include manifest
* Fix overwrite-sim-test kcl_samples to generate manifest
This is the command used in CI.
* wip
* sketch a bit more; going to pull this out of tests next
* wip
* lock start things
* this was a bad idea
* Revert "this was a bad idea"
This reverts commit a2092e7ed6.
* prepare prelude before spawning
* error
* poop
* yike
* :(
* ok
* Reapply "this was a bad idea"
This reverts commit fafdf41093.
* chip away more
* man this is bad
* fix rebase add feature flag
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* get rid of execution kind
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* clippy
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* logs
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* updates
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* no extra executes
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* race w batch
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* cluppy
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* no printlns
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* no printlns
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* fix source ranges
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* batch shit
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* fixes
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* updates
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* fix
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* fix some bugs
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* fix error
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* cut 1
* preserve mem
* re-ad deep_clone
the helper we were calling was pushing a new call, which was hanging
out. we can skip the middleman since we already have something properly
prepared, just without a stdlib in some cases.
* skip non-kcl
* clean up source range bug
* error message changed
the uuids also changed because the error is hit before execute even
starts.
* typo
* rensnapshot a few
* order things
* MAYBE REVERT LATER:
attempt at an ordering
* snapsnap
* Revert "snapsnap"
This reverts commit 7350b32c7d.
* Revert "MAYBE REVERT LATER:"
This reverts commit ab49f3e85f.
* ugh
* poop
* poop2
* lint
* tranche 1
* more
* more snaps
* snap
* more
* update
* MAYBE REVERT THIS
* cache multi-file
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* addd tests
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* set to false
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* add test outputs
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* clippy
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* kcl-py-bindings uses carwheel
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* update snapshots
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>
Co-authored-by: Paul R. Tagliamonte <paul@zoo.dev>
Co-authored-by: Paul Tagliamonte <paultag@gmail.com>
Previously, KCL would silently ignore any duplicated keyword args, setting the parameter to one arbitrarily-chosen argument. Now this is instead a parse error.
I've tested that
1. The error message makes sense
2. The error is on a reasonable part of the source code
3. The error doesn't prevent other kinds of parse errors being picked up later
Thanks for noticing this one Frank!
The engine fixed the start angle for helices, but our e2e test has a
pixel check so it broke. I made the test change the `startAngle` by
`-90` rather than try to hunt around for a new working pixel value.
* Switch to a 6-core profile for mac
* Bump workers percentage to optimize for CPU count (#6329)
* Bump macOS workers percentage to optimize for CPU count
* Handle floor math
---------
Co-authored-by: Jace Browning <jacebrowning@gmail.com>
* maybe use biome
* import organising
* Removed unused new fmt commands; fix to not use linter
* Don't use fmt:generated - fmt is fast, but also use Makefile for this sort of thing
---------
Co-authored-by: lee-at-zoo-corp <lee@zoo.dev>
* use artifact id for sketch mode entry plane
* fix up re-eval as best as possible
* remove some async dodgyness
* fmt
* fix old sycronous re-execute shit
* add a test
* fix existing test
* add toast for error state
* spelling
* test stuff
* fmt
* fix toast
* test fix
* some other fix ups
* fix test
* KCL: Convert angledLineThatIntersects to use kwargs
* Update KCL tests and samples
* WIP
* Fix tsc and lint errors
* Fix missing cases
* Fix modifyAst unit tests
* Fix sketch unit tests
* Fix std unit tests
* Fix to not have extra docs
* Fix more unit tests
* Fix bench test
* Fix e2e tests to use new kw args
* tiny lint
* Fix adding constraint from UI to work
* Fix to use labeledArg constraints and use the correct order of args
* Fix selections e2e test
* Fix e2e test expectation
App was working as expected, but the e2e test was
expecting the old code, not the new code.
* Fix order of constraints in unit test
* Update docs
* Fix KCL formatting
* Update output
---------
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* first draft of making segment snap to previous arc's last tangent
* ability to force/disable line snap, threshold in screen space
* mouseEvent refactor tsc errors fixed
* cleanups, extract getTanPreviousPoint function
* add snap line support when previous segment is ARC
* small cleanups
* remove unused planeNodePath param from onDragSegment
* renaming
* Enable snapping when placing the segment point in onClick
* refactor getSnappedDragPoint to include axis intersection
* handle snapping to both axis and tangent direction
* snap refinements
* small cleanups
* lint
* A snapshot a day keeps the bugs away! 📷🐛
* A snapshot a day keeps the bugs away! 📷🐛
* A snapshot a day keeps the bugs away! 📷🐛
* A snapshot a day keeps the bugs away! 📷🐛
* A snapshot a day keeps the bugs away! 📷🐛
* A snapshot a day keeps the bugs away! 📷🐛
* A snapshot a day keeps the bugs away! 📷🐛
* A snapshot a day keeps the bugs away! 📷🐛
* A snapshot a day keeps the bugs away! 📷🐛
* generate tag for previous arc when snapping current straight segment
* using previous arc's tag in snapped angledLine
* angledLine uses object instead of array now
* use more general snap object instead
* snap tangent line visualized when snapping occurs
* remove unused scale param from createLine
* prettier
* fix bug where segment body is not drawn
* fix generated kcl error introduced in merge from main - modifiedAst needs to be passed to addNewSketchLn
* add support for snapping to negative tangent direction
* fix findTangentDirection for THREE_POINT_ARC_SEGMENT
* fix tsc error by introducing overrideExpr
* fix missing ccw for 3 point arc, fix tan_previous_point calculation for 3 point arcs
* resolve clippy until confirmation for circle radius
* fix runtime error when drawing a 3 point arc
* add unit tests to closestPointoOnRay
* unrelated react warning fixed
* add playwright test for tangent snapping
* better fix for tan_previous_point
* fix lint
* add simulation test for tangent_to_3_point_arc
* Fix simulation test output
* Add missing simulation test output files
* fix tangent snapping bug: use current group instead of last group in activeSegments
* make testcombos.test happy
* cleanup merge
* fix merge mistake, tsc error
* update tangent_to_3_point_arc simulation test
* fix angledLine related breaking tests
* minimum distance added before snapping to tangent
* circle is always ccw regardless of the order of points for tangential info calculation
* fix snapping when different unit is used other than mm
* update test: Straight line snapping to previous tangent
* update rust snapshot test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Frank Noirot <frank@zoo.dev>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* WIP: Add point-and-click Import for geometry
Will eventually fix#6120
Right now the whole loop is there but the codemod doesn't work yet
* Better pathToNOde, log on non-working cm dispatch call
* Add workaround to updateModelingState not working
* Back to updateModelingState with a skip flag
* Better todo
* Change working from Import to Insert, cleanups
* Sister command in kclCommands to populate file options
* Improve path selector
* Unsure: move importAstMod to kclCommands onSubmit 😶
* Add e2e test
* Clean up for review
* Add native file menu entry and test
* No await yo lint said so
* WIP: UX improvements around foreign file imports
Fixes#6152
* @lrev-Dev's suggestion to remove a comment
Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
* Update to scene.settled(cmdBar)
* Add partNNN default name for alias
* Lint
* Lint
* Fix unit tests
* Add sad path insert test
Thanks @Irev-Dev for the suggestion
* Add step insert test
* Lint
* Add test for second foreign import thru file tree click
* WIP: Add point-and-click Load to copy files from outside the project into the project
Towards #6210
* Move Insert button to modeling toolbar, update menus and toolbars
* Add default value for local name alias
* Aligning tests
* Fix tests
* Add padding for filenames starting with a digit
* Lint
* Lint
* Update snapshots
* Merge branch 'main' into pierremtb/issue6210-Add-point-and-click-Load-to-copy-files-from-outside-the-project-into-the-project
* Add disabled transform subbutton
* Merge kcl-samples and local disk load into one 'Load external model' command
* Fix em tests
* Fix test
* Add test for file pick import, better input
* Fix non .kcl loading
* Lint
* Update snapshots
* Fix issue leading to test failure
* Fix clone test
* Add note
* Fix nested clone issue
* Clean up for review
* Add valueSummary for path
* Fix test after path change
* Clean up for review
* Update src/lib/kclCommands.ts
Thanks @franknoirot!
Co-authored-by: Frank Noirot <frank@zoo.dev>
* Improve path input arg
* Fix tests
* Merge branch 'main' into pierremtb/issue6210-Add-point-and-click-Load-to-copy-files-from-outside-the-project-into-the-project
* Fix path header not showing and improve tests
* Clean up
---------
Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
Co-authored-by: Frank Noirot <frank@zoo.dev>
* Add an engine error type for an "outage"
* Add a loading spinner back to the stream just for engine connection
* Refactor Loading spinner to account for early errors
* Add styling and state logic for unrecoverable errors in Loading
* Let engine error messages contain markdown
* Clarify 'too many connections' error message
* Add a "VeryLongLoadTime" error that suggests checking firewall
* Give the engine connection spinner a test ID and use it
* Use a dropdown for stream idle setting
* Add support for undefined values in dropdowns
* Move cache bust to the beginning of engine open for reconnections
* yarn tsc
* Don't setup model feature highlighters until the connection is ready
* Wait 2s to give engine time to serve video, then listen for modeling commands
* Undo teardown
* yarn fmt
* Fix circular module dependency; fmt & lint & tsc
* Fix editor-test waiting for 2 instead of 1
* Increment another 2 numbers ...
---------
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* More units of measure work
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Update CSG output since engine change
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: Nick Cameron <nrc@ncameron.org>
The connection can't be bad if there is not yet `:galaxy-brain:`.
But seriously this behavior regressed share links because we would bail
from the command palette because the connection wasn't healthy.
* initPromise in main.ts
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* move initPromise so dep tree doesnt shit the bed
Signed-off-by: Jess Frazelle <github@jessfraz.com>
---------
Signed-off-by: Jess Frazelle <github@jessfraz.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=10 --no-fail-fast --profile ci simulation_tests::kcl_samples 2>&1 | tee /tmp/github-actions.log
Install a node version manager such as [fnm](https://github.com/Schniz/fnm?tab=readme-ov-#installation).
On Windows, it's also recommended to [upgrade your PowerShell version](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.5#winget), we're using 7.
Then in the repo run the following to install and use the node version specified in `.nvmrc`. You might need to specify your processor architecture with `--arch arm64` or `--arch x64` if it's not autodetected.
```
fnm install --corepack-enabled
fnm use
```
Install the NPM dependencies with:
```
npm install
```
This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We have package scripts to run rustup, see `package.json` for reference:
```
# macOS/Linux
npm run install:rust
npm run install:wasm-pack:sh
# Windows
npm run install:rust:windows
npm run install:wasm-pack:cargo
```
Then to build the WASM layer, run:
```
# macOS/Linux
npm run build:wasm
# Windows
npm run build:wasm:windows
```
Or if you have the `gh` cli installed and want to download the latest main wasm bundle. Note that on Windows, you need to associate .ps1 files with PowerShell, which can be done via the right click menu, selecting `C:\Program Files\PowerShell\7\pwsh.exe`, and you can install tools like `gh` via `npm run install:tools:windows`.
```
# macOS/Linux
npm run fetch:wasm
# Windows
npm run fetch:wasm:windows
```
That will build the WASM binary and put in the `public` dir (though gitignored).
Finally, to run the web app only, run:
```
npm start
```
If you're not a Zoo employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development.local` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to `localhost:3000` again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again.
### Development environment variables
The Copilot LSP plugin in the editor requires a Zoo API token to run. In production, we authenticate this with a token via cookie in the browser and device auth token in the desktop environment, but this token is inaccessible in the dev browser version because the cookie is considered "cross-site" (from `localhost` to `zoo.dev`). There is an optional environment variable called `VITE_KC_DEV_TOKEN` that you can populate with a dev token in a `.env.development.local` file to not check it into Git, which will use that token instead of other methods for the LSP service.
### Developing in Chrome
Chrome is in the process of rolling out a new default which
If you're having trouble logging into the `modeling-app`, you may need to
enable third-party cookies. You can enable third-party cookies by clicking on
the eye with a slash through it in the URL bar, and clicking on "Enable
Third-Party Cookies".
## Desktop
To spin up the desktop app, `npm install` and `npm run build:wasm` need to have been done before hand then:
```
npm run tron:start
```
This will start the application and hot-reload on changes.
Devtools can be opened with the usual Command-Option-I (macOS) or Ctrl-Shift-I (Linux and Windows).
To package the app for your platform with electron-builder, run `npm run tronb:package:dev` (or `npm run tronb:package:prod` to point to the .env.production variables).
## Checking out commits / Bisecting
Which commands from setup are one off vs. need to be run every time?
The following will need to be run when checking out a new commit and guarantees the build is not stale:
```bash
npm install
npm run build:wasm
npm start
```
## Before submitting a PR
Before you submit a contribution PR to this repo, please ensure that:
- There is a corresponding issue for the changes you want to make, so that discussion of approach can be had before work begins.
- You have separated out refactoring commits from feature commits as much as possible
- You have run all of the following commands locally:
-`npm run fmt`
-`npm run tsc`
-`npm run test`
- Here they are all together: `npm run fmt && npm run tsc && npm run test`
## Release a new version
#### 1. Create a 'Cut release $VERSION' issue
It will be used to document changelog discussions and release testing.
Create a new tag and push it to the repo. The `semantic-release.sh` script will automatically bump the minor part, which we use the most. For instance going from `v0.27.0` to `v0.28.0`.
```
VERSION=$(./scripts/semantic-release.sh)
git tag $VERSION
git push origin --tags
```
This will trigger the `build-apps` workflow, set the version, build & sign the apps, and generate release files as well as updater-test artifacts.
The workflow should be listed right away [in this list](https://github.com/KittyCAD/modeling-app/actions/workflows/build-apps.yml?query=event%3Apush)).
#### 3. Manually test artifacts
##### Release builds
The release builds can be found under the `out-{arch}-{platform}` zip files, at the very bottom of the `build-apps` summary page for the workflow (triggered by the tag in 2.).
Manually test against this [list](https://github.com/KittyCAD/modeling-app/issues/3588) across Windows, MacOS, Linux and posting results as comments in the issue.
##### Updater-test builds
The other `build-apps` output in the release `build-apps` workflow (triggered by 2.) is `updater-test-{arch}-{platform}`. It's a semi-automated process: for macOS, Windows, and Linux, download the corresponding updater-test artifact file, install the app, run it, expect an updater prompt to a dummy v0.255.255, install it and check that the app comes back at that version.
The only difference with these builds is that they point to a different update location on the release bucket, with this dummy v0.255.255 always available. This helps ensuring that the version we release will be able to update to the next one available.
If the prompt doesn't show up, start the app in command line to grab the electron-updater logs. This is likely an issue with the current build that needs addressing (or the updater-test location in the storage bucket).
Head over to https://github.com/KittyCAD/modeling-app/releases/new, pick the newly created tag and type it in the _Release title_ field as well.
Hit _Generate release notes_ as a starting point to discuss the changelog in the issue. Once done, make sure _Set as the latest release_ is checked, and hit _Publish release_.
A new `publish-apps-release` will kick in and you should be able to find it [here](https://github.com/KittyCAD/modeling-app/actions?query=event%3Arelease). On success, the files will be uploaded to the public bucket as well as to the GitHub release, and the announcement on Discord will be sent.
#### 5. Close the issue
If everything is well and the release is out to the public, the issue tracking the release shall be closed.
- Set $token from https://zoo.dev/account/api-tokens
#### Snapshot tests (Google Chrome on Ubuntu only)
Only Ubunu and Google Chrome is supported for the set of tests evaluating screenshot snapshots.
If you don't run Ubuntu locally or in a VM, you may use a GitHub Codespace.
```
npm run playwright -- install chrome
npm run test:snapshots
```
You may use `-- --update-snapshots` as needed.
#### Electron flow tests (Chromium on Ubuntu, macOS, Windows)
```
npm run playwright -- install chromium
npm run test:playwright:electron:local
```
You may use `-- -g "my test"` to match specific test titles, or `-- path/to/file.spec.ts` for a test file.
#### Debugger
However, if you want a debugger I recommend using VSCode and the `playwright` extension, as the above command is a cruder debugger that steps into every function call which is annoying.
With the extension you can set a breakpoint after `waitForDefaultPlanesVisibilityChange` in order to skip app loading, then the vscode debugger's "step over" is much better for being able to stay at the right level of abstraction as you debug the code.
If you want to limit to a single browser use `--project="webkit"` or `firefox`, `Google Chrome`
Or comment out browsers in `playwright.config.ts`.
note chromium has encoder compat issues which is why were testing against the branded 'Google Chrome'
You may consider using the VSCode extension, it's useful for running individual threads, but some some reason the "record a test" is locked to chromium with we can't use. A work around is to us the CI `npm run playwright codegen -b wk --load-storage ./store localhost:3000`
However because much of our tests involve clicking in the stream at specific locations, it's code-gen looks `await page.locator('video').click();` when really we need to use a pixel coord, so I think it's of limited use.
### Unit and component tests
If you already haven't, run the following:
```
npm
npm run build:wasm
npm start
```
and finally:
```
npm run test:unit
```
For individual testing:
```
npm run test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false
```
Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro) tests, in interactive mode by default.
### Rust tests
Prepare these system dependencies:
- Set `$KITTYCAD_API_TOKEN` from https://zoo.dev/account/api-tokens
- Install `just` following [these instructions](https://just.systems/man/en/packages.html)
then run tests that target the KCL language:
```
npm run test:rust
```
### Logging
To display logging (to the terminal or console) set `ZOO_LOG=1`. This will log some warnings and simple performance metrics. To view these in test runs, use `-- --nocapture`.
To enable memory metrics, build with `--features dhat-heap`.
A CAD application from the future, brought to you by the [Zoo team](https://zoo.dev).
@ -23,7 +23,7 @@ Design Studio is a _hybrid_ user interface for CAD modeling. You can point-and-c
The 3D view in Design Studio is just a video stream from our hosted geometry engine. The app sends new modeling commands to the engine via WebSockets, which returns back video frames of the view within the engine.
## Tools
## Technology
- UI
- [React](https://react.dev/)
@ -38,471 +38,16 @@ The 3D view in Design Studio is just a video stream from our hosted geometry eng
We recommend downloading the latest application binary from our [releases](https://github.com/KittyCAD/modeling-app/releases) page. If you don't see your platform or architecture supported there, please file an issue.
## Get started
If you'd like to try out upcoming changes sooner, you can also download those from our [nightly releases](https://zoo.dev/modeling-app/download/nightly) page.
We recommend downloading the latest application binary from [our Releases page](https://github.com/KittyCAD/modeling-app/releases). If you don't see your platform or architecture supported there, please file an issue.
## Developing
## Running a development build
Install a node version manager such as [fnm](https://github.com/Schniz/fnm?tab=readme-ov-#installation).
On Windows, it's also recommended to [upgrade your PowerShell version](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.5#winget), we're using 7.
Then in the repo run the following to install and use the node version specified in `.nvmrc`. You might need to specify your processor architecture with `--arch arm64` or `--arch x64` if it's not autodetected.
```
fnm install --corepack-enabled
fnm use
```
Install the NPM dependencies with:
```
yarn install
```
This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We have package scripts to run rustup, see `package.json` for reference:
```
# macOS/Linux
yarn install:rust
yarn install:wasm-pack:sh
# Windows
yarn install:rust:windows
yarn install:wasm-pack:cargo
```
Then to build the WASM layer, run:
```
# macOS/Linux
yarn build:wasm
# Windows
yarn build:wasm:windows
```
Or if you have the `gh` cli installed and want to download the latest main wasm bundle. Note that on Windows, you need to associate .ps1 files with PowerShell, which can be done via the right click menu, selecting `C:\Program Files\PowerShell\7\pwsh.exe`, and you can install tools like `gh` via `yarn install:tools:windows`.
```
# macOS/Linux
yarn fetch:wasm
# Windows
yarn fetch:wasm:windows
```
That will build the WASM binary and put in the `public` dir (though gitignored).
Finally, to run the web app only, run:
```
yarn start
```
If you're not a Zoo employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development.local` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to `localhost:3000` again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again.
### Development environment variables
The Copilot LSP plugin in the editor requires a Zoo API token to run. In production, we authenticate this with a token via cookie in the browser and device auth token in the desktop environment, but this token is inaccessible in the dev browser version because the cookie is considered "cross-site" (from `localhost` to `dev.zoo.dev`). There is an optional environment variable called `VITE_KC_DEV_TOKEN` that you can populate with a dev token in a `.env.development.local` file to not check it into Git, which will use that token instead of other methods for the LSP service.
### Developing in Chrome
Chrome is in the process of rolling out a new default which
If you're having trouble logging into the `modeling-app`, you may need to
enable third-party cookies. You can enable third-party cookies by clicking on
the eye with a slash through it in the URL bar, and clicking on "Enable
Third-Party Cookies".
## Desktop
To spin up the desktop app, `yarn install` and `yarn build:wasm` need to have been done before hand then:
```
yarn tron:start
```
This will start the application and hot-reload on changes.
Devtools can be opened with the usual Command-Option-I (macOS) or Ctrl-Shift-I (Linux and Windows).
To package the app for your platform with electron-builder, run `yarn tronb:package:dev` (or `yarn tronb:package:prod` to point to the .env.production variables).
## Checking out commits / Bisecting
Which commands from setup are one off vs. need to be run every time?
The following will need to be run when checking out a new commit and guarantees the build is not stale:
```bash
yarn install
yarn build:wasm
yarn start # or yarn build:local && yarn serve for slower but more production-like build
```
## Before submitting a PR
Before you submit a contribution PR to this repo, please ensure that:
- There is a corresponding issue for the changes you want to make, so that discussion of approach can be had before work begins.
- You have separated out refactoring commits from feature commits as much as possible
- You have run all of the following commands locally:
-`yarn fmt`
-`yarn tsc`
-`yarn test`
- Here they are all together: `yarn fmt && yarn tsc && yarn test`
## Release a new version
#### 1. Create a 'Cut release $VERSION' issue
It will be used to document changelog discussions and release testing.
Create a new tag and push it to the repo. The `semantic-release.sh` script will automatically bump the minor part, which we use the most. For instance going from `v0.27.0` to `v0.28.0`.
```
VERSION=$(./scripts/semantic-release.sh)
git tag $VERSION
git push origin --tags
```
This will trigger the `build-apps` workflow, set the version, build & sign the apps, and generate release files as well as updater-test artifacts.
The workflow should be listed right away [in this list](https://github.com/KittyCAD/modeling-app/actions/workflows/build-apps.yml?query=event%3Apush)).
#### 3. Manually test artifacts
##### Release builds
The release builds can be found under the `out-{arch}-{platform}` zip files, at the very bottom of the `build-apps` summary page for the workflow (triggered by the tag in 2.).
Manually test against this [list](https://github.com/KittyCAD/modeling-app/issues/3588) across Windows, MacOS, Linux and posting results as comments in the issue.
##### Updater-test builds
The other `build-apps` output in the release `build-apps` workflow (triggered by 2.) is `updater-test-{arch}-{platform}`. It's a semi-automated process: for macOS, Windows, and Linux, download the corresponding updater-test artifact file, install the app, run it, expect an updater prompt to a dummy v0.255.255, install it and check that the app comes back at that version.
The only difference with these builds is that they point to a different update location on the release bucket, with this dummy v0.255.255 always available. This helps ensuring that the version we release will be able to update to the next one available.
If the prompt doesn't show up, start the app in command line to grab the electron-updater logs. This is likely an issue with the current build that needs addressing (or the updater-test location in the storage bucket).
Head over to https://github.com/KittyCAD/modeling-app/releases/new, pick the newly created tag and type it in the _Release title_ field as well.
Hit _Generate release notes_ as a starting point to discuss the changelog in the issue. Once done, make sure _Set as the latest release_ is checked, and hit _Publish release_.
A new `publish-apps-release` will kick in and you should be able to find it [here](https://github.com/KittyCAD/modeling-app/actions?query=event%3Arelease). On success, the files will be uploaded to the public bucket as well as to the GitHub release, and the announcement on Discord will be sent.
#### 5. Close the issue
If everything is well and the release is out to the public, the issue tracking the release shall be closed.
You will need a `./e2e/playwright/playwright-secrets.env` file:
```bash
$ touch ./e2e/playwright/playwright-secrets.env
$ cat ./e2e/playwright/playwright-secrets.env
token=<dev.zoo.dev/account/api-tokens>
snapshottoken=<your-snapshot-token>
```
For a portable way to run Playwright you'll need Docker.
#### Generic example
After that, open a terminal and run:
```bash
docker run --network host --rm --init -it playwright/chrome:playwright-x.xx.x
```
and in another terminal, run:
```bash
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" <test suite>
```
#### Specific example
open a terminal and run:
```bash
docker run --network host --rm --init -it playwright/chrome:playwright-1.46.0
```
and in another terminal, run:
```bash
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" e2e/playwright/command-bar-tests.spec.ts
```
run a specific test change the test from `test('...` to `test.only('...`
(note if you commit this, the tests will instantly fail without running any of the tests)
**Gotcha**: running the docker container with a mismatched image against your `./node_modules/playwright` will cause a failure. Make sure the versions are matched and up to date.
run headed
```
yarn playwright test --headed
```
run with step through debugger
```
PWDEBUG=1 yarn playwright test
```
However, if you want a debugger I recommend using VSCode and the `playwright` extension, as the above command is a cruder debugger that steps into every function call which is annoying.
With the extension you can set a breakpoint after `waitForDefaultPlanesVisibilityChange` in order to skip app loading, then the vscode debugger's "step over" is much better for being able to stay at the right level of abstraction as you debug the code.
If you want to limit to a single browser use `--project="webkit"` or `firefox`, `Google Chrome`
Or comment out browsers in `playwright.config.ts`.
note chromium has encoder compat issues which is why were testing against the branded 'Google Chrome'
You may consider using the VSCode extension, it's useful for running individual threads, but some some reason the "record a test" is locked to chromium with we can't use. A work around is to us the CI `yarn playwright codegen -b wk --load-storage ./store localhost:3000`
However because much of our tests involve clicking in the stream at specific locations, it's code-gen looks `await page.locator('video').click();` when really we need to use a pixel coord, so I think it's of limited use.
### Unit and component tests
If you already haven't, run the following:
```
yarn
yarn build:wasm
yarn start
```
and finally:
```
yarn test:unit
```
For individual testing:
```
yarn test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false
```
Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro) tests, in interactive mode by default.
### Rust tests
**Dependencies**
-`KITTYCAD_API_TOKEN`
-`cargo-nextest`
-`just`
#### Setting KITTYCAD_API_TOKEN
Use the production zoo.dev token, set this environment variable before running the tests
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
# Make sure you installed cargo-nextest
# Make sure you installed just
cd rust
just test
```
```bash
# Without just
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
# Make sure you installed cargo-nextest
cd rust
exportRUST_BRACKTRACE="full"&& cargo nextest run --workspace --test-threads=1
```
Where `XXX` is an API token from the production engine (NOT the dev environment).
We recommend using [nextest](https://nexte.st/) to run the Rust tests (its faster and is used in CI). Once installed, run the tests using
```
cd rust
KITTYCAD_API_TOKEN=XXX cargo run nextest
```
### Mapping CI CD jobs to local commands
When you see the CI CD fail on jobs you may wonder three things
- Do I have a bug in my code?
- Is the test flaky?
- Is there a bug in `main`?
To answer these questions the following commands will give you confidence to locate the issue.
#### Static Analysis
Part of the CI CD pipeline performs static analysis on the code. Use the following commands to mimic the CI CD jobs.
The following set of commands should get us closer to one and done commands to instantly retest issues.
```
yarn test-setup
```
> Gotcha, are packages up to date and is the wasm built?
```
yarn tsc
yarn fmt-check
yarn lint
yarn test:unit:local
```
> Gotcha: Our unit tests have integration tests in them. You need to run a localhost server to run the unit tests.
#### E2E Tests
**Playwright Electron**
These E2E tests run in electron. There are tests that are skipped if they are ran in a windows, linux, or macos environment. We can use playwright tags to implement test skipping.
```
yarn test:playwright:electron:local
yarn test:playwright:electron:windows:local
yarn test:playwright:electron:macos:local
yarn test:playwright:electron:ubuntu:local
```
> Why does it say local? The CI CD commands that run in the pipeline cannot be ran locally. A single command will not properly setup the testing environment locally.
#### Some notes on CI
The tests are broken into snapshot tests and non-snapshot tests, and they run in that order, they automatically commit new snap shots, so if you see an image commit check it was an intended change. If we have non-determinism in the snapshots such that they are always committing new images, hopefully this annoyance makes us fix them asap, if you notice this happening let Kurt know. But for the odd occasion `git reset --hard HEAD~ && git push -f` is your friend.
How to interpret failing playwright tests?
If your tests fail, click through to the action and see that the tests failed on a line that includes `await page.getByTestId('loading').waitFor({ state: 'detached' })`, this means the test fail because the stream never started. It's you choice if you want to re-run the test, or ignore the failure.
We run on ubuntu and macos, because safari doesn't work on linux because of the dreaded "no RTCPeerConnection variable" error. But linux runs first and then macos for the same reason that we limit the number of parallel tests to 1 because we limit stream connections per user, so tests would start failing we if let them run together.
If something fails on CI you can download the artifact, unzip it and then open `playwright-report/data/<UUID>.zip` with https://trace.playwright.dev/ to see what happened.
#### Getting started writing a playwright test in our app
Besides following the instructions above and using the playwright docs, our app is weird because of the whole stream thing, which means our testing is weird. Because we've just figured out this stuff and therefore docs might go stale quick here's a 15min vid/tutorial
Finally, if you'd like to run a development build or contribute to the project, please visit our [contributor guide](CONTRIBUTING.md) to get started.
## KCL
For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/rust/kcl-lib).
### Logging
To display logging (to the terminal or console) set `ZOO_LOG=1`. This will log some warnings and simple performance metrics. To view these in test runs, use `-- --nocapture`.
To enable memory metrics, build with `--features dhat-heap`.
To contribute to the KittyCAD Language, see the [README](https://github.com/KittyCAD/modeling-app/tree/main/rust/kcl-lib) for KCL.
excerpt: "Documentation of the KCL language for the Zoo Design Studio."
layout: manual
---
KCL supports the usual arithmetic operators on numbers and logic operators on booleans:
| Operator | Meaning |
|----------|---------|
| `+` | Addition |
| `-` | Subtraction or unary negation |
| `*` | Multiplication |
| `/` | Division |
| `%` | Modulus aka remainder |
| `^` | Power, e.g., `x ^ 2` means `x` squared |
| `&` | Logical 'and' |
| `|` | Logical 'or' |
| `!` | Unary logical 'not' |
KCL also supports comparsion operators which operate on numbers and produce booleans:
| Operator | Meaning |
|----------|---------|
| `==` | Equal |
| `!=` | Not equal |
| `<` | Less than |
| `>` | Greater than |
| `<=` | Less than or equal |
| `>=` | Greater than or equal |
Arithmetics and logic expressions can be arbitrairly combined with the usual rules of associativity and precedence, e.g.,
```
myMathExpression = 3 + 1 * 2 / 3 - 7
```
You can also nest expressions in parenthesis:
```
myMathExpression = 3 + (1 * 2 / (3 - 7))
```
KCL numbers are implemented using [floating point numbers](https://en.wikipedia.org/wiki/Floating-point_arithmetic). This means that there are occasionally representation and rounding issues, and some oddities such as supporting positive and negative zero.
Some operators can be applied to other types:
-`+` can be used to concatenate strings, e.g., `'hello' + ' ' + 'world!'`
- Unary `-` can be used with planes or line-like objects such as axes to produce an object with opposite orientation, e.g., `-XY` is a plain which is aligned with `XY` but whose normal aligns with the negative Z axis.
- The following operators can be used with solids as shorthand for CSG operations:
excerpt: "Documentation of the KCL language for the Zoo Design Studio."
layout: manual
---
Arrays are sequences of values.
Arrays can be written out as *array literals* using a sequence of expressions surrounded by square brackets, e.g., `['hello', 'world']` is an array of strings, `[x, x + 1, x + 2]` is an array of numbers (assuming `x` is a number), `[]` is an empty array, and `['hello', 42, true]` is a mixed array.
A value in an array can be accessed by indexing using square brackets where the index is a number, for example, `arr[0]`, `arr[42]`, `arr[i]` (where `arr` is an array and `i` is a (whole) number).
There are some useful functions for working with arrays in the standard library, see [std::array](/docs/kcl-std/modules/std-array) for details.
## Array types
Arrays have their own types: `[T]` where `T` is the type of the elements of the array, for example, `[string]` means an array of `string`s and `[any]` means an array of any values.
Array types can also include length information: `[T; n]` denotes an array of length `n` (where `n` is a number literal) and `[T; 1+]` denotes an array whose length is at least one (i.e., a non-empty array). E.g., `[string; 1+]` and `[number(mm); 3]` are valid array types.
## Ranges
Ranges are a succinct way to create an array of sequential numbers. The syntax is `[start .. end]` where `start` and `end` evaluate to whole numbers (integers). Ranges are inclusive of the start and end. The end must be greater than the start. Examples:
```kcl,norun
[0..3] // [0, 1, 2, 3]
[3..10] // [3, 4, 5, 6, 7, 8, 9, 10]
x = 2
[x..x+1] // [2, 3]
```
The units of the start and end numbers must be the same and the result inherits those units.
excerpt: "Documentation of the KCL language for the Zoo Design Studio."
layout: manual
---
Attributes are syntax which affects the language item they annotate. In KCL they are indicated using `@`. For example, `@settings` affects the file in which it appears.
There are two kinds of attributes: named and unnamed attributes. Named attributes (e.g., `@settings`) have a name immediately after the `@` (e.g., `settings`) and affect their surrounding scope. Unnamed attributes have no name and affect the following item, e.g.,
```kcl,norun
@(lengthUnit = ft, coords = opengl)
import "tests/inputs/cube.obj"
```
has an unnamed attribute on the `import` statement.
Named and unnamed attributes may take a parenthesized list of arguments (like a function). Named attributes may also appear without any arguments (e.g., `@no_std`).
## Named attributes
The `@settings` attribute affects the current file and accepts the following arguments: `defaultLengthUnit`, `defaultAngleUnit`, and `kclVersion`. See [settings](/docs/kcl-lang/settings) for details.
The `@no_std` attribute affects the current file, takes no arguments, and causes the standard library to not be implicitly available. It can still be used by being explicitly imported.
## Unnamed attributes
Unnamed attributes may be used on `import` statements when importing non-KCL files. See [projects, modules, and imports](/docs/kcl-lang/modules) for details.
Other unnamed attributes are used on functions inside the standard library, but these are not available in user code.
// --- perform other operations and calculations here ---
cube
|> translate(z=10) // 2) Blocks only here
```
#### 2. Split heavy work into separate modules
Place computationally expensive or 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.
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:
excerpt: "Documentation of the KCL language for the Zoo Design Studio."
layout: manual
---
Numbers and numeric types in KCL include information about the units of the numbers. So rather than just having a number like `42`, we always have information about the units so we don't confuse 42 mm with 42 inches.
## Numeric literals
When writing a number literal, you can use a unit suffix to explicitly state the unit, e.g., `42mm`. The following units are available:
- Length units:
- metric: `mm`, `cm`, `m`
- imperial: `in`, `ft`, `yd`
- Angle units: `deg`, `rad`
-`_` to indicate a unitless number such as a count or ratio.
If you write a numeric literal without a suffix, then the defaults for the current file are used. These defaults are specified using the `@settings` attribute, see [settings](/docs/kcl-lang/settings) for details. Note that if using the defaults, the KCL interpreter won't know whether you intend the number to be a length, angle, or count and will treat it as being possibly any of them.
## Numeric types
Just like numbers carry units information, the `number` type also includes units information. Units are written in parentheses after the type, e.g., `number(mm)`.
Any of the suffixes described above can be used meaning that values with that type have the supplied units. E.g., `number(mm)` is the type of number values with mm units and `number(_)` is the type of number values with no units.
You can also use `number(Length)`, `number(Angle)`, or `number(Count)`. These types mean a number with any length, angle, or unitless (count) units, respectively (note that `number(_)` and `number(Count)` are equivalent since there is only one kind of unitless-ness).
Using just `number` means accepting any kind of number, even where the units are unknown by KCL.
## Function calls
When calling a function with an argument with numeric type, the declared numeric type in the function signature and the units of the argument value used in the function call must be compatible. Units are adjusted automatically. For example, if a function requires an argument with type `number(mm)`, then you can call it with `2in` and the units will be automatically adjusted, but calling it with `90deg` will cause an error.
## Mixing units with arithmetic
When doing arithmetic or comparisons, units will be adjusted as necessary if possible. However, often arithmetic expressions exceed the ability of KCL to accurately choose units which can result in warnings in your code or sometimes errors. In these cases, you will need to give KCL more information. Sometimes this can be done by making units explicit using suffixes. If not, then you will need to use *type ascription*, which asserts that an expression has the supplied type. For example, `(x * y): number(mm)` tells KCL that the units of `x * y` is mm. Note that type ascription does not do any adjustment of the numbers, e.g., `2mm: number(in)` has the value `2in` (note that this would be a very non-idiomatic way to use numeric type ascription, you could simply write `2in`. Usually type ascription is only necessary for supplying type information about the result of computation).
KCL has no support for area, volume, or other higher dimension units. When internal unit tracking requires multiple dimensions, KCL essentially gives up. This is usually where the extra type information described above is needed. If doing computation with higher dimensioned units, you must ensure that all adjustments occur before any computation. E.g., if you want to compute an area with unknown units, you must convert all numbers to the same unit before starting.
## Explicit conversions
You might sometimes need to convert from one unit to another for some calculation. You can do this implicitly when calling a function (see above), but if you can't or don't want to, then you can use the explicit conversion functions in the [`std::units`](/docs/kcl-std/modules/std-units) module.
@ -55,20 +55,6 @@ This setting has further nested options. See the schema for full details.
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
##### dismiss_web_banner
@ -128,13 +114,6 @@ The default unit to use in modeling dimensions.
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.
@ -57,34 +57,6 @@ This setting has further nested options. See the schema for full details.
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
##### dismiss_web_banner
@ -103,7 +75,7 @@ When the user is idle, teardown the stream after some time.
##### 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
@ -159,13 +131,6 @@ The controls for how to navigate the 3D view.
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.
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`.
excerpt: "Draw a line segment relative to the current origin using the polar measure of some angle and distance."
layout: manual
---
Draw a line segment relative to the current origin using the polar measure of some angle and distance.
```js
```kcl
angledLine(
sketch: Sketch,
@sketch: Sketch,
angle: number,
length?: number,
lengthX?: number,
@ -22,29 +21,30 @@ angledLine(
```
### Arguments
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `angle` | [`number`](/docs/kcl/types/number) | Which angle should the line be drawn at? | Yes |
| `length` | [`number`](/docs/kcl/types/number) | Draw the line this distance along the given angle. Only one of `length`, `lengthX`, `lengthY`, `lengthAbsoluteEndX`, `lengthAbsoluteEndY` 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`, `lengthAbsoluteEndX`, `lengthAbsoluteEndY` 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`, `lengthAbsoluteEndX`, `lengthAbsoluteEndY` 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`, `lengthAbsoluteEndX`, `lengthAbsoluteEndY` 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`, `lengthAbsoluteEndX`, `lengthAbsoluteEndY` can be given. | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
| `sketch` | [`Sketch`](/docs/kcl-std/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
| `angle` | [`number`](/docs/kcl-std/types/std-types-number) | Which angle should the line be drawn at? | Yes |
| `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-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-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-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-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-std/types/std-types-tag) | [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator) | Create a new tag which refers to this line | No |
### Returns
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
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
---
Draw an angled line from the current origin, constructing a line segment such that the newly created line intersects the desired target line segment.
```js
```kcl
angledLineThatIntersects(
data: AngledLineThatIntersectsData,
sketch: Sketch,
@sketch: Sketch,
angle: number,
intersectTag: TagIdentifier,
offset?: number,
tag?: TagDeclarator,
): Sketch
```
### Arguments
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `data` | [`AngledLineThatIntersectsData`](/docs/kcl/types/AngledLineThatIntersectsData) | Data for drawing an angled line that intersects with a given line. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
| `sketch` | [`Sketch`](/docs/kcl-std/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
| `angle` | [`number`](/docs/kcl-std/types/std-types-number) | Which angle should the line be drawn at? | Yes |
| `intersectTag` | [`TagIdentifier`](/docs/kcl-lang/types#TagIdentifier) | The tag of the line to intersect with | Yes |
| `offset` | [`number`](/docs/kcl-std/types/std-types-number) | The offset from the intersecting line. Defaults to 0. | 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
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
### Examples
```js
```kcl
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> startProfile(at = [0, 0])
|> line(endAbsolute = [5, 10])
|> line(endAbsolute = [-10, 10], tag = $lineToIntersect)
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
---
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.
```js
```kcl
bezierCurve(
data: BezierData,
sketch: Sketch,
@sketch: Sketch,
control1: Point2d,
control2: Point2d,
end: Point2d,
tag?: TagDeclarator,
): Sketch
```
### Arguments
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `data` | [`BezierData`](/docs/kcl/types/BezierData) | Data to draw a bezier curve. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
| `sketch` | [`Sketch`](/docs/kcl-std/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
| `control1` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | First control point for the cubic | Yes |
| `control2` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | Second control point for the cubic | 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-std/types/std-types-tag) | [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator) | Create a new tag which refers to this line | No |
### Returns
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
excerpt: "Construct a circle derived from 3 points."
layout: manual
---
Construct a circle derived from 3 points.
```js
```kcl
circleThreePoint(
sketchSurfaceOrGroup: SketchOrSurface,
p1: [number],
p2: [number],
p3: [number],
@sketchSurfaceOrGroup: Sketch | Plane | Face,
p1: Point2d,
p2: Point2d,
p3: Point2d,
tag?: TagDeclarator,
): Sketch
```
### Arguments
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes |
| `p1` | [`[number]`](/docs/kcl/types/number) | 1st point to derive the circle. | Yes |
| `p2` | [`[number]`](/docs/kcl/types/number) | 2nd point to derive the circle. | Yes |
| `p3` | [`[number]`](/docs/kcl/types/number) | 3rd point to derive the circle. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Identifier for the circle to reference elsewhere. | No |
| `sketchSurfaceOrGroup` | [`Sketch`](/docs/kcl-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` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | 1st point to derive the circle. | Yes |
| `p2` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | 2nd 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-std/types/std-types-tag) | [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator) | Identifier for the circle to reference elsewhere. | No |
### Returns
[`Sketch`](/docs/kcl/types/Sketch)
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
excerpt: "Compute the logarithm of the number with respect to an arbitrary base."
layout: manual
---
Compute the logarithm of the number with respect to an arbitrary base.
The result might not be correctly rounded owing to implementation details; `log2()` can produce more accurate results for base 2, and `log10()` can produce more accurate results for base 10.
```js
```kcl
log(
num: number,
base: number,
@input: number,
base: number(_),
): number
```
### Tags
* `math`
The result might not be correctly rounded owing to implementation
details; `log2` can produce more accurate results for base 2,
and `log10` can produce more accurate results for base 10.
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.