Compare commits

...

33 Commits

Author SHA1 Message Date
f31c2c6f81 Import geometry work w transforms (#5757)
* make work with imported geometry

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

* updates

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

* iupdates

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

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

* update known issues

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-12 01:23:21 +00:00
e5c05e1980 change test names kcl-samples (#5766)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-11 23:29:26 +00:00
6d0da100e5 benchmark retry (#5760)
* benchmark retry

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

* fix times

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

* fix times

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

* dont use a custom iter

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

* updates

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

* updates

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

* updates

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

* just parse

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

* updates

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

* fixes

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

* updates

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

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

* updates

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

* updates

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

* updates

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

* use runs on

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-11 22:21:28 +00:00
b8a0ad7144 Dedicated job for snapshot tests (#5752)
* WIP: break out e2e snapshots

* Separate prepare-wasm job

* Force e2e to run on pierremtb/adhoc/break-out-snapshots

* Quick fix

* Quick fix2

* Quick fix3

* Quick fix4

* Quick fix5

* Remove ifs for flow tests

* Clean up for review

* should-run == 'true' madness
2025-03-11 17:18:42 -04:00
724e65ac97 Hide selection-type args from command palette while in an edit flow (#5763)
* Allow `hidden` config to be a callback

* Hide selection type args if `nodeToEdit` is present

in workflows that have an edit flow set up

* Remove Selection from headerArguments in edit flow tests
2025-03-11 16:29:03 -04:00
b5028f7aa8 Change to not expose exec artifacts (#5700)
Now that the artifact graph is built completely in Rust, these are an
implementation detail that shouldn't be exposed to TS.
2025-03-11 19:09:11 +00:00
df6b4f4c37 Move consts to dir in docs (#5753)
* updates

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

* add consts to dir

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

* updates

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

* updates

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

* add consts to dir

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-11 18:44:27 +00:00
41eb64925b Improve sketch constraint test (#5756) 2025-03-11 14:14:03 -04:00
fc076173ff Make any error show on ErrorPage, not just route error responses (#5623)
* Make any error show on ErrorPage, not just route error responses

Closes #5620 by making any error show on the page so the user can copy
it for use in an issue. Previously, the logic was too narrow and only
showed the error on the page if `isRouterErrorResponse` was true.

* @nadr0's feedback

thanks for giving my crap work a review

* Update src/components/ErrorPage.tsx

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

* @nadr0 feedback, handle overflowing error case

---------

Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: Kevin Nadro <nadr0@users.noreply.github.com>
2025-03-11 17:46:07 +00:00
98822869f7 fix settings docs names (#5751)
* fix settings docs names

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

* updates

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

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

* add consts to dir

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-11 10:20:18 -07:00
df0510c199 cleandocs (#5750)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-11 08:51:23 -07:00
fda65bcbd7 codspeed (#5741)
* codspeed

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

* Update cargo-bench.yml

* Update cargo-bench.yml

* updates

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

* Update settings.md (#5743)

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

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-11 08:03:49 -07:00
c37e564b59 fix wheels (#5748)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-11 08:01:49 -07:00
d6ad4b6e66 KCL: Fix cryptic error in type mismatch (#5735)
Previous error message:
"Expected a kcl_lib::execution::geometry::SolidSet but found Sketch"

New error message:
"Expected a SolidSet but found Sketch. You can convert a sketch (2D) into a Solid (3D) by calling a function like `extrude` or `revolve`"

Two improvements:
 - Don't print the fully-qualified Rust name (e.g. kcl_lib::executor::Solid) instead use the last part of that (e.g. just Solid)
 - Allow specific suggestions for combinations of got/want (e.g. "You can convert a sketch (2D) into a Solid (3D) by calling a function like `extrude` or `revolve`")

Closes #5616
2025-03-10 22:53:16 -05:00
546b4ea3b8 generate the settings docs (#5740)
* generate the settings docs

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

* updates

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

* updates

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

* updates

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

* fmt

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

* updates

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

* updates

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

* updates

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

* updates

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

* updates

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

* updates

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

* Update docs/kcl/settings.md

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-10 18:59:10 -07:00
310932dc5a run rust benchmarks and compare on prs (#5734)
* run benchmarks and compare on prs

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

* run benchmarks and compare on prs

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

* fixes

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

* fixes

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

* benchmark kcl-samples

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

* updates

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

* updates

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

* updates

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

* updates

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

* updates

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

* updates

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

* updates

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

* updates

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

* updates

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

* updates

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

* updates

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

* updates

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-10 18:04:16 -07:00
51459bb413 turn on insta snapshot for step file output (#5732)
* turn on insta snapshot for step file output

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

* use a macro for the kcl-samples

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

* Update rust/kcl-directory-test-macro/src/lib.rs

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

* updates

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

* control the order

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

* engine

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

* updates

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

* updates

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

* update steps

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

* updates

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

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-10 15:35:45 -07:00
e00dae11ba Fix cryptic parser error (#5731)
# Problem

Before: "unexpected token |>", highlights the |>

After: "This argument needs a label, but it doesn't have one", highlights the argument with no label

Closes #5724 

# Discussion

I am trying a new approach to the parser: instead of parsing the specific correct thing we need, parse a more general form, then later, narrow it down to specifics and return a nice error if it's wrong. For example, instead of parsing labeled arguments, parse labeled OR unlabeled arguments. Then later check that the only unlabeled arg is the first one, and return a nice error if there's any other. This worked nicely for this PR, hopefully the approach will work for other "cryptic error" issues.
2025-03-10 17:09:54 -05:00
831c7f764a cargo publish was too big (#5699)
* cargo publish too big

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

* cargo publish too big

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

* updates

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

* updates

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

* updates

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

* bunmp again

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

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

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

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

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

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

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

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-10 14:29:04 -07:00
ec4ad268f7 Fix toolchain file copy to work on all platforms (#5733) 2025-03-10 16:44:44 -04:00
be640ea0bd ci: Fix e2e workflow to install rust toolchain when needed (#5728)
* ci: Fix e2e workflow to install rust toolchain when needed

* Unify conditions

* Pull out condition to variable

* Add echo so that debuggin is easier
2025-03-10 14:53:43 -04:00
f8ceab2233 Fix a recast bug and don't delete the user's code if parsing fails (#5663)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-03-08 09:33:45 -05:00
aea82e004a KCL: Convert x/y lines to use keyword arguments (#5615)
Previously, `xLine`, `xLineTo`, `yLine` and `yLineTo` used positional arguments. Now:

- `xLineTo` and `yLineTo` have been removed
- `xLine` and `yLine` both use keyword arguments:
  - `length`, optional (i.e. a relative distance along the X or Y axis)
  - `endAbsolute` optional (i.e. an absolute point along the X or Y axis)
  - `tag` optional
- Exactly one of `length` or `endAbsolute` must be given. Not both, not neither.

For example:

```
// Old way
|> xLine(6.04, %)
|> yLineTo(20, %, $base)

// New way
|> xLine(length = 6.04)
|> yLine(endAbsolute = 20, tag = $base)
```

This also improves some of the general-purpose keyword arguments code in modeling app's TS codebase.
2025-03-07 22:07:16 -06:00
bc3a0e3896 more updates for kcl-samples (#5696)
* screenshots and step

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

* automations

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

* add manifest generation

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

* small refactor

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

* update readme

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

* write the readme

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

* fixes for comments

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

* derive-docs tests updates

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

* update all the generated artifact commands, since we dont need to clear scene at the start of run so we dont need to recreate all the planes

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

* updates

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

* updates

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

* updates

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

* updates

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-07 18:45:33 -08:00
be69039d40 bump kcl crate versions (#5697)
* bump kcl crate versions

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

* update lock

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

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-07 18:44:43 -08:00
2c6d69497c Update KCL samples readme (#5677)
update KCL samples readme
2025-03-08 00:15:36 +00:00
18db3783af Fix project settings loading in browser (#5694)
Fixes #5625. #5142 regressed the project settings loading because it
failed to fire off a new `load.project` XState event in the case where
we were loading in the browser. It also may have had a bug with project
settings loading on refresh from the file page, as we were not properly
ensuring that the `settingsActor` was in the `idle` state before sending
our `load.project` event regardless.
2025-03-08 00:14:02 +00:00
b536040feb ci: Fix e2e jobs to pass the status check even when they're not run (#5693)
* ci: Fix e2e jobs to pass the status check even when they're not run
2025-03-08 00:00:57 +00:00
dd45cd4ef9 Don't try to clone a THREE.js group in coredump (#5690)
Fixes #5117 by just grabbing the `userData` off the group, and not
trying to clone the whole class instance which errors.
2025-03-07 19:09:56 +00:00
25cc5581be Factor out a struct for the result of parse_execute (#5629)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-03-08 08:00:55 +13:00
f7c192b64b Fix type parsing in CodeMirror and highlight them (#5674)
* Add new types and fix capitalization in CodeMirror grammar

* Add syntax highlighting for types
2025-03-07 18:56:29 +00:00
faae169154 Update dependabot config (#5639) 2025-03-07 17:36:54 +00:00
c74b9ba940 Block indexing if host is not app.zoo.dev (#5675)
* block indexing if host is not app.zoo.dev

* fix fmt
2025-03-07 17:23:40 +01:00
645 changed files with 6194178 additions and 99504 deletions

377
.github/dependabot.yml vendored
View File

@ -1,52 +1,331 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# DO NOT EDIT THIS FILE. This dependabot file was generated
# by https://github.com/KittyCAD/ciso Changes to this file should be addressed in
# the ciso repository.
version: 2
updates:
- package-ecosystem: 'npm' # See documentation for possible values
directories:
- '/'
- '/packages/codemirror-lang-kcl/'
- '/packages/codemirror-lsp-client/'
- '/rust/kcl-language-server/'
schedule:
interval: weekly
day: monday
reviewers:
- franknoirot
- irev-dev
- package-ecosystem: 'github-actions' # See documentation for possible values
directory: '/' # Location of package manifests
schedule:
interval: weekly
day: monday
reviewers:
- adamchalmers
- jessfraz
- package-ecosystem: 'cargo' # See documentation for possible values
directory: '/rust/' # Location of package manifests
schedule:
interval: weekly
day: monday
reviewers:
- adamchalmers
- jessfraz
groups:
serde-dependencies:
patterns:
- "serde*"
wasm-bindgen-deps:
patterns:
- "wasm-bindgen*"
- package-ecosystem: "pip"
directories:
- "/public/kcl-samples/"
- "/rust/kcl-python-bindings/"
schedule:
interval: weekly
day: monday
reviewers:
- adamchalmers
- jessfraz
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: cargo
directory: /rust
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: npm
directory: /rust/kcl-language-server
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: npm
directory: /packages/codemirror-lang-kcl
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: npm
directory: /packages/codemirror-lsp-client
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: npm
directory: /.github/actions/github-release
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: pip
directory: /public/kcl-samples
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: pip
directory: /rust/kcl-python-bindings
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: docker
directory: /.github/actions/github-release
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch

View File

@ -16,15 +16,21 @@ jobs:
cache: 'yarn'
- name: Install dependencies
run: yarn
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache wasm
uses: Swatinem/rust-cache@v2
- name: Use correct Rust toolchain
shell: bash
run: |
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
workspaces: './rust'
cache: false # Configured below.
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with:
tool: wasm-pack
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: rust
- name: build wasm
run: yarn build:wasm

View File

@ -33,18 +33,25 @@ jobs:
- run: yarn install
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Use correct Rust toolchain
shell: bash
run: |
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
workspaces: './rust'
cache: false # Configured below.
# TODO: see if we can fetch from main instead if no diff at rust
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with:
tool: wasm-pack
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: rust
- name: Run build:wasm
run: "yarn build:wasm"

61
.github/workflows/cargo-bench.yml vendored Normal file
View File

@ -0,0 +1,61 @@
on:
push:
branches:
- main
paths:
- '**.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain.toml'
- .github/workflows/cargo-bench.yml
pull_request:
paths:
- '**.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain.toml'
- .github/workflows/cargo-bench.yml
workflow_dispatch:
permissions:
contents: read
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
name: cargo bench
jobs:
cargo-bench:
name: cargo bench
runs-on:
- runs-on=${{ github.run_id }}
- runner=32cpu-linux-x64
- extras=s3-cache
steps:
- uses: runs-on/action@v1
- uses: actions/checkout@v4
- name: Use correct Rust toolchain
shell: bash
run: |
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: rust
- name: Install dependencies
run: |
cargo install cargo-criterion
cargo install cargo-codspeed
cd rust/kcl-lib
cargo add --dev codspeed-criterion-compat --rename criterion
- name: Build the benchmark target(s)
run: |
cd rust
cargo codspeed build
- name: Run the benchmarks
uses: CodSpeedHQ/action@v3
with:
working-directory: rust
run: cargo codspeed run
token: ${{ secrets.CODSPEED_TOKEN }}
env:
KITTYCAD_API_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN }}

View File

@ -22,7 +22,7 @@ jobs:
- name: Use correct Rust toolchain
shell: bash
run: |
cp --update=none rust/rust-toolchain.toml ./ || true
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:

View File

@ -29,7 +29,7 @@ jobs:
- name: Use correct Rust toolchain
shell: bash
run: |
cp --update=none rust/rust-toolchain.toml ./ || true
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:

View File

@ -31,7 +31,7 @@ jobs:
- name: Use correct Rust toolchain
shell: bash
run: |
cp --update=none rust/rust-toolchain.toml ./ || true
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:

View File

@ -29,7 +29,7 @@ jobs:
- name: Use correct Rust toolchain
shell: bash
run: |
cp --update=none rust/rust-toolchain.toml ./ || true
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:

View File

@ -18,16 +18,19 @@ permissions:
jobs:
path-changes:
conditions:
runs-on: ubuntu-latest
outputs:
significant: ${{ steps.path-changes.outputs.significant }}
should-run: ${{ steps.should-run.outputs.should-run }}
steps:
- uses: actions/checkout@v4
- name: Fetch the base branch
if: ${{ github.event_name == 'pull_request' }}
run: git fetch origin ${{ github.base_ref }} --depth=1
- name: Check for path changes
id: path-changes
shell: bash
@ -47,12 +50,238 @@ jobs:
else
echo "significant=false" >> $GITHUB_OUTPUT
fi
- name: Display path changes
- name: Should run
id: should-run
shell: bash
run: |
set -euo pipefail
# We should run when this is a scheduled run or if there are
# significant changes in the diff.
if [[ ${{ github.event_name }} == 'schedule' || ${{ steps.path-changes.outputs.significant }} == 'true' ]]; then
echo "should-run=true" >> $GITHUB_OUTPUT
else
echo "should-run=false" >> $GITHUB_OUTPUT
fi
- name: Display conditions
shell: bash
run: |
# For debugging purposes.
set -euo pipefail
echo "significant: ${{ steps.path-changes.outputs.significant }}"
echo "should-run: ${{ steps.should-run.outputs.should-run }}"
prepare-wasm:
# seperate job on Ubuntu to build or fetch the wasm blob once on the fastest runner
runs-on: namespace-profile-ubuntu-8-cores
needs: conditions
steps:
- uses: actions/checkout@v4
if: needs.conditions.outputs.should-run == 'true'
- id: filter
if: needs.conditions.outputs.should-run == 'true'
name: Check for Rust changes
uses: dorny/paths-filter@v3
with:
filters: |
rust:
- 'rust/**'
- uses: actions/setup-node@v4
if: needs.conditions.outputs.should-run == 'true'
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
if: needs.conditions.outputs.should-run == 'true'
run: yarn
- name: Download Wasm Cache
id: download-wasm
if: ${{ needs.conditions.outputs.should-run == 'true' && github.event_name != 'schedule' && steps.filter.outputs.rust == 'false' }}
uses: dawidd6/action-download-artifact@v7
continue-on-error: true
with:
github_token: ${{secrets.GITHUB_TOKEN}}
name: wasm-bundle
workflow: build-and-store-wasm.yml
branch: main
path: rust/kcl-wasm-lib/pkg
- name: Build WASM condition
id: wasm
if: needs.conditions.outputs.should-run == 'true'
run: |
set -euox pipefail
# Build wasm if this is a scheduled run, there are Rust changes, or
# downloading from the wasm cache failed.
if [[ ${{github.event_name}} == 'schedule' || ${{steps.filter.outputs.rust}} == 'true' || ${{steps.download-wasm.outcome}} == 'failure' ]]; then
echo "should-build-wasm=true" >> $GITHUB_OUTPUT
else
echo "should-build-wasm=false" >> $GITHUB_OUTPUT
fi
- name: Use correct Rust toolchain
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
shell: bash
run: |
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false # Configured below.
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
with:
tool: wasm-pack
- name: Rust Cache
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
uses: Swatinem/rust-cache@v2
with:
workspaces: './rust'
- name: Build Wasm
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
shell: bash
run: yarn build:wasm
- uses: actions/upload-artifact@v4
if: needs.conditions.outputs.should-run == 'true'
with:
name: prepared-wasm
path: |
rust/kcl-wasm-lib/pkg/kcl_wasm_lib*
snapshots:
name: playwright:snapshots:ubuntu
runs-on: namespace-profile-ubuntu-8-cores
needs: [conditions, prepare-wasm]
steps:
- uses: actions/create-github-app-token@v1
if: needs.conditions.outputs.should-run == 'true'
id: app-token
with:
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
private-key: ${{ secrets.MODELING_APP_GH_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- uses: actions/checkout@v4
if: needs.conditions.outputs.should-run == 'true'
with:
token: ${{ steps.app-token.outputs.token }}
- uses: actions/download-artifact@v4
if: needs.conditions.outputs.should-run == 'true'
name: prepared-wasm
- name: Copy prepared wasm
if: needs.conditions.outputs.should-run == 'true'
run: |
ls -R prepared-wasm
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
mkdir rust/kcl-wasm-lib/pkg
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
- uses: actions/setup-node@v4
if: needs.conditions.outputs.should-run == 'true'
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
id: deps-install
if: needs.conditions.outputs.should-run == 'true'
run: yarn
- name: Cache Playwright Browsers
if: needs.conditions.outputs.should-run == 'true'
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright/
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
- name: Install Playwright Browsers
if: needs.conditions.outputs.should-run == 'true'
run: yarn playwright install --with-deps
- name: build web
if: needs.conditions.outputs.should-run == 'true'
run: yarn tronb:vite:dev
- name: Run ubuntu/chrome snapshots
if: needs.conditions.outputs.should-run == 'true'
run: |
yarn test:snapshots
env:
CI: true
NODE_ENV: development
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
VITE_KC_SKIP_AUTH: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
- uses: actions/upload-artifact@v4
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
with:
name: playwright-report-snapshots-${{ matrix.os }}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
path: playwright-report/
include-hidden-files: true
retention-days: 30
overwrite: true
- name: Clean up test-results
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
continue-on-error: true
run: rm -r test-results
- name: check for changes
if: ${{ needs.conditions.outputs.should-run == 'true' && matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 && github.ref != 'refs/heads/main' }}
shell: bash
id: git-check
run: |
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
if git status | grep -q "Changes to be committed"
then echo "modified=true" >> $GITHUB_OUTPUT
else echo "modified=false" >> $GITHUB_OUTPUT
fi
- name: Commit changes, if any
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.git-check.outputs.modified == 'true' }}
shell: bash
run: |
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git fetch origin
echo ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
git commit -m "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true
git push
git push origin ${{ github.head_ref }}
# only upload artifacts if there's actually changes
- uses: actions/upload-artifact@v4
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.git-check.outputs.modified == 'true' }}
with:
name: playwright-report-ubuntu-${{ github.sha }}
path: playwright-report/
include-hidden-files: true
retention-days: 30
electron:
needs: [conditions, prepare-wasm]
timeout-minutes: 60
name: playwright:electron:${{ matrix.os }} ${{ matrix.shardIndex }} ${{ matrix.shardTotal }}
strategy:
@ -64,201 +293,94 @@ jobs:
shardTotal: [4]
# TODO: add ref here for main and latest release tag
runs-on: ${{ matrix.os }}
needs: path-changes
if: ${{ needs.path-changes.outputs.significant == 'true' }}
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
private-key: ${{ secrets.MODELING_APP_GH_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
- id: filter
name: Check for Rust changes
uses: dorny/paths-filter@v3
with:
filters: |
rust:
- 'rust/**'
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
id: deps-install
shell: bash
run: yarn
- name: Cache Playwright Browsers
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright/
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
- name: Install Playwright Browsers
shell: bash
run: yarn playwright install --with-deps
- name: Download Wasm Cache
id: download-wasm
if: github.event_name != 'schedule' && steps.filter.outputs.rust == 'false'
uses: dawidd6/action-download-artifact@v7
continue-on-error: true
with:
github_token: ${{secrets.GITHUB_TOKEN}}
name: wasm-bundle
workflow: build-and-store-wasm.yml
branch: main
path: rust/kcl-wasm-lib/pkg
- name: copy wasm blob
if: github.event_name != 'schedule' && steps.filter.outputs.rust == 'false'
shell: bash
run: cp rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public
continue-on-error: true
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with:
tool: wasm-pack
- name: Cache Wasm (because rust diff)
if: github.event_name == 'schedule' || steps.filter.outputs.rust == 'true'
uses: Swatinem/rust-cache@v2
with:
workspaces: './rust'
- name: OR Cache Wasm (because wasm cache failed)
if: steps.download-wasm.outcome == 'failure'
uses: Swatinem/rust-cache@v2
with:
workspaces: './rust'
- name: install good sed
if: ${{ startsWith(matrix.os, 'macos') }}
shell: bash
run: |
brew install gnu-sed
echo "/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
- name: Install vector
shell: bash
# TODO: figure out what to do with this, it's failing
if: false
run: |
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
chmod +x /tmp/vector.sh
/tmp/vector.sh -y -no-modify-path
mkdir -p /tmp/vector
cp .github/workflows/vector.toml /tmp/vector.toml
sed -i "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml
sed -i "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml
sed -i "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml
sed -i "s#GITHUB_REF_NAME#${GITHUB_REF_NAME}#g" /tmp/vector.toml
sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml
cat /tmp/vector.toml
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
- name: Build Wasm (because rust diff)
if: github.event_name == 'schedule' || steps.filter.outputs.rust == 'true'
shell: bash
run: yarn build:wasm
- name: OR Build Wasm (because wasm cache failed)
if: steps.download-wasm.outcome == 'failure'
shell: bash
run: yarn build:wasm
- name: build web
shell: bash
run: yarn tronb:vite:dev
- name: Run ubuntu/chrome snapshots
if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 }}
shell: bash
# TODO: break this in its own job, for now it's not slowing down the overall execution as ubuntu is the quickest,
# but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes.
run: |
yarn test:snapshots
env:
CI: true
NODE_ENV: development
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
VITE_KC_SKIP_AUTH: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() && (success() || failure()) }}
with:
name: playwright-report-snapshots-${{ matrix.os }}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
path: playwright-report/
include-hidden-files: true
retention-days: 30
overwrite: true
- name: Clean up test-results
if: ${{ !cancelled() && (success() || failure()) }}
continue-on-error: true
run: rm -r test-results
- name: check for changes
if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 && github.ref != 'refs/heads/main' }}
shell: bash
id: git-check
run: |
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
if git status | grep -q "Changes to be committed"
then echo "modified=true" >> $GITHUB_OUTPUT
else echo "modified=false" >> $GITHUB_OUTPUT
fi
- name: Commit changes, if any
if: steps.git-check.outputs.modified == 'true'
shell: bash
run: |
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git fetch origin
echo ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
git commit -m "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true
git push
git push origin ${{ github.head_ref }}
# only upload artifacts if there's actually changes
- uses: actions/upload-artifact@v4
if: steps.git-check.outputs.modified == 'true'
with:
name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
path: playwright-report/
include-hidden-files: true
retention-days: 30
- uses: actions/download-artifact@v4
if: ${{ !cancelled() && (success() || failure()) }}
continue-on-error: true
with:
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
path: test-results/
- name: Run playwright/electron flow (with retries)
id: retry
if: ${{ !cancelled() && steps.deps-install.outcome == 'success' }}
uses: nick-fields/retry@v3.0.2
with:
shell: bash
command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}}
timeout_minutes: 30
max_attempts: 25
env:
CI: true
FAIL_ON_CONSOLE_ERRORS: true
NODE_ENV: development
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
VITE_KC_SKIP_AUTH: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
path: test-results/
include-hidden-files: true
retention-days: 30
overwrite: true
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
path: playwright-report/
include-hidden-files: true
retention-days: 30
overwrite: true
- uses: actions/checkout@v4
if: needs.conditions.outputs.should-run == 'true'
- uses: actions/download-artifact@v4
if: needs.conditions.outputs.should-run == 'true'
name: prepared-wasm
- name: Copy prepared wasm
if: needs.conditions.outputs.should-run == 'true'
run: |
ls -R prepared-wasm
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
mkdir rust/kcl-wasm-lib/pkg
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
- uses: actions/setup-node@v4
if: needs.conditions.outputs.should-run == 'true'
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
id: deps-install
if: needs.conditions.outputs.should-run == 'true'
run: yarn
- name: Cache Playwright Browsers
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright/
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Build web
if: needs.conditions.outputs.should-run == 'true'
run: yarn tronb:vite:dev
- name: Install good sed
if: startsWith(matrix.os, 'macos')
shell: bash
run: |
brew install gnu-sed
echo "/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
# TODO: Add back axiom logs
- uses: actions/download-artifact@v4
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
continue-on-error: true
with:
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
path: test-results/
- name: Run playwright/electron flow (with retries)
id: retry
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && steps.deps-install.outcome == 'success' }}
uses: nick-fields/retry@v3.0.2
with:
shell: bash
command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}}
timeout_minutes: 30
max_attempts: 25
env:
CI: true
FAIL_ON_CONSOLE_ERRORS: true
NODE_ENV: development
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
VITE_KC_SKIP_AUTH: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
- uses: actions/upload-artifact@v4
if: ${{ needs.conditions.outputs.should-run == 'true' && always() }}
with:
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
path: test-results/
include-hidden-files: true
retention-days: 30
overwrite: true
- uses: actions/upload-artifact@v4
if: ${{ needs.conditions.outputs.should-run == 'true' && always() }}
with:
name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
path: playwright-report/
include-hidden-files: true
retention-days: 30
overwrite: true

View File

@ -5,6 +5,7 @@ on:
paths:
- .github/workflows/generate-website-docs.yml
- 'docs/**'
- 'public/kcl-samples/**'
pull_request:
paths:
- .github/workflows/generate-website-docs.yml
@ -39,9 +40,21 @@ jobs:
# cleanup old
rm -rf documentation/content/pages/docs/kcl/*.md
rm -rf documentation/content/pages/docs/kcl/types
rm -rf documentation/content/pages/docs/kcl/settings
rm -rf documentation/content/pages/docs/kcl/consts
# move new
mv -f docs/kcl/*.md documentation/content/pages/docs/kcl/
mv -f docs/kcl/types documentation/content/pages/docs/kcl/
mv -f docs/kcl/settings documentation/content/pages/docs/kcl/
mv -f docs/kcl/consts documentation/content/pages/docs/kcl/
- name: move kcl-samples
shell: bash
run: |
mkdir -p documentation/content/pages/docs/kcl-samples
# cleanup old
rm -rf documentation/content/pages/docs/kcl-samples/*
# move new
mv -f public/kcl-samples/* documentation/content/pages/docs/kcl-samples/
- name: commit the changes in the docs repo
shell: bash
run: |

View File

@ -159,10 +159,13 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
needs: [linux-x86_64, windows, macos, sdist]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: rust/kcl-python-bindings
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
- name: Install codespell
- name: do uv things
run: |
cd rust/kcl-python-bindings
uv venv .venv

View File

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

View File

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

2
.gitignore vendored
View File

@ -53,8 +53,6 @@ e2e/playwright/export-snapshots/*
/public/kcl-samples.zip
/public/kcl-samples/.github
/public/kcl-samples/screenshots
/public/kcl-samples/step
/test-results/
/playwright-report/
/blob-report/

View File

@ -40,7 +40,7 @@ sketch001 = startSketchOn('XZ')
angle = angleToMatchLengthY(seg01, 15, %),
length = 5
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
extrusion = extrude(sketch001, length = 5)

View File

@ -35,10 +35,10 @@ angledLine(
```js
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> yLineTo(15, %)
|> yLine(endAbsolute = 15)
|> angledLine({ angle = 30, length = 15 }, %)
|> line(end = [8, -10])
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 10)

View File

@ -37,7 +37,7 @@ sketch001 = startSketchOn('XZ')
angle = toDegrees(asin(0.5)),
length = 20
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
extrude001 = extrude(sketch001, length = 5)

View File

@ -37,7 +37,7 @@ sketch001 = startSketchOn('XZ')
angle = toDegrees(atan(1.25)),
length = 20
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
extrude001 = extrude(sketch001, length = 5)

View File

@ -41,7 +41,7 @@ sketch001 = startSketchOn('XZ')
angle = toDegrees(atan2(1.25, 2)),
length = 20
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
extrude001 = extrude(sketch001, length = 5)

View File

@ -35,7 +35,7 @@ sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line(endAbsolute = [12, 10])
|> line(end = [ceil(7.02986), 0])
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
extrude001 = extrude(sketch001, length = 5)

File diff suppressed because one or more lines are too long

25
docs/kcl/consts.md Normal file
View File

@ -0,0 +1,25 @@
---
title: "KCL Constants"
excerpt: "Documentation for the KCL constants."
layout: manual
---
## Table of Contents
### `std`
- [`HALF_TURN`](/docs/kcl/consts/std-HALF_TURN)
- [`QUARTER_TURN`](/docs/kcl/consts/std-QUARTER_TURN)
- [`THREE_QUARTER_TURN`](/docs/kcl/consts/std-THREE_QUARTER_TURN)
- [`XY`](/docs/kcl/consts/std-XY)
- [`XZ`](/docs/kcl/consts/std-XZ)
- [`YZ`](/docs/kcl/consts/std-YZ)
- [`ZERO`](/docs/kcl/consts/std-ZERO)
### `std::math`
- [`E`](/docs/kcl/consts/std-math-E)
- [`PI`](/docs/kcl/consts/std-math-PI)
- [`TAU`](/docs/kcl/consts/std-math-TAU)

View File

@ -21,7 +21,7 @@ exampleSketch = startSketchOn("XZ")
angle = 30,
length = 2 * E ^ 2,
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 10)

View File

@ -21,7 +21,7 @@ exampleSketch = startSketchOn("XZ")
angle = 50,
length = 10 * TAU,
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

View File

@ -31,7 +31,7 @@ e(): number
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 10)

View File

@ -35,7 +35,7 @@ sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line(endAbsolute = [12, 10])
|> line(end = [floor(7.02986), 0])
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
extrude001 = extrude(sketch001, length = 5)

View File

@ -12,25 +12,26 @@ layout: manual
* [`Modules`](kcl/modules)
* [`Settings`](kcl/settings)
* [`Known Issues`](kcl/known-issues)
* [`Constants`](kcl/consts)
### Standard library
* **Primitive types**
* [`bool`](kcl/bool)
* [`number`](kcl/number)
* [`string`](kcl/string)
* [`tag`](kcl/tag)
* [`bool`](kcl/types/bool)
* [`number`](kcl/types/number)
* [`string`](kcl/types/string)
* [`tag`](kcl/types/tag)
* **std**
* [`HALF_TURN`](kcl/const_std-HALF_TURN)
* [`Plane`](kcl/Plane)
* [`QUARTER_TURN`](kcl/const_std-QUARTER_TURN)
* [`Sketch`](kcl/Sketch)
* [`Solid`](kcl/Solid)
* [`THREE_QUARTER_TURN`](kcl/const_std-THREE_QUARTER_TURN)
* [`XY`](kcl/const_std-XY)
* [`XZ`](kcl/const_std-XZ)
* [`YZ`](kcl/const_std-YZ)
* [`ZERO`](kcl/const_std-ZERO)
* [`HALF_TURN`](kcl/consts/std-HALF_TURN)
* [`Plane`](kcl/types/Plane)
* [`QUARTER_TURN`](kcl/consts/std-QUARTER_TURN)
* [`Sketch`](kcl/types/Sketch)
* [`Solid`](kcl/types/Solid)
* [`THREE_QUARTER_TURN`](kcl/consts/std-THREE_QUARTER_TURN)
* [`XY`](kcl/consts/std-XY)
* [`XZ`](kcl/consts/std-XZ)
* [`YZ`](kcl/consts/std-YZ)
* [`ZERO`](kcl/consts/std-ZERO)
* [`abs`](kcl/abs)
* [`acos`](kcl/acos)
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
@ -131,14 +132,12 @@ layout: manual
* [`toRadians`](kcl/toRadians)
* [`translate`](kcl/translate)
* [`xLine`](kcl/xLine)
* [`xLineTo`](kcl/xLineTo)
* [`yLine`](kcl/yLine)
* [`yLineTo`](kcl/yLineTo)
* [`yd`](kcl/yd)
* **std::math**
* [`E`](kcl/const_std-math-E)
* [`PI`](kcl/const_std-math-PI)
* [`TAU`](kcl/const_std-math-TAU)
* [`E`](kcl/consts/std-math-E)
* [`PI`](kcl/consts/std-math-PI)
* [`TAU`](kcl/consts/std-math-TAU)
* [`cos`](kcl/std-math-cos)
* [`sin`](kcl/std-math-sin)
* [`tan`](kcl/std-math-tan)

View File

@ -13,9 +13,7 @@ once fixed in engine will just start working here with no language changes.
If you see a red line around your model, it means this is happening.
- **Import**: Right now you can import a file, even if that file has brep data
you cannot edit it, after v1, the engine will account for this. You also cannot
currently move or transform the imported objects at all, once we have assemblies
this will work.
you cannot edit it, after v1, the engine will account for this.
- **Fillets**: Fillets cannot intersect, you will get an error. Only simple fillet
cases work currently.

View File

@ -38,7 +38,7 @@ pow(
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle = 50, length = pow(5, 2) }, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,7 @@ sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line(endAbsolute = [12, 10])
|> line(end = [round(7.02986), 0])
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
extrude001 = extrude(sketch001, length = 5)

File diff suppressed because one or more lines are too long

View File

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

View File

@ -0,0 +1,208 @@
---
title: "Project Settings"
excerpt: "Project specific settings for the app. These live in `project.toml` in the base of the project directory. Updating the settings for the project in the app will update this file automatically. Do not edit this file manually, as it may be overwritten by the app. Manual edits can cause corruption of the settings file."
layout: manual
---
# Project Settings
Project specific settings for the app. These live in `project.toml` in the base of the project directory. Updating the settings for the project in the app will update this file automatically. Do not edit this file manually, as it may be overwritten by the app. Manual edits can cause corruption of the settings file.
## Project Configuration Structure
```toml
[settings.app]
# Set the appearance of the application
name = "My Awesome Project"
[settings.app.appearance]
# Use dark mode theme
theme = "dark"
# Set the app color to blue (240.0 = blue, 0.0 = red, 120.0 = green)
color = 240.0
[settings.modeling]
# Use inches as the default measurement unit
base_unit = "in"
```
## Available Settings
### settings
#### app
The settings for the modeling app.
**Default:** None
This setting has the following nested options:
##### appearance
The settings for the appearance of the app.
**Default:** None
This setting has further nested options. See the schema for full details.
##### onboarding_status
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
Permanently dismiss the banner warning to download the desktop app. This setting only applies to the web app. And is temporary until we have Linux support.
**Default:** None
##### stream_idle_mode
When the user is idle, and this is true, the stream will be torn down.
**Default:** None
##### allow_orbit_in_sketch_mode
When the user is idle, and this is true, the stream will be torn down.
**Default:** None
##### show_debug_panel
Whether to show the debug panel, which lets you see various states of the app to aid in development.
**Default:** None
##### named_views
Settings that affect the behavior of the command bar.
**Default:** None
#### modeling
Settings that affect the behavior while modeling.
**Default:** None
This setting has the following nested options:
##### base_unit
The default unit to use in modeling dimensions.
**Default:** None
##### highlight_edges
Highlight edges of 3D objects?
**Default:** None
##### show_debug_panel
Whether to show the debug panel, which lets you see various states of the app to aid in development. Remove this when we remove backwards compatibility with the old settings file.
**Default:** None
##### enable_ssao
Whether or not Screen Space Ambient Occlusion (SSAO) is enabled.
**Default:** None
#### text_editor
Settings that affect the behavior of the KCL text editor.
**Default:** None
This setting has the following nested options:
##### text_wrapping
Whether to wrap text in the editor or overflow with scroll.
**Default:** None
##### blinking_cursor
Whether to make the cursor blink in the editor.
**Default:** None
#### command_bar
Settings that affect the behavior of the command bar.
**Default:** None
This setting has the following nested options:
##### include_settings
Whether to include settings in the command bar.
**Default:** None
## Complete Example
```toml
[settings.app]
# Set the appearance of the application
name = "My Awesome Project"
[settings.app.appearance]
# Use dark mode theme
theme = "dark"
# Set the app color to blue (240.0 = blue, 0.0 = red, 120.0 = green)
color = 240.0
[settings.modeling]
# Use inches as the default measurement unit
base_unit = "in"
```

272
docs/kcl/settings/user.md Normal file
View File

@ -0,0 +1,272 @@
---
title: "User Settings"
excerpt: "User specific settings for the app. These live in `user.toml` in the app's configuration directory. Updating the settings in the app will update this file automatically. Do not edit this file manually, as it may be overwritten by the app. Manual edits can cause corruption of the settings file."
layout: manual
---
# User Settings
User specific settings for the app. These live in `user.toml` in the app's configuration directory. Updating the settings in the app will update this file automatically. Do not edit this file manually, as it may be overwritten by the app. Manual edits can cause corruption of the settings file.
## User Configuration Structure
```toml
[settings.app]
# Set the appearance of the application
[settings.app.appearance]
# Use dark mode theme
theme = "dark"
# Set the app color to blue (240.0 = blue, 0.0 = red, 120.0 = green)
color = 240.0
[settings.modeling]
# Use millimeters as the default measurement unit
base_unit = "mm"
[settings.text_editor]
# Disable text wrapping in the editor
text_wrapping = false
```
## Available Settings
### settings
#### app
The settings for the modeling app.
**Default:** None
This setting has the following nested options:
##### appearance
The settings for the appearance of the app.
**Default:** None
This setting has further nested options. See the schema for full details.
##### onboarding_status
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
Permanently dismiss the banner warning to download the desktop app. This setting only applies to the web app. And is temporary until we have Linux support.
**Default:** None
##### stream_idle_mode
When the user is idle, and this is true, the stream will be torn down.
**Default:** None
##### allow_orbit_in_sketch_mode
When the user is idle, and this is true, the stream will be torn down.
**Default:** None
##### show_debug_panel
Whether to show the debug panel, which lets you see various states of the app to aid in development.
**Default:** None
#### modeling
Settings that affect the behavior while modeling.
**Default:** None
This setting has the following nested options:
##### base_unit
The default unit to use in modeling dimensions.
**Default:** None
##### camera_projection
The projection mode the camera should use while modeling.
**Default:** None
##### camera_orbit
The methodology the camera should use to orbit around the model.
**Default:** None
##### mouse_controls
The controls for how to navigate the 3D view.
**Possible values:** `zoo`, `onshape`, `trackpad_friendly`, `solidworks`, `nx`, `creo`, `autocad`
**Default:** None
##### highlight_edges
Highlight edges of 3D objects?
**Default:** None
##### show_debug_panel
Whether to show the debug panel, which lets you see various states of the app to aid in development. Remove this when we remove backwards compatibility with the old settings file.
**Default:** None
##### enable_ssao
Whether or not Screen Space Ambient Occlusion (SSAO) is enabled.
**Default:** None
##### show_scale_grid
Whether or not to show a scale grid in the 3D modeling view
**Default:** None
#### text_editor
Settings that affect the behavior of the KCL text editor.
**Default:** None
This setting has the following nested options:
##### text_wrapping
Whether to wrap text in the editor or overflow with scroll.
**Default:** None
##### blinking_cursor
Whether to make the cursor blink in the editor.
**Default:** None
#### project
Settings that affect the behavior of project management.
**Default:** None
This setting has the following nested options:
##### directory
The directory to save and load projects from.
**Default:** None
##### default_project_name
The default project name to use when creating a new project.
**Default:** None
#### command_bar
Settings that affect the behavior of the command bar.
**Default:** None
This setting has the following nested options:
##### include_settings
Whether to include settings in the command bar.
**Default:** None
## Complete Example
```toml
[settings.app]
# Set the appearance of the application
[settings.app.appearance]
# Use dark mode theme
theme = "dark"
# Set the app color to blue (240.0 = blue, 0.0 = red, 120.0 = green)
color = 240.0
[settings.modeling]
# Use millimeters as the default measurement unit
base_unit = "mm"
[settings.text_editor]
# Disable text wrapping in the editor
text_wrapping = false
```

View File

@ -34,7 +34,7 @@ sqrt(num: number): number
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle = 50, length = sqrt(2500) }, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

View File

@ -137,9 +137,9 @@ a1 = startSketchOn({
})
|> startProfileAt([0, 0], %)
|> line(end = [100.0, 0])
|> yLine(-100.0, %)
|> xLine(-100.0, %)
|> yLine(100.0, %)
|> yLine(length = -100.0)
|> xLine(length = -100.0)
|> yLine(length = 100.0)
|> close()
|> extrude(length = 3.14)
```

View File

@ -33,7 +33,7 @@ exampleSketch = startSketchOn("XZ")
angle = 30,
length = 3 / cos(toRadians(30)),
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

View File

@ -33,7 +33,7 @@ exampleSketch = startSketchOn("XZ")
angle = 50,
length = 15 / sin(toDegrees(135)),
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

View File

@ -33,7 +33,7 @@ exampleSketch = startSketchOn("XZ")
angle = 50,
length = 50 * tan(1/2),
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@ tau(): number
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle = 50, length = 10 * tau() }, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

View File

@ -37,7 +37,7 @@ exampleSketch = startSketchOn("XZ")
angle = 50,
length = 70 * cos(toDegrees(pi() / 4))
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

View File

@ -37,7 +37,7 @@ exampleSketch = startSketchOn("XZ")
angle = 50,
length = 70 * cos(toRadians(45))
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,62 @@
---
title: "SolidOrImportedGeometry"
excerpt: "Data for a solid or an imported geometry."
layout: manual
---
Data for a solid or an imported geometry.
**This schema accepts exactly one of the following:**
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `solid`| | No |
| `id` |[`string`](/docs/kcl/types/string)| The id of the solid. | No |
| `artifactId` |[`ArtifactId`](/docs/kcl/types/ArtifactId)| The artifact ID of the solid. Unlike `id`, this doesn't change. | No |
| `value` |`[` [`ExtrudeSurface`](/docs/kcl/types/ExtrudeSurface) `]`| The extrude surfaces. | No |
| `sketch` |[`Sketch`](/docs/kcl/types/Sketch)| The sketch. | No |
| `height` |[`number`](/docs/kcl/types/number)| The height of the solid. | No |
| `startCapId` |[`string`](/docs/kcl/types/string)| The id of the extrusion start cap | No |
| `endCapId` |[`string`](/docs/kcl/types/string)| The id of the extrusion end cap | No |
| `edgeCuts` |`[` [`EdgeCut`](/docs/kcl/types/EdgeCut) `]`| Chamfers or fillets on this solid. | No |
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A unit of length. | No |
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| Metadata. | No |
----
Data for an imported geometry.
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `importedGeometry`| | No |
| `id` |[`string`](/docs/kcl/types/string)| The ID of the imported geometry. | No |
| `value` |`[` [`string`](/docs/kcl/types/string) `]`| The original file paths. | No |
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
----

View File

@ -10,8 +10,9 @@ Draw a line relative to the current origin to a specified distance away from the
```js
xLine(
length: number,
sketch: Sketch,
length?: number,
endAbsolute?: number,
tag?: TagDeclarator,
): Sketch
```
@ -21,9 +22,10 @@ xLine(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `length` | [`number`](/docs/kcl/types/number) | | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `length` | [`number`](/docs/kcl/types/number) | How far away along the X axis should this line go? Incompatible with `endAbsolute`. | No |
| `endAbsolute` | [`number`](/docs/kcl/types/number) | Which absolute X value should this line go to? Incompatible with `length`. | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
### Returns
@ -35,12 +37,12 @@ xLine(
```js
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> xLine(15, %)
|> xLine(length = 15)
|> angledLine({ angle = 80, length = 15 }, %)
|> line(end = [8, -10])
|> xLine(10, %)
|> xLine(length = 10)
|> angledLine({ angle = 120, length = 30 }, %)
|> xLine(-15, %)
|> xLine(length = -15)
|> close()
example = extrude(exampleSketch, length = 10)

File diff suppressed because one or more lines are too long

View File

@ -10,8 +10,9 @@ Draw a line relative to the current origin to a specified distance away from the
```js
yLine(
length: number,
sketch: Sketch,
length?: number,
endAbsolute?: number,
tag?: TagDeclarator,
): Sketch
```
@ -21,9 +22,10 @@ yLine(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `length` | [`number`](/docs/kcl/types/number) | | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `length` | [`number`](/docs/kcl/types/number) | How far away along the Y axis should this line go? Incompatible with `endAbsolute`. | No |
| `endAbsolute` | [`number`](/docs/kcl/types/number) | Which absolute Y value should this line go to? Incompatible with `length`. | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
### Returns
@ -35,10 +37,10 @@ yLine(
```js
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> yLine(15, %)
|> yLine(length = 15)
|> angledLine({ angle = 30, length = 15 }, %)
|> line(end = [8, -10])
|> yLine(-5, %)
|> yLine(length = -5)
|> close()
example = extrude(exampleSketch, length = 10)

File diff suppressed because one or more lines are too long

View File

@ -65,7 +65,7 @@ async function doBasicSketch(
if (openPanes.includes('code')) {
await expect(u.codeLocator)
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${commonPoints.startAt}, sketch001)
|> xLine(${commonPoints.num1}, %)`)
|> xLine(length = ${commonPoints.num1})`)
}
await page.waitForTimeout(500)
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
@ -74,8 +74,8 @@ async function doBasicSketch(
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
|> xLine(${commonPoints.num1}, %)
|> yLine(${commonPoints.num1 + 0.01}, %)`)
|> xLine(length = ${commonPoints.num1})
|> yLine(length = ${commonPoints.num1 + 0.01})`)
} else {
await page.waitForTimeout(500)
}
@ -86,9 +86,9 @@ async function doBasicSketch(
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
|> xLine(${commonPoints.num1}, %)
|> yLine(${commonPoints.num1 + 0.01}, %)
|> xLine(${commonPoints.num2 * -1}, %)`)
|> xLine(length = ${commonPoints.num1})
|> yLine(length = ${commonPoints.num1 + 0.01})
|> xLine(length = ${commonPoints.num2 * -1})`)
}
// deselect line tool
@ -146,9 +146,9 @@ async function doBasicSketch(
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
|> xLine(${commonPoints.num1}, %, $seg01)
|> yLine(${commonPoints.num1 + 0.01}, %)
|> xLine(-segLen(seg01), %)`)
|> xLine(length = ${commonPoints.num1}, tag = $seg01)
|> yLine(length = ${commonPoints.num1 + 0.01})
|> xLine(length = -segLen(seg01))`)
}
test.describe('Basic sketch', { tag: ['@skipWin'] }, () => {

View File

@ -16,7 +16,7 @@ test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
|> xLine(-20, %)
|> xLine(length = -20)
|> close()
`
)

View File

@ -800,10 +800,10 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.press('ArrowDown')
await page.keyboard.press('Enter')
// finish line with comment
await page.keyboard.type('5')
await page.waitForTimeout(100)
await page.keyboard.press('Tab')
await page.waitForTimeout(100)
await page.keyboard.type('5')
await page.waitForTimeout(100)
await page.keyboard.press('Tab')
await page.keyboard.type(' // ')
@ -817,7 +817,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
|> startProfileAt([3.14, 12], %)
|> xLine(5, %) // lin`)
|> xLine(%, length = 5) // lin`)
// expect there to be no KCL errors
await expect(page.locator('.cm-lint-marker-error')).toHaveCount(0)
@ -873,10 +873,10 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.press('ArrowDown')
await page.keyboard.press('Tab')
// finish line with comment
await page.keyboard.type('5')
await page.waitForTimeout(100)
await page.keyboard.press('Tab')
await page.waitForTimeout(100)
await page.keyboard.type('5')
await page.waitForTimeout(100)
await page.keyboard.press('Tab')
await page.keyboard.type(' // ')
@ -890,7 +890,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
|> startProfileAt([3.14, 12], %)
|> xLine(5, %) // lin`)
|> xLine(%, length = 5) // lin`)
})
})
test('Can undo a click and point extrude with ctrl+z', async ({

View File

@ -8,7 +8,7 @@ const FEATURE_TREE_EXAMPLE_CODE = `export fn timesFive(x) {
export fn triangle() {
return startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> xLine(10, %)
|> xLine(length = 10)
|> line(end = [-10, -5])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -28,7 +28,7 @@ plane001 = offsetPlane('XY', offset = 10)
sketch002 = startSketchOn(plane001)
|> startProfileAt([-20, 0], %)
|> line(end = [5, -15])
|> xLine(-10, %)
|> xLine(length = -10)
|> line(endAbsolute = [-40, 0])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -274,7 +274,6 @@ test.describe('Feature Tree pane', () => {
currentArgKey: 'distance',
currentArgValue: initialInput,
headerArguments: {
Selection: '1 face',
Distance: initialInput,
},
highlightedHeaderArg: 'distance',
@ -291,7 +290,6 @@ test.describe('Feature Tree pane', () => {
await cmdBar.expectState({
stage: 'review',
headerArguments: {
Selection: '1 face',
// The calculated value is shown in the argument summary
Distance: initialInput,
},
@ -402,7 +400,7 @@ test.describe('Feature Tree pane', () => {
sketch001 = startSketchOn(plane001)
profile001 = circle(sketch001, center = [0, 20], radius = 12)
profile002 = startProfileAt([0, 7.25], sketch001)
|> xLine(13.3, %)
|> xLine(length = 13.3)
profile003 = startProfileAt([0, -4.93], sketch001)
|> line(endAbsolute = [-5.56, 0])`
await context.folderSetupFn(async (dir) => {

View File

@ -28,7 +28,6 @@ export class ToolbarFixture {
rectangleBtn!: Locator
lengthConstraintBtn!: Locator
exitSketchBtn!: Locator
editSketchBtn!: Locator
fileTreeBtn!: Locator
createFileBtn!: Locator
fileCreateToast!: Locator
@ -61,7 +60,6 @@ export class ToolbarFixture {
this.rectangleBtn = page.getByTestId('corner-rectangle')
this.lengthConstraintBtn = page.getByTestId('constraint-length')
this.exitSketchBtn = page.getByTestId('sketch-exit')
this.editSketchBtn = page.locator('[name="Edit Sketch"]')
this.fileTreeBtn = page.locator('[id="files-button-holder"]')
this.createFileBtn = page.getByTestId('create-file-button')
this.treeInputField = page.getByTestId('tree-input-field')
@ -71,6 +69,10 @@ export class ToolbarFixture {
this.fileCreateToast = page.getByText('Successfully created')
}
get editSketchBtn() {
return this.page.locator('[name="Edit Sketch"]')
}
get logoLink() {
return this.page.getByTestId('app-logo')
}

View File

@ -524,7 +524,7 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
const expectedCodeSnippets = {
sketchOnXzPlane: `sketch001 = startSketchOn('XZ')`,
pointAtOrigin: `startProfileAt([${originSloppy.kcl[0]}, ${originSloppy.kcl[1]}], sketch001)`,
segmentOnXAxis: `xLine(${xAxisSloppy.kcl[0]}, %)`,
segmentOnXAxis: `xLine(length = ${xAxisSloppy.kcl[0]})`,
afterSegmentDraggedOffYAxis: `startProfileAt([${offYAxis.kcl[0]}, ${offYAxis.kcl[1]}], sketch001)`,
afterSegmentDraggedOnYAxis: `startProfileAt([${yAxisSloppy.kcl[0]}, ${yAxisSloppy.kcl[1]}], sketch001)`,
}
@ -585,7 +585,7 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
openSketch = startSketchOn('XY')
|> startProfileAt([-5, 0], %)
|> line(endAbsolute = [0, 5])
|> xLine(5, %)
|> xLine(length = 5)
|> tangentialArcTo([10, 0], %)
`
const viewPortSize = { width: 1000, height: 500 }
@ -1350,7 +1350,7 @@ loft001 = loft([sketch001, sketch002])
)
sketch002 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> xLine(-500, %)
|> xLine(length = -500)
|> tangentialArcTo([-2000, 500], %)
`
await context.addInitScript((initialCode) => {
@ -1444,7 +1444,7 @@ sketch002 = startSketchOn('XZ')
)
sketch002 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> xLine(-500, %)
|> xLine(length = -500)
|> line(endAbsolute = [-2000, 500])
`
await context.addInitScript((initialCode) => {
@ -2365,9 +2365,9 @@ chamfer04 = chamfer(extrude001, length = 5, tags = [getOppositeEdge(seg02)])
}) => {
const initialCode = `sketch001 = startSketchOn('XY')
|> startProfileAt([-20, 20], %)
|> xLine(40, %)
|> yLine(-60, %)
|> xLine(-40, %)
|> xLine(length = 40)
|> yLine(length = -60)
|> xLine(length = -40)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude001 = extrude(sketch001, length = 40)
@ -2383,7 +2383,7 @@ extrude001 = extrude(sketch001, length = 40)
const testPoint = { x: 580, y: 180 }
const [clickOnCap] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
const [clickOnWall] = scene.makeMouseHelpers(testPoint.x, testPoint.y + 70)
const mutatedCode = 'xLine(-40, %, $seg01)'
const mutatedCode = 'xLine(length = -40, tag = $seg01)'
const shellDeclaration =
"shell001 = shell(extrude001, faces = ['end', seg01], thickness = 5)"
@ -2549,9 +2549,9 @@ extrude002 = extrude(sketch002, length = 50)
}) => {
const sketchCode = `sketch001 = startSketchOn('XY')
profile001 = startProfileAt([-20, 20], sketch001)
|> xLine(40, %)
|> yLine(-60, %)
|> xLine(-40, %)
|> xLine(length = 40)
|> yLine(length = -60)
|> xLine(length = -40)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
`
@ -2637,7 +2637,7 @@ profile001 = startProfileAt([-20, 20], sketch001)
)
sketch002 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> xLine(-2000, %)
|> xLine(length = -2000)
sweep001 = sweep(sketch001, path = sketch002)
`
await context.addInitScript((initialCode) => {
@ -2798,7 +2798,7 @@ radius = 8.69
const initialCode = `
sketch002 = startSketchOn('XY')
|> startProfileAt([-2.02, 1.79], %)
|> xLine(2.6, %)
|> xLine(length = 2.6)
sketch001 = startSketchOn('-XY')
|> startProfileAt([-0.48, 1.25], %)
|> angledLine([0, 2.38], %, $rectangleSegmentA001)
@ -2830,7 +2830,7 @@ radius = 8.69
await page.getByText(codeToSelecton).click()
await toolbar.revolveButton.click()
await page.getByText('Edge', { exact: true }).click()
const lineCodeToSelection = `|> xLine(2.6, %)`
const lineCodeToSelection = `|> xLine(length = 2.6)`
await page.getByText(lineCodeToSelection).click()
await cmdBar.progressCmdBar()

View File

@ -32,9 +32,9 @@ profile001 = startProfileAt([57.81, 250.51], sketch001)
extrude001 = extrude(profile001, length = 200)
sketch002 = startSketchOn('XZ')
|> startProfileAt([-73.64, -42.89], %)
|> xLine(173.71, %)
|> xLine(length = 173.71)
|> line(end = [-22.12, -94.4])
|> xLine(-156.98, %)
|> xLine(length = -156.98)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude002 = extrude(sketch002, length = 50)

View File

@ -13,9 +13,9 @@ profile001 = startProfileAt([57.81, 250.51], sketch001)
extrude001 = extrude(profile001, length = 200)
sketch002 = startSketchOn('XZ')
|> startProfileAt([-114, 85.52], %)
|> xLine(265.36, %)
|> xLine(length = 265.36)
|> line(end = [33.17, -261.22])
|> xLine(-297.25, %)
|> xLine(length = -297.25)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude002 = extrude(sketch002, length = 50)

View File

@ -249,7 +249,7 @@ extrude001 = extrude(sketch001, length = 50)
`exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: 45 }, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
|>
@ -305,7 +305,7 @@ extrude001 = extrude(sketch001, length = 50)
.toContainText(`exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: 45 }, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
thing: "blah"`)

View File

@ -48,26 +48,26 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
part001 = startSketchOn('XY')
${startProfileAt2}
|> xLine(width * .5, %)
|> yLine(height, %)
|> xLine(-width * .5, %)
|> xLine(length = width * .5)
|> yLine(length = height)
|> xLine(length = -width * .5)
|> close()
|> hole(screwHole, %)
|> extrude(length = thickness)
part002 = startSketchOn('-XZ')
${startProfileAt3}
|> xLine(width / 4, %)
|> xLine(length = width / 4)
|> tangentialArcTo([width / 2, 0], %)
|> xLine(-width / 4 + wireRadius, %)
|> yLine(wireOffset, %)
|> xLine(length = -width / 4 + wireRadius)
|> yLine(length = wireOffset)
|> arc({
radius = wireRadius,
angleStart = 0,
angleEnd = 180
}, %)
|> yLine(-wireOffset, %)
|> xLine(-width / 4, %)
|> yLine(length = -wireOffset)
|> xLine(length = -width / 4)
|> close()
|> extrude(length = -height)
`
@ -111,7 +111,7 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
'persistCode',
`sketch001 = startSketchOn('XZ')
|> startProfileAt([2.61, -4.01], %)
|> xLine(8.73, %)
|> xLine(length = 8.73)
|> tangentialArcTo([8.33, -1.31], %)`
)
})
@ -157,7 +157,7 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
await expect.poll(u.normalisedEditorCode, { timeout: 1000 })
.toBe(`sketch002 = startSketchOn('XZ')
sketch001 = startProfileAt([12.34, -12.34], sketch002)
|> yLine(12.34, %)
|> yLine(length = 12.34)
`)
}).toPass({ timeout: 5_000, intervals: [1_000] })
@ -691,15 +691,15 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
await click00r(50, 0)
await page.waitForTimeout(100)
codeStr += ` |> xLine(${toU(50, 0)[0]}, %)`
codeStr += ` |> xLine(length = ${toU(50, 0)[0]})`
await expect(u.codeLocator).toHaveText(codeStr)
await click00r(0, 50)
codeStr += ` |> yLine(${toU(0, 50)[1]}, %)`
codeStr += ` |> yLine(length = ${toU(0, 50)[1]})`
await expect(u.codeLocator).toHaveText(codeStr)
await click00r(-50, 0)
codeStr += ` |> xLine(${toU(-50, 0)[0]}, %)`
codeStr += ` |> xLine(length = ${toU(-50, 0)[0]})`
await expect(u.codeLocator).toHaveText(codeStr)
// exit the sketch, reset relative clicker
@ -728,15 +728,15 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// TODO: I couldn't use `toSU` here because of some rounding error causing
// it to be off by 0.01
await click00r(30, 0)
codeStr += ` |> xLine(2.04, %)`
codeStr += ` |> xLine(length = 2.04)`
await expect(u.codeLocator).toHaveText(codeStr)
await click00r(0, 30)
codeStr += ` |> yLine(-2.03, %)`
codeStr += ` |> yLine(length = -2.03)`
await expect(u.codeLocator).toHaveText(codeStr)
await click00r(-30, 0)
codeStr += ` |> xLine(-2.04, %)`
codeStr += ` |> xLine(length = -2.04)`
await expect(u.codeLocator).toHaveText(codeStr)
await click00r(undefined, undefined)
@ -761,8 +761,8 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
scale * 34.8
)}], sketch001)
|> xLine(${roundOff(scale * 139.19)}, %)
|> yLine(-${roundOff(scale * 139.2)}, %)
|> xLine(length = ${roundOff(scale * 139.19)})
|> yLine(length = -${roundOff(scale * 139.2)})
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()`
@ -1018,7 +1018,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
|> xLine(-20, %)
|> xLine(length = -20)
`)
await u.expectCmdLog('[data-message-type="execution-done"]')
@ -1094,8 +1094,8 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
lugSketch = startSketchOn(plane)
|> startProfileAt([origin[0] + lugDiameter / 2, origin[1]], %)
|> angledLineOfYLength({ angle = 60, length = lugHeadLength }, %)
|> xLineTo(0 + .001, %)
|> yLineTo(0, %)
|> xLine(endAbsolute = 0 + .001)
|> yLine(endAbsolute = 0)
|> close()
|> revolve({ axis = "Y" }, %)
@ -1368,7 +1368,7 @@ profile001 = startProfileAt([121.52, 168.25], sketch001)
|> close()
profile002 = startProfileAt([117.2, 56.08], sketch001)
|> line(end = [166.82, 25.89])
|> yLine(-107.86, %)
|> yLine(length = -107.86)
`
)
@ -1456,9 +1456,9 @@ profile002 = startProfileAt([117.2, 56.08], sketch001)
'persistCode',
`sketch001 = startSketchOn('XZ')
profile002 = startProfileAt([40.68, 87.67], sketch001)
|> xLine(239.17, %)
|> xLine(length = 239.17)
profile003 = startProfileAt([206.63, -56.73], sketch001)
|> xLine(-156.32, %)
|> xLine(length = -156.32)
`
)
})
@ -2318,7 +2318,7 @@ profile003 = startProfileAt([3.19, 13.3], sketch002)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
profile004 = startProfileAt([3.15, 9.39], sketch002)
|> xLine(6.92, %)
|> xLine(length = 6.92)
|> line(end = [-7.41, -2.85])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -2556,7 +2556,7 @@ profile001 = startProfileAt([34, 42.66], sketch001)
plane001 = offsetPlane('XZ', offset = 50)
sketch002 = startSketchOn(plane001)
profile002 = startProfileAt([39.43, 172.21], sketch002)
|> xLine(183.99, %)
|> xLine(length = 183.99)
|> line(end = [-77.95, -145.93])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -2609,7 +2609,7 @@ profile001 = startProfileAt([34, 42.66], sketch001)
plane001 = offsetPlane('XZ', offset = 50)
sketch002 = startSketchOn(plane001)
profile002 = startProfileAt([39.43, 172.21], sketch002)
|> xLine(183.99, %)
|> xLine(length = 183.99)
|> line(end = [-77.95, -145.93])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()

View File

@ -62,14 +62,14 @@ armThick = 0.5
totalLen = 9.5
part001 = startSketchOn('-XZ')
|> startProfileAt([0, 0], %)
|> yLine(baseHeight, %)
|> xLine(baseLen, %)
|> yLine(length = baseHeight)
|> xLine(length = baseLen)
|> angledLineToY({
angle = topAng,
to = totalHeightHalf,
}, %, $seg04)
|> xLineTo(totalLen, %, $seg03)
|> yLine(-armThick, %, $seg01)
|> xLine(endAbsolute = totalLen, tag = $seg03)
|> yLine(length = -armThick, tag = $seg01)
|> angledLineThatIntersects({
angle = HALF_TURN,
offset = -armThick,
@ -80,15 +80,15 @@ part001 = startSketchOn('-XZ')
angle = -bottomAng,
to = -totalHeightHalf - armThick,
}, %, $seg02)
|> xLineTo(segEndX(seg03, %) + 0, %)
|> yLine(-segLen(seg01, %), %)
|> xLine(length = endAbsolute = segEndX(seg03) + 0)
|> yLine(length = -segLen(seg01, %))
|> angledLineThatIntersects({
angle = HALF_TURN,
offset = -armThick,
intersectTag = seg02
}, %)
|> angledLineToY([segAng(seg02, %) + 180, -baseHeight], %)
|> xLineTo(ZERO, %)
|> xLine(endAbsolute = ZERO)
|> close()
|> extrude(length = 4)`
)
@ -443,7 +443,7 @@ test(
await page.waitForTimeout(500)
code += `
|> xLine(7.25, %)`
|> xLine(length = 7.25)`
await expect(page.locator('.cm-content')).toHaveText(code)
await page
@ -609,7 +609,7 @@ test.describe(
await page.waitForTimeout(100)
code += `
|> xLine(7.25, %)`
|> xLine(length = 7.25)`
await expect(u.codeLocator).toHaveText(code)
await page
@ -704,7 +704,7 @@ test.describe(
await page.waitForTimeout(100)
code += `
|> xLine(184.3, %)`
|> xLine(length = 184.3)`
await expect(u.codeLocator).toHaveText(code)
await page

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -1,5 +1,5 @@
{
"original_source_code": "sketch001 = startSketchOn('XZ')\nprofile001 = startProfileAt([57.81, 250.51], sketch001)\n |> line(end = [121.13, 56.63], tag = $seg02)\n |> line(end = [83.37, -34.61], tag = $seg01)\n |> line(end = [19.66, -116.4])\n |> line(end = [-221.8, -41.69])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude001 = extrude(profile001, length = 200)\nsketch002 = startSketchOn('XZ')\n |> startProfileAt([-73.64, -42.89], %)\n |> xLine(173.71, %)\n |> line(end = [-22.12, -94.4])\n |> xLine(-156.98, %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude002 = extrude(sketch002, length = 50)\nsketch003 = startSketchOn('XY')\n |> startProfileAt([52.92, 157.81], %)\n |> angledLine([0, 176.4], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 53.4\n ], %, $rectangleSegmentB001)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %, $rectangleSegmentC001)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude003 = extrude(sketch003, length = 20)\n",
"original_source_code": "sketch001 = startSketchOn('XZ')\nprofile001 = startProfileAt([57.81, 250.51], sketch001)\n |> line(end = [121.13, 56.63], tag = $seg02)\n |> line(end = [83.37, -34.61], tag = $seg01)\n |> line(end = [19.66, -116.4])\n |> line(end = [-221.8, -41.69])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude001 = extrude(profile001, length = 200)\nsketch002 = startSketchOn('XZ')\n |> startProfileAt([-73.64, -42.89], %)\n |> xLine(length = 173.71)\n |> line(end = [-22.12, -94.4])\n |> xLine(length = -156.98)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude002 = extrude(sketch002, length = 50)\nsketch003 = startSketchOn('XY')\n |> startProfileAt([52.92, 157.81], %)\n |> angledLine([0, 176.4], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 53.4\n ], %, $rectangleSegmentB001)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %, $rectangleSegmentC001)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude003 = extrude(sketch003, length = 20)\n",
"prompt": "make this neon green please, use #39FF14",
"source_ranges": [
{
@ -29,5 +29,5 @@
}
}
],
"kcl_version": "0.2.45"
"kcl_version": "0.2.48"
}

View File

@ -83,9 +83,9 @@ export const TEST_CODE_GIZMO = `part001 = startSketchOn('XZ')
|> line(end = [7.13, 4 + 0])
|> angledLine({ angle: 3 + 0, length: 3.14 + 0 }, %)
|> line(endAbsolute = [20.14 + 0, -0.14 + 0])
|> xLineTo(29 + 0, %)
|> yLine(-3.14 + 0, %, $a)
|> xLine(1.63, %)
|> xLine(endAbsolute = 29 + 0)
|> yLine(length = -3.14 + 0, tag = $a)
|> xLine(length = 1.63)
|> angledLineOfXLength({ angle: 3 + 0, length: 3.14 }, %)
|> angledLineOfYLength({ angle: 30, length: 3 + 0 }, %)
|> angledLineToX({ angle: 22.14 + 0, to: 12 }, %)
@ -150,7 +150,7 @@ sketch001 = startSketchOn(box, revolveAxis)
sketch001 = startSketchOn('XZ')
|> startProfileAt([0.0, 0.0], %)
|> xLine(0.0, %)
|> xLine(length = 0.0)
|> close()
`

View File

@ -122,7 +122,7 @@ test.describe('Test network and connection issues', () => {
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${commonPoints.startAt}, sketch001)
|> xLine(${commonPoints.num1}, %)`)
|> xLine(length = ${commonPoints.num1})`)
// Expect the network to be up
await expect(networkToggle).toContainText('Connected')
@ -215,7 +215,7 @@ test.describe('Test network and connection issues', () => {
await expect.poll(u.normalisedEditorCode)
.toBe(`sketch001 = startSketchOn('XZ')
profile001 = startProfileAt([12.34, -12.34], sketch001)
|> xLine(12.34, %)
|> xLine(length = 12.34)
|> line(end = [-12.34, 12.34])
`)
@ -225,9 +225,9 @@ profile001 = startProfileAt([12.34, -12.34], sketch001)
await expect.poll(u.normalisedEditorCode)
.toBe(`sketch001 = startSketchOn('XZ')
profile001 = startProfileAt([12.34, -12.34], sketch001)
|> xLine(12.34, %)
|> xLine(length = 12.34)
|> line(end = [-12.34, 12.34])
|> xLine(-12.34, %)
|> xLine(length = -12.34)
`)

View File

@ -18,7 +18,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
|> xLine(-20, %)
|> xLine(length = -20)
`
)
})
@ -57,7 +57,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
.click()
await expect(page.locator('.cm-content')).toHaveText(
`length001 = 20sketch001 = startSketchOn('XY') |> startProfileAt([-10, -10], %) |> line(end = [20, 0]) |> angledLine([90, length001], %) |> xLine(-20, %)`
`length001 = 20sketch001 = startSketchOn('XY') |> startProfileAt([-10, -10], %) |> line(end = [20, 0]) |> angledLine([90, length001], %) |> xLine(length = -20)`
)
// Make sure we didn't pop out of sketch mode.
@ -89,9 +89,9 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> line(end = [41.19, 58.97 + 5])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 120], %)
|> xLine(-385.34, %, $seg_what)
|> yLine(-170.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -385.34, tag = $seg_what)
|> yLine(length = -170.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -153,9 +153,9 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
@ -285,9 +285,9 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -395,9 +395,9 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -508,9 +508,9 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -610,9 +610,9 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -696,9 +696,9 @@ part001 = startSketchOn('XZ')
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -748,16 +748,16 @@ part002 = startSketchOn('XZ')
{
constraintName: 'Vertical',
codeAfter: [
`|> yLine(130.4, %)`,
`|> yLine(77.79, %)`,
`|> yLine(48.97, %)`,
`|> yLine(length = 130.4)`,
`|> yLine(length = 77.79)`,
`|> yLine(length = 48.97)`,
],
},
{
codeAfter: [
`|> xLine(74.36, %)`,
`|> xLine(9.16, %)`,
`|> xLine(51.19, %)`,
`|> xLine(length = 74.36)`,
`|> xLine(length = 9.16)`,
`|> xLine(length = 51.19)`,
],
constraintName: 'Horizontal',
},
@ -776,9 +776,9 @@ part002 = startSketchOn('XZ')
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -876,9 +876,9 @@ part002 = startSketchOn('XZ')
|> line(end = [9.16, 77.79])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -957,9 +957,9 @@ part002 = startSketchOn('XZ')
|> line(end = [9.16, 77.79])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -1061,7 +1061,7 @@ part002 = startSketchOn('XZ')
await pollEditorLinesSelectedLength(page, 1)
let activeLinesContent = await page.locator('.cm-activeLine').all()
await expect(activeLinesContent[0]).toHaveText(`|> xLine(3.13, %)`)
await expect(activeLinesContent[0]).toHaveText(`|> xLine(length = 3.13)`)
// Wait for code editor to settle.
await page.waitForTimeout(2000)
@ -1105,7 +1105,9 @@ part002 = startSketchOn('XZ')
await pollEditorLinesSelectedLength(page, 1)
activeLinesContent = await page.locator('.cm-activeLine').all()
await expect(activeLinesContent[0]).toHaveText(`|> xLine(length001, %)`)
await expect(activeLinesContent[0]).toHaveText(
`|> xLine(length = length001)`
)
// checking the count of the overlays is a good proxy check that the client sketch scene is in a good state
await expect(page.getByTestId('segment-overlay')).toHaveCount(2)
@ -1125,7 +1127,6 @@ test.describe('Electron constraint tests', () => {
path.join(bracketDir, 'main.kcl')
)
})
const [clickHandler] = scene.makeMouseHelpers(600, 300)
await test.step('setup test', async () => {
await homePage.expectState({
@ -1142,8 +1143,12 @@ test.describe('Electron constraint tests', () => {
})
await test.step('Double click to constrain', async () => {
await clickHandler()
await page.getByRole('button', { name: 'Edit Sketch' }).click()
// Enter sketch edit mode via feature tree
await toolbar.openPane('feature-tree')
const op = await toolbar.getFeatureTreeOperation('Sketch', 0)
await op.dblclick()
await toolbar.closePane('feature-tree')
const child = page
.locator('.segment-length-label-text')
.first()

View File

@ -212,10 +212,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|> line(end = [0.5, -14 + 0])
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> line(endAbsolute = [5 + 33, 20 + 11.5 + 0])
|> xLineTo(5 + 9 - 5, %)
|> yLineTo(20 + -10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> xLine(endAbsolute = 5 + 9 - 5)
|> yLine(endAbsolute = 20 + -10.77, tag = $a)
|> xLine(length = 26.04)
|> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 5 + 26 }, %)
@ -239,7 +239,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await u.expectCmdLog('[data-message-type="execution-done"]')
await u.closeDebugPanel()
await page.getByText('xLineTo(5 + 9 - 5, %)').click()
await page.getByText('xLine(endAbsolute = 5 + 9 - 5)').click()
await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Edit Sketch' }).click()
await page.waitForTimeout(500)
@ -358,9 +358,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await clickConstrained({
hoverPos: { x: xLineTo.x, y: xLineTo.y },
constraintType: 'xAbsolute',
expectBeforeUnconstrained: 'xLineTo(5 + 9 - 5, %)',
expectAfterUnconstrained: 'xLineTo(9, %)',
expectFinal: 'xLineTo(xAbs002, %)',
expectBeforeUnconstrained: 'xLine(endAbsolute = 5 + 9 - 5)',
expectAfterUnconstrained: 'xLine(endAbsolute = 9)',
expectFinal: 'xLine(endAbsolute = xAbs002)',
ang: ang + 180,
steps: 8,
locator: '[data-overlay-toolbar-index="3"]',
@ -386,10 +386,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|> line(end = [0.5, yRel001])
|> angledLine({ angle = angle001, length = len001 }, %)
|> line(endAbsolute = [33, yAbs001])
|> xLineTo(xAbs002, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> xLine(endAbsolute = xAbs002)
|> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04)
|> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
`
)
@ -404,7 +404,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await u.expectCmdLog('[data-message-type="execution-done"]')
await u.closeDebugPanel()
await page.getByText('xLine(26.04, %)').click()
await page.getByText('xLine(length = 26.04)').click()
await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Edit Sketch' }).click()
await page.waitForTimeout(500)
@ -424,9 +424,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await clickUnconstrained({
hoverPos: { x: yLineTo.x, y: yLineTo.y - 200 },
constraintType: 'yAbsolute',
expectBeforeUnconstrained: 'yLineTo(-10.77, %, $a)',
expectAfterUnconstrained: 'yLineTo(yAbs002, %, $a)',
expectFinal: 'yLineTo(-10.77, %, $a)',
expectBeforeUnconstrained: 'yLine(endAbsolute = -10.77, tag = $a)',
expectAfterUnconstrained: 'yLine(endAbsolute = yAbs002, tag = $a)',
expectFinal: 'yLine(endAbsolute = -10.77, tag = $a)',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="4"]',
})
@ -437,9 +437,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await clickUnconstrained({
hoverPos: { x: xLine.x, y: xLine.y },
constraintType: 'xRelative',
expectBeforeUnconstrained: 'xLine(26.04, %)',
expectAfterUnconstrained: 'xLine(xRel002, %)',
expectFinal: 'xLine(26.04, %)',
expectBeforeUnconstrained: 'xLine(length = 26.04)',
expectAfterUnconstrained: 'xLine(length = xRel002)',
expectFinal: 'xLine(length = 26.04)',
steps: 10,
ang: ang + 180,
locator: '[data-overlay-toolbar-index="5"]',
@ -459,10 +459,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|> line(end = [0.5, -14 + 0])
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> line(endAbsolute = [33, 11.5 + 0])
|> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> xLine(endAbsolute = 9 - 5)
|> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04)
|> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
@ -488,7 +488,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await u.closeDebugPanel()
await page.waitForTimeout(500)
await page.getByText('xLineTo(9 - 5, %)').click()
await page.getByText('xLine(endAbsolute = 9 - 5)').click()
await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Edit Sketch' }).click()
await page.waitForTimeout(500)
@ -506,9 +506,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await clickConstrained({
hoverPos: { x: yLine.x, y: yLine.y },
constraintType: 'yRelative',
expectBeforeUnconstrained: 'yLine(21.14 + 0, %)',
expectAfterUnconstrained: 'yLine(21.14, %)',
expectFinal: 'yLine(yRel001, %)',
expectBeforeUnconstrained: 'yLine(length = 21.14 + 0)',
expectAfterUnconstrained: 'yLine(length = 21.14)',
expectFinal: 'yLine(length = yRel001)',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="6"]',
})
@ -591,10 +591,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|> line(end = [0.5, -14 + 0])
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> line(endAbsolute = [33, 11.5 + 0])
|> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> xLine(endAbsolute = 9 - 5)
|> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04)
|> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
@ -619,7 +619,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await u.expectCmdLog('[data-message-type="execution-done"]')
await u.closeDebugPanel()
await page.getByText('xLineTo(9 - 5, %)').click()
await page.getByText('xLine(endAbsolute = 9 - 5)').click()
await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Edit Sketch' }).click()
await page.waitForTimeout(500)
@ -755,10 +755,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|> line(end = [0.5, -14 + 0])
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> line(endAbsolute = [33, 11.5 + 0])
|> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> xLine(endAbsolute = 9 - 5)
|> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04)
|> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
@ -783,7 +783,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await u.expectCmdLog('[data-message-type="execution-done"]')
await u.closeDebugPanel()
await page.getByText('xLineTo(9 - 5, %)').click()
await page.getByText('xLine(endAbsolute = 9 - 5)').click()
await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Edit Sketch' }).click()
await page.waitForTimeout(500)
@ -943,10 +943,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|> line(end = [0.5, -14 + 0])
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> line(endAbsolute = [33, 11.5 + 0])
|> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> xLine(endAbsolute = 9 - 5)
|> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04)
|> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
@ -972,7 +972,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await u.expectCmdLog('[data-message-type="execution-done"]')
await u.closeDebugPanel()
await page.getByText('xLineTo(9 - 5, %)').click()
await page.getByText('xLine(endAbsolute = 9 - 5)').click()
await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Edit Sketch' }).click()
await page.waitForTimeout(500)
@ -1056,7 +1056,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
ang = await u.getAngle(`[data-overlay-index="${6}"]`)
await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'yLine(21.14 + 0, %)',
codeToBeDeleted: 'yLine(length = 21.14 + 0)',
stdLibFnName: 'yLine',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="6"]',
@ -1066,7 +1066,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
ang = await u.getAngle(`[data-overlay-index="${5}"]`)
await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'xLine(26.04, %)',
codeToBeDeleted: 'xLine(length = 26.04)',
stdLibFnName: 'xLine',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="5"]',
@ -1076,7 +1076,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
ang = await u.getAngle(`[data-overlay-index="${4}"]`)
await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'yLineTo(-10.77, %, $a)',
codeToBeDeleted: 'yLine(endAbsolute = -10.77, tag = $a)',
stdLibFnName: 'yLineTo',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="4"]',
@ -1086,7 +1086,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
ang = await u.getAngle(`[data-overlay-index="${3}"]`)
await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'xLineTo(9 - 5, %)',
codeToBeDeleted: 'xLine(endAbsolute = 9 - 5)',
stdLibFnName: 'xLineTo',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="3"]',
@ -1151,10 +1151,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
const cases = [
'line(end = [22, 2], tag = $seg01)',
'angledLine([5, 23.03], %, $seg01)',
'xLine(23, %, $seg01)',
'yLine(-8, %, $seg01)',
'xLineTo(30, %, $seg01)',
'yLineTo(-4, %, $seg01)',
'xLine(length = 23, tag = $seg01)',
'yLine(length = -8, tag = $seg01)',
'xLine(endAbsolute = 30, tag = $seg01)',
'yLine(endAbsolute = -4, tag = $seg01)',
'angledLineOfXLength([3, 30], %, $seg01)',
'angledLineOfXLength({ angle = 3, length = 30 }, %, $seg01)',
'angledLineOfYLength([3, 1.5], %, $seg01)',
@ -1167,7 +1167,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
for (const doesHaveTagOutsideSketch of [true, false]) {
for (const lineOfInterest of cases) {
const isObj = lineOfInterest.includes('{ angle = 3,')
test(`${lineOfInterest.split('(')[0]}${isObj ? '-[obj-input]' : ''}${
test(`${lineOfInterest.split('=')[0]}${isObj ? '-[obj-input]' : ''}${
doesHaveTagOutsideSketch ? '-[tagOutsideSketch]' : ''
}`, async ({ page, editor, homePage }) => {
await page.addInitScript(
@ -1294,19 +1294,19 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
after: `line(end = [22.94, 2.01], tag = $seg01)`,
},
{
before: `xLine(23 + 0, %, $seg01)`,
before: `xLine(length = 23 + 0, tag = $seg01)`,
after: `line(end = [23, 0], tag = $seg01)`,
},
{
before: `yLine(-8 + 0, %, $seg01)`,
before: `yLine(length = -8 + 0, tag = $seg01)`,
after: `line(end = [0, -8], tag = $seg01)`,
},
{
before: `xLineTo(30 + 0, %, $seg01)`,
before: `xLine(endAbsolute = 30 + 0, tag = $seg01)`,
after: `line(end = [25, 0], tag = $seg01)`,
},
{
before: `yLineTo(-4 + 0, %, $seg01)`,
before: `yLine(endAbsolute = -4 + 0, tag = $seg01)`,
after: `line(end = [0, -10], tag = $seg01)`,
},
{
@ -1329,7 +1329,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
for (const { before, after } of cases) {
const isObj = before.includes('{ angle = 3')
test(`${before.split('(')[0]}${isObj ? '-[obj-input]' : ''}`, async ({
test(`${before.split('=')[0]}${isObj ? '-[obj-input]' : ''}`, async ({
page,
editor,
homePage,

View File

@ -75,7 +75,7 @@ test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${commonPoints.startAt}, sketch001)
|> xLine(${commonPoints.num1}, %)`)
|> xLine(length = ${commonPoints.num1})`)
await page.waitForTimeout(100)
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
@ -83,17 +83,17 @@ test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
|> xLine(${commonPoints.num1}, %)
|> yLine(${commonPoints.num1 + 0.01}, %)`)
|> xLine(length = ${commonPoints.num1})
|> yLine(length = ${commonPoints.num1 + 0.01})`)
await page.waitForTimeout(100)
await page.mouse.click(startXPx, 500 - PUR * 20)
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
|> xLine(${commonPoints.num1}, %)
|> yLine(${commonPoints.num1 + 0.01}, %)
|> xLine(${commonPoints.num2 * -1}, %)`)
|> xLine(length = ${commonPoints.num1})
|> yLine(length = ${commonPoints.num1 + 0.01})
|> xLine(length = ${commonPoints.num2 * -1})`)
// deselect line tool
await page.getByRole('button', { name: 'line Line', exact: true }).click()
@ -158,7 +158,9 @@ test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
// check the same selection again by putting cursor in code first then selecting axis
await test.step(`Same selection but code selection then axis`, async () => {
await page.getByText(` |> xLine(${commonPoints.num2 * -1}, %)`).click()
await page
.getByText(` |> xLine(length = ${commonPoints.num2 * -1})`)
.click()
await page.keyboard.down('Shift')
await constrainButton.click()
await expect(absXButton).toBeDisabled()
@ -182,7 +184,9 @@ test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
process.platform === 'linux' ? 'Control' : 'Meta'
)
await page.waitForTimeout(100)
await page.getByText(` |> xLine(${commonPoints.num2 * -1}, %)`).click()
await page
.getByText(` |> xLine(length = ${commonPoints.num2 * -1})`)
.click()
await expect(page.locator('.cm-cursor')).toHaveCount(2)
await page.waitForTimeout(500)
@ -537,9 +541,9 @@ profile003 = startProfileAt([40.16, -120.48], sketch006)
|> line(end = [7.13, 4 + 0])
|> angledLine({ angle = 3 + 0, length = 3.14 + 0 }, %)
|> line(endAbsolute = [20.14 + 0, -0.14 + 0])
|> xLineTo(29 + 0, %)
|> yLine(-3.14 + 0, %, $a)
|> xLine(1.63, %)
|> xLine(endAbsolute = 29 + 0)
|> yLine(length = -3.14 + 0, tag = $a)
|> xLine(length = 1.63)
|> angledLineOfXLength({ angle = 3 + 0, length = 3.14 }, %)
|> angledLineOfYLength({ angle = 30, length = 3 + 0 }, %)
|> angledLineToX({ angle = 22.14 + 0, to = 12 }, %)

View File

@ -52,14 +52,14 @@ armThick = 0.5
totalLen = 9.5
part001 = startSketchOn('-XZ')
|> startProfileAt([0, 0], %)
|> yLine(baseHeight, %)
|> xLine(baseLen, %)
|> yLine(length = baseHeight)
|> xLine(length = baseLen)
|> angledLineToY({
angle = topAng,
to = totalHeightHalf,
}, %, $seg04)
|> xLineTo(totalLen, %, $seg03)
|> yLine(-armThick, %, $seg01)
|> xLine(endAbsolute = totalLen, tag = $seg03)
|> yLine(length = -armThick, tag = $seg01)
|> angledLineThatIntersects({
angle = HALF_TURN,
offset = -armThick,
@ -70,15 +70,15 @@ part001 = startSketchOn('-XZ')
angle = -bottomAng,
to = -totalHeightHalf - armThick,
}, %, $seg02)
|> xLineTo(segEndX(seg03) + 0, %)
|> yLine(-segLen(seg01), %)
|> xLine(endAbsolute = segEndX(seg03) + 0)
|> yLine(length = -segLen(seg01))
|> angledLineThatIntersects({
angle = HALF_TURN,
offset = -armThick,
intersectTag = seg02
}, %)
|> angledLineToY([segAng(seg02) + 180, -baseHeight], %)
|> xLineTo(ZERO, %)
|> xLine(endAbsolute = ZERO)
|> close()
|> extrude(length = 4)`
)

View File

@ -91,7 +91,7 @@
"fmt-check": "prettier --check ./src *.ts *.json *.js ./e2e ./packages ./rust/kcl-language-server",
"fetch:wasm": "./scripts/get-latest-wasm-bundle.sh",
"fetch:wasm:windows": "./scripts/get-latest-wasm-bundle.ps1",
"fetch:samples": "rm -rf public/kcl-samples* && curl -L -o public/kcl-samples.zip https://github.com/KittyCAD/kcl-samples/archive/refs/heads/next.zip && unzip -o public/kcl-samples.zip -d public && mv public/kcl-samples-* public/kcl-samples",
"fetch:samples": "rm -rf public/kcl-samples* && curl -L -o public/kcl-samples.zip https://github.com/KittyCAD/kcl-samples/archive/refs/heads/achalmers/kw-args-xylineto.zip && unzip -o public/kcl-samples.zip -d public && mv public/kcl-samples-* public/kcl-samples",
"build:wasm-dev": "yarn wasm-prep && (cd rust && wasm-pack build kcl-wasm-lib --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt",
"build:wasm:nocopy": "yarn wasm-prep && cd rust && wasm-pack build kcl-wasm-lib --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings",
"build:wasm": "yarn build:wasm:nocopy && cp rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public && yarn fmt",

View File

@ -29,6 +29,7 @@ export const kclHighlight = styleTags({
'ObjectProperty/PropertyName': t.definition(t.propertyName),
'LabeledArgument/ArgumentLabel': t.definition(t.propertyName),
TagDeclarator: t.tagName,
PrimitiveType: t.typeName,
'( )': t.paren,
'{ }': t.brace,
'[ ]': t.bracket,

View File

@ -77,7 +77,7 @@ ArgumentList { "(" commaSep<LabeledArgument | expression> ")" }
type[@isGroup=Type] {
@specialize[@name=PrimitiveType]<
identifier,
"string" | "number" | "bool" | "sketch" | "sketch_surface" | "solid"
"bool" | "number" | "string" | "tag" | "Sketch" | "SketchSurface" | "Solid" | "Plane"
> |
ArrayType { type !member "[" "]" } |
ObjectType { "{" commaSep<ObjectProperty { PropertyName ":" type }> "}" }

View File

@ -1,7 +1,2 @@
.vscode
.idea
.DS_Store
screenshots/main.kcl
step/main.kcl
/project.toml
project.toml
thumbnail.png

View File

@ -14,11 +14,11 @@ fn dividerSketch(plane) {
|> tangentialArcTo([-16.6, profileStartY(%) - 15.52], %)
|> tangentialArcTo([-18.38, profileStartY(%) - 18.63], %)
|> line(end = [-1.25, -2.6])
|> xLine(6.04, %)
|> xLine(length = 6.04)
|> line(end = [6.68, 7.87])
|> tangentialArcTo([10.06, profileStartY(%) - 12.69], %)
|> line(end = [7.28, -8.47])
|> xLine(5.98, %)
|> xLine(length = 5.98)
|> line(end = [-1.3, 3.01])
|> tangentialArcTo([22.45, profileStartY(%) - 2.84], %)
|> tangentialArcTo([25.08, profileStartY(%) + 6.42], %)
@ -106,7 +106,7 @@ export fn backSlats(plane, length) {
fn armRestPath(plane) {
sketch005 = startSketchOn(plane)
|> startProfileAt([20, 33], %)
|> xLine(-20, %)
|> xLine(length = -20)
|> arc({
angleStart = 90,
angleEnd = 180,
@ -118,10 +118,10 @@ fn armRestPath(plane) {
fn armRestProfile(plane, offset) {
sketch006 = startSketchOn(plane)
|> startProfileAt([offset, 32.4], %)
|> xLine(1.3, %)
|> xLine(length = 1.3)
|> line(end = [0.3, 0.6])
|> line(end = [-0.3, 0.6])
|> xLine(-2.6, %)
|> xLine(length = -2.6)
|> line(end = [-0.3, -0.6])
|> line(end = [0.3, -0.6])
|> close()

View File

@ -22,33 +22,33 @@ fn rail8020(originStart, railHeight, railLength) {
angleEnd = 0,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(0.1 * railHeight, %)
|> xLine(length = 0.1 * railHeight)
|> arc({
angleStart = 180,
angleEnd = 0,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(0.06 * railHeight, %, $edge1)
|> yLine(0.087 * railHeight, %, $edge2)
|> xLine(-0.183 * railHeight, %, $edge3)
|> xLine(length = 0.06 * railHeight, tag = $edge1)
|> yLine(length = 0.087 * railHeight, tag = $edge2)
|> xLine(length = -0.183 * railHeight, tag = $edge3)
|> angledLineToY({
angle = 45,
to = (1 - 0.356) / 2 * railHeight + originStart[1]
}, %, $edge4)
|> xLine(0.232 * railHeight, %, $edge5)
|> xLine(length = 0.232 * railHeight, tag = $edge5)
|> angledLineToY({
angle = -45,
to = 0.087 * railHeight + originStart[1]
}, %, $edge6)
|> xLine(-0.183 * railHeight, %, $edge7)
|> yLine(-0.087 * railHeight, %, $edge8)
|> xLine(0.06 * railHeight, %)
|> xLine(length = -0.183 * railHeight, tag = $edge7)
|> yLine(length = -0.087 * railHeight, tag = $edge8)
|> xLine(length = 0.06 * railHeight)
|> arc({
angleStart = 180,
angleEnd = 0,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(0.1 * railHeight, %)
|> xLine(length = 0.1 * railHeight)
|> arc({
angleStart = 180,
angleEnd = 0,
@ -66,33 +66,33 @@ fn rail8020(originStart, railHeight, railLength) {
angleEnd = 90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(0.1 * railHeight, %)
|> yLine(length = 0.1 * railHeight)
|> arc({
angleStart = 270,
angleEnd = 90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(0.06 * railHeight, %, $edge9)
|> xLine(-0.087 * railHeight, %, $edge10)
|> yLine(-0.183 * railHeight, %, $edge11) // edge11
|> yLine(length = 0.06 * railHeight, tag = $edge9)
|> xLine(length = -0.087 * railHeight, tag = $edge10)
|> yLine(length = -0.183 * railHeight, tag = $edge11) // edge11
|> angledLineToX({
angle = 135,
to = ((1 - 0.356) / 2 + 0.356) * railHeight + originStart[0]
}, %, $edge12) // edge12
|> yLine(0.232 * railHeight, %, $edge13) // 13
|> yLine(length = 0.232 * railHeight, tag = $edge13) // 13
|> angledLineToX({
angle = 45,
to = (1 - 0.087) * railHeight + originStart[0]
}, %, $edge14) // 14
|> yLine(-0.183 * railHeight, %, $edge15) // 15
|> xLine(0.087 * railHeight, %, $edge16)
|> yLine(0.06 * railHeight, %)
|> yLine(length = -0.183 * railHeight, tag = $edge15) // 15
|> xLine(length = 0.087 * railHeight, tag = $edge16)
|> yLine(length = 0.06 * railHeight)
|> arc({
angleStart = 270,
angleEnd = 90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(0.1 * railHeight, %)
|> yLine(length = 0.1 * railHeight)
|> arc({
angleStart = 270,
angleEnd = 90,
@ -110,33 +110,33 @@ fn rail8020(originStart, railHeight, railLength) {
angleEnd = -180,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(-0.1 * railHeight, %)
|> xLine(length = -0.1 * railHeight)
|> arc({
angleStart = 0,
angleEnd = -180,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(-0.06 * railHeight, %, $edge17)
|> yLine(-0.087 * railHeight, %, $edge18)
|> xLine(0.183 * railHeight, %, $edge19)
|> xLine(length = -0.06 * railHeight, tag = $edge17)
|> yLine(length = -0.087 * railHeight, tag = $edge18)
|> xLine(length = 0.183 * railHeight, tag = $edge19)
|> angledLineToY({
angle = 45,
to = ((1 - 0.356) / 2 + 0.356) * railHeight + originStart[1]
}, %, $edge20)
|> xLine(-0.232 * railHeight, %, $edge21)
|> xLine(length = -0.232 * railHeight, tag = $edge21)
|> angledLineToY({
angle = 135,
to = (1 - 0.087) * railHeight + originStart[1]
}, %, $edge22)
|> xLine(0.183 * railHeight, %, $edge23)
|> yLine(0.087 * railHeight, %, $edge24)
|> xLine(-0.06 * railHeight, %)
|> xLine(length = 0.183 * railHeight, tag = $edge23)
|> yLine(length = 0.087 * railHeight, tag = $edge24)
|> xLine(length = -0.06 * railHeight)
|> arc({
angleStart = 0,
angleEnd = -180,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(-0.1 * railHeight, %)
|> xLine(length = -0.1 * railHeight)
|> arc({
angleStart = 0,
angleEnd = -180,
@ -154,33 +154,33 @@ fn rail8020(originStart, railHeight, railLength) {
angleEnd = -90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(-0.1 * railHeight, %)
|> yLine(length = -0.1 * railHeight)
|> arc({
angleStart = 90,
angleEnd = -90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(-0.06 * railHeight, %, $edge25)
|> xLine(0.087 * railHeight, %, $edge26)
|> yLine(0.183 * railHeight, %, $edge27)
|> yLine(length = -0.06 * railHeight, tag = $edge25)
|> xLine(length = 0.087 * railHeight, tag = $edge26)
|> yLine(length = 0.183 * railHeight, tag = $edge27)
|> angledLineToX({
angle = 135,
to = (1 - 0.356) / 2 * railHeight + originStart[0]
}, %, $edge28)
|> yLine(-0.232 * railHeight, %, $edge29)
|> yLine(length = -0.232 * railHeight, tag = $edge29)
|> angledLineToX({
angle = 45,
to = 0.087 * railHeight + originStart[0]
}, %, $edge30)
|> yLine(0.183 * railHeight, %, $edge31)
|> xLine(-0.087 * railHeight, %, $edge32)
|> yLine(-0.06 * railHeight, %)
|> yLine(length = 0.183 * railHeight, tag = $edge31)
|> xLine(length = -0.087 * railHeight, tag = $edge32)
|> yLine(length = -0.06 * railHeight)
|> arc({
angleStart = 90,
angleEnd = -90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(-0.1 * railHeight, %)
|> yLine(length = -0.1 * railHeight)
|> arc({
angleStart = 90,
angleEnd = -90,

View File

@ -8,8 +8,6 @@ The samples can be browsed in our documentation at <https://zoo.dev/docs/kcl-sam
## Guidelines for adding samples
Merge PRs to the `next` branch, not main. When we release Modeling App, we will merge this repo's `next` into `main`. This way, `main` is always compatible with the latest ZMA release.
KCL samples conform to a set of style guidelines to ensure consistency and readability.
1. **File Naming:** Name your KCL files descriptively and concisely, using hyphens to separate words (e.g., flange.kcl, ball-bearing.kcl).
@ -57,18 +55,18 @@ When you submit a PR to add or modify KCL samples, images and STEP files will be
[![food-service-spatula](screenshots/food-service-spatula.png)](food-service-spatula/main.kcl)
#### [french-press](french-press/main.kcl) ([step](step/french-press.step)) ([screenshot](screenshots/french-press.png))
[![french-press](screenshots/french-press.png)](french-press/main.kcl)
#### [gear-rack](gear-rack/main.kcl) ([step](step/gear-rack.step)) ([screenshot](screenshots/gear-rack.png))
[![gear-rack](screenshots/gear-rack.png)](gear-rack/main.kcl)
#### [gear](gear/main.kcl) ([step](step/gear.step)) ([screenshot](screenshots/gear.png))
[![gear](screenshots/gear.png)](gear/main.kcl)
#### [gridfinity-baseplate-magnets](gridfinity-baseplate-magnets/main.kcl) ([step](step/gridfinity-baseplate-magnets.step)) ([screenshot](screenshots/gridfinity-baseplate-magnets.png))
[![gridfinity-baseplate-magnets](screenshots/gridfinity-baseplate-magnets.png)](gridfinity-baseplate-magnets/main.kcl)
#### [gear-rack](gear-rack/main.kcl) ([step](step/gear-rack.step)) ([screenshot](screenshots/gear-rack.png))
[![gear-rack](screenshots/gear-rack.png)](gear-rack/main.kcl)
#### [gridfinity-baseplate](gridfinity-baseplate/main.kcl) ([step](step/gridfinity-baseplate.step)) ([screenshot](screenshots/gridfinity-baseplate.png))
[![gridfinity-baseplate](screenshots/gridfinity-baseplate.png)](gridfinity-baseplate/main.kcl)
#### [gridfinity-bins-stacking-lip](gridfinity-bins-stacking-lip/main.kcl) ([step](step/gridfinity-bins-stacking-lip.step)) ([screenshot](screenshots/gridfinity-bins-stacking-lip.png))
[![gridfinity-bins-stacking-lip](screenshots/gridfinity-bins-stacking-lip.png)](gridfinity-bins-stacking-lip/main.kcl)
#### [gridfinity-baseplate-magnets](gridfinity-baseplate-magnets/main.kcl) ([step](step/gridfinity-baseplate-magnets.step)) ([screenshot](screenshots/gridfinity-baseplate-magnets.png))
[![gridfinity-baseplate-magnets](screenshots/gridfinity-baseplate-magnets.png)](gridfinity-baseplate-magnets/main.kcl)
#### [gridfinity-bins](gridfinity-bins/main.kcl) ([step](step/gridfinity-bins.step)) ([screenshot](screenshots/gridfinity-bins.png))
[![gridfinity-bins](screenshots/gridfinity-bins.png)](gridfinity-bins/main.kcl)
#### [gridfinity-bins-stacking-lip](gridfinity-bins-stacking-lip/main.kcl) ([step](step/gridfinity-bins-stacking-lip.step)) ([screenshot](screenshots/gridfinity-bins-stacking-lip.png))
[![gridfinity-bins-stacking-lip](screenshots/gridfinity-bins-stacking-lip.png)](gridfinity-bins-stacking-lip/main.kcl)
#### [hex-nut](hex-nut/main.kcl) ([step](step/hex-nut.step)) ([screenshot](screenshots/hex-nut.png))
[![hex-nut](screenshots/hex-nut.png)](hex-nut/main.kcl)
#### [i-beam](i-beam/main.kcl) ([step](step/i-beam.step)) ([screenshot](screenshots/i-beam.png))
@ -81,12 +79,12 @@ When you submit a PR to add or modify KCL samples, images and STEP files will be
[![mounting-plate](screenshots/mounting-plate.png)](mounting-plate/main.kcl)
#### [multi-axis-robot](multi-axis-robot/main.kcl) ([step](step/multi-axis-robot.step)) ([screenshot](screenshots/multi-axis-robot.png))
[![multi-axis-robot](screenshots/multi-axis-robot.png)](multi-axis-robot/main.kcl)
#### [pipe](pipe/main.kcl) ([step](step/pipe.step)) ([screenshot](screenshots/pipe.png))
[![pipe](screenshots/pipe.png)](pipe/main.kcl)
#### [pipe-flange-assembly](pipe-flange-assembly/main.kcl) ([step](step/pipe-flange-assembly.step)) ([screenshot](screenshots/pipe-flange-assembly.png))
[![pipe-flange-assembly](screenshots/pipe-flange-assembly.png)](pipe-flange-assembly/main.kcl)
#### [pipe-with-bend](pipe-with-bend/main.kcl) ([step](step/pipe-with-bend.step)) ([screenshot](screenshots/pipe-with-bend.png))
[![pipe-with-bend](screenshots/pipe-with-bend.png)](pipe-with-bend/main.kcl)
#### [pipe](pipe/main.kcl) ([step](step/pipe.step)) ([screenshot](screenshots/pipe.png))
[![pipe](screenshots/pipe.png)](pipe/main.kcl)
#### [poopy-shoe](poopy-shoe/main.kcl) ([step](step/poopy-shoe.step)) ([screenshot](screenshots/poopy-shoe.png))
[![poopy-shoe](screenshots/poopy-shoe.png)](poopy-shoe/main.kcl)
#### [router-template-cross-bar](router-template-cross-bar/main.kcl) ([step](step/router-template-cross-bar.step)) ([screenshot](screenshots/router-template-cross-bar.png))
@ -101,3 +99,4 @@ When you submit a PR to add or modify KCL samples, images and STEP files will be
[![walkie-talkie](screenshots/walkie-talkie.png)](walkie-talkie/main.kcl)
#### [washer](washer/main.kcl) ([step](step/washer.step)) ([screenshot](screenshots/washer.png))
[![washer](screenshots/washer.png)](washer/main.kcl)

View File

@ -81,9 +81,9 @@ spacers = extrude(spacerSketch, length = -spacerLength)
|> appearance(color = "#dbcd70", roughness = 90, metalness = 90)
rotorSlottedSketch = startSketchOn(rotor, 'START')
|> startProfileAt([2.17, 2.56], %)
|> xLine(0.12, %)
|> yLine(2.56, %)
|> xLine(-0.12, %)
|> xLine(length = 0.12)
|> yLine(length = 2.56)
|> xLine(length = -0.12)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternCircular2d(
@ -96,9 +96,9 @@ rotorSlotted = extrude(rotorSlottedSketch, length = -rotorSinglePlateThickness /
secondRotorSlottedSketch = startSketchOn(secondRotor, 'END')
|> startProfileAt([-2.17, 2.56], %)
|> xLine(-0.12, %)
|> yLine(2.56, %)
|> xLine(0.12, %)
|> xLine(length = -0.12)
|> yLine(length = 2.56)
|> xLine(length = 0.12)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternCircular2d(

View File

@ -65,13 +65,13 @@ lugHoles = startSketchOn(lugBase, 'END')
// Add detail to the wheel center by revolving curved edge profiles
wheelCenterInner = startSketchOn('XY')
|> startProfileAt([(lugSpacing - 1.5) / 2, 0], %)
|> yLine(-wheelWidth / 10 - (wheelWidth / 20), %)
|> yLine(length = -wheelWidth / 10 - (wheelWidth / 20))
|> bezierCurve({
to = [-0.4, 0.3],
control1 = [-0.3, 0],
control2 = [0, 0.3]
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> revolve({ axis = 'y' }, %)
@ -79,13 +79,13 @@ wheelCenterInner = startSketchOn('XY')
wheelCenterOuter = startSketchOn('XY')
|> startProfileAt([(lugSpacing + 1.5) / 2, 0], %)
|> yLine(-wheelWidth / 10 - (wheelWidth / 20), %)
|> yLine(length = -wheelWidth / 10 - (wheelWidth / 20))
|> bezierCurve({
to = [0.4, -0.1],
control1 = [0.3, 0],
control2 = [0.2, -0.3]
}, %)
|> yLineTo(-wheelWidth / 20, %)
|> yLine(endAbsolute = -wheelWidth / 20)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> revolve({ axis = 'y' }, %)
@ -120,7 +120,7 @@ fn spoke(spokeGap, spokeAngle, spokeThickness) {
offset / 1.5
]
}, %)
|> yLine(-wheelWidth / 15, %)
|> yLine(length = -wheelWidth / 15)
|> bezierCurve({
to = [
-(wheelDiameter - lugSpacing - 2.9) / 2,
@ -160,38 +160,38 @@ startSketchOn('XY')
wheelDiameter / 2,
-wheelWidth + backSpacing + offset
], %)
|> yLine(wheelWidth * 0.25, %)
|> yLine(length = wheelWidth * 0.25)
|> line(end = [-wheelWidth * 0.02, wheelWidth * 0.02])
|> yLine(wheelWidth * 0.25, %)
|> yLine(length = wheelWidth * 0.25)
|> line(end = [wheelWidth * 0.02, wheelWidth * 0.02])
|> yLineTo(backSpacing + offset, %)
|> yLine(endAbsolute = backSpacing + offset)
|> line(end = [wheelWidth * 0.05, wheelWidth * .01])
|> yLine(wheelWidth * 0.05, %)
|> xLine(-wheelWidth * 0.03, %)
|> yLine(-wheelWidth * 0.02, %)
|> yLine(length = wheelWidth * 0.05)
|> xLine(length = -wheelWidth * 0.03)
|> yLine(length = -wheelWidth * 0.02)
|> line(end = [-wheelWidth * 0.05, -wheelWidth * 0.01])
|> yLine(-backSpacing * 0.7, %)
|> yLine(length = -backSpacing * 0.7)
|> line(end = [
-wheelDiameter * 0.01,
-wheelWidth * 0.02
])
|> yLineTo(offset - 0.2, %)
|> yLine(endAbsolute = offset - 0.2)
|> line(end = [
-wheelDiameter * 0.03,
-wheelWidth * 0.02
])
|> yLine(-wheelWidth * 0.02, %)
|> yLine(length = -wheelWidth * 0.02)
|> line(end = [
wheelDiameter * 0.03,
-wheelWidth * 0.1
])
|> yLine(-wheelWidth * 0.05, %)
|> yLine(length = -wheelWidth * 0.05)
|> line(end = [wheelWidth * 0.02, -wheelWidth * 0.02])
|> yLineTo(-wheelWidth + backSpacing + offset - 0.28, %)
|> yLine(endAbsolute = -wheelWidth + backSpacing + offset - 0.28)
|> line(end = [wheelWidth * 0.05, -wheelWidth * 0.01])
|> yLine(-wheelWidth * 0.02, %)
|> xLine(wheelWidth * 0.03, %)
|> yLine(wheelWidth * 0.05, %)
|> yLine(length = -wheelWidth * 0.02)
|> xLine(length = wheelWidth * 0.03)
|> yLine(length = wheelWidth * 0.05)
|> close()
|> revolve({ axis = 'y' }, %)
|> appearance(color = "#ffffff", metalness = 0, roughness = 0)

View File

@ -26,13 +26,13 @@ fn lug(plane, length, diameter) {
lugSketch = startSketchOn(customPlane)
|> startProfileAt([0 + diameter / 2, 0], %)
|> angledLineOfYLength({ angle = 70, length = lugHeadLength }, %)
|> xLineTo(lugDiameter / 2, %)
|> yLineTo(lugLength, %)
|> xLine(endAbsolute = lugDiameter / 2)
|> yLine(endAbsolute = lugLength)
|> tangentialArc({ offset = 90, radius = 3 * mm() }, %)
|> xLineTo(0 + .001, %, $c1)
|> yLineTo(lugThreadDepth, %)
|> xLineTo(lugThreadDiameter, %)
|> yLineTo(0, %)
|> xLine(endAbsolute = 0 + .001, tag = $c1)
|> yLine(endAbsolute = lugThreadDepth)
|> xLine(endAbsolute = lugThreadDiameter)
|> yLine(endAbsolute = 0)
|> close()
|> revolve({ axis = "Y" }, %)
|> appearance(color = "#dbcd70", roughness = 90, metalness = 90)

View File

@ -68,19 +68,19 @@ primaryTube(3, 25.2, 5, 5, 3)
// Create the mounting flange for the header
flangeSketch = startSketchOn('XY')
|> startProfileAt([3 + 1.3, -1.25], %)
|> xLine(-2.6, %, $seg01)
|> xLine(length = -2.6, tag = $seg01)
|> tangentialArc({ radius = .3, offset = -40 }, %)
|> tangentialArc({ radius = .9, offset = 80 }, %)
|> tangentialArc({ radius = .3, offset = -40 }, %)
|> xLine(-1.4, %, $seg03)
|> yLine(segLen(seg01), %, $seg04)
|> xLine(3.1, %, $seg05)
|> xLine(length = -1.4, tag = $seg03)
|> yLine(length = segLen(seg01), tag = $seg04)
|> xLine(length = 3.1, tag = $seg05)
|> tangentialArc({ radius = .3, offset = -40 }, %)
|> tangentialArc({ radius = 1.5, offset = 80 }, %)
|> tangentialArc({ radius = .3, offset = -40 }, %)
|> xLine(segLen(seg05), %, $seg07)
|> yLineTo(profileStartY(%), %, $seg08)
|> xLine(-segLen(seg03), %, $seg09)
|> xLine(length = segLen(seg05), tag = $seg07)
|> yLine(endAbsolute = profileStartY(%), tag = $seg08)
|> xLine(length = -segLen(seg03), tag = $seg09)
|> tangentialArc({ radius = .3, offset = -40 }, %)
|> tangentialArc({ radius = .9, offset = 80 }, %)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)

View File

@ -49,7 +49,7 @@ sketch000 = startSketchOn('XY')
// create a profile of the flipper
flipperProfile = startProfileAt([-flipperLength, -32.0], sketch000)
|> line(end = [flipperLength, 2.0])
|> yLine(60.0, %, $backEdge)
|> yLine(length = 60.0, tag = $backEdge)
|> line(end = [-flipperLength, 2.0])
|> arc({
angleEnd = 196.912390,
@ -96,7 +96,7 @@ handleProfile = startProfileAt([0.0, flipperThickness], sketch001)
|> line(end = [-1.710101, 4.698463])
|> line(end = [-141.995517, -51.682142], tag = $handleTopEdge)
|> line(end = [-36.139148, -36.139148])
|> xLine(7.071068, %)
|> xLine(length = 7.071068)
|> close()
// create an extrusion extrude001
@ -127,25 +127,25 @@ sketch002 = startSketchOn(handlePlane)
// create a profile of the grip
gripProfile = startProfileAt([-26.806746, -10.0], sketch002)
|> xLine(gripWidth - (2 * gripFilletRadius), %)
|> xLine(length = gripWidth - (2 * gripFilletRadius))
|> arc({
angleStart = -90.0,
angleEnd = 0.0,
radius = gripFilletRadius
}, %)
|> yLine(gripHeight - (2 * gripFilletRadius), %)
|> yLine(length = gripHeight - (2 * gripFilletRadius))
|> arc({
angleStart = 0.0,
angleEnd = 90.0,
radius = gripFilletRadius
}, %)
|> xLine(-(gripWidth - (2 * gripFilletRadius)), %)
|> xLine(length = -(gripWidth - (2 * gripFilletRadius)))
|> arc({
angleStart = 90.0,
angleEnd = 180.0,
radius = gripFilletRadius
}, %)
|> yLine(-(gripHeight - (2 * gripFilletRadius)), %, $gripEdgeTop)
|> yLine(length = -(gripHeight - (2 * gripFilletRadius)), tag = $gripEdgeTop)
|> arc({
angleStart = 180.0,
angleEnd = 270.0,

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