Compare commits

...

65 Commits

Author SHA1 Message Date
078ffa02b0 Add the at token 2024-11-26 16:19:00 -06:00
d461b09a4d KCL refactor: break typechecking into its own fn (#4587) 2024-11-26 16:02:31 -06:00
9c42c39ba9 Fix publish path in release bucket (#4585) 2024-11-26 15:11:26 -05:00
aa3f40e22c KCL: Two tiny refactors (#4580)
* Refactor: Combine two impl blocks

* Refactor: Constant for NO_META(data)
2024-11-26 12:27:09 -06:00
4423ae16dc Add offset plane point-and-click user flow (#4552)
* Add a code mod for offset plane

* Add support for default plane selections to our `otherSelections` object

* Make availableVars work without a selection range
(because default planes don't have one)

* Make default planes selectable in cmdbar even if AST is empty

* Add offset plane command and activate in toolbar

* Avoid unnecessary error when sketching on offset plane by returning early

* Add supporting test features for offset plane E2E test

* Add WIP E2E test for offset plane
Struggling to get local electron test suite running properly

* Typos

* Lints

* Fix test by making it a web-based one:
I couldn't use the cmdBar fixture with an electron test for some reason.

* Update src/lib/commandBarConfigs/modelingCommandConfig.ts

* Update src/machines/modelingMachine.ts

* Revert changes to `homePageFixture`, as they were unused

* @Irev-Dev feedback: convert action to actor, fix machine layout

* Update plane icon to be not dashed, follow conventions closer
2024-11-26 16:36:14 +00:00
1d45bed649 Bump react-router-dom from 6.27.0 to 6.28.0 (#4414)
* Bump react-router-dom from 6.27.0 to 6.28.0

Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.27.0 to 6.28.0.
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/react-router-dom@6.28.0/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@6.28.0/packages/react-router-dom)

---
updated-dependencies:
- dependency-name: react-router-dom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* Force 6.28.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
2024-11-26 11:06:59 -05:00
64aac7bccc KCL refactor: Type alias for KCL object fields (#4579)
This way, if we want to change our key-value
representation later (e.g. using a tree map instead
of a hash map) we can, easily, in just one place.
2024-11-26 09:51:43 -06:00
002edeaf19 fix selection bugs found by QA-wolf (#4578)
* fix selection bugs found by QA-wolf

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

* trigger ci

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-26 04:43:28 -05:00
5424252dac AST: Factor shebangs out of non-code metadata and into Program (#4557)
* AST: Factor shebangs out of non-code metadata and into Progam

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

* Empty commit to try to unstick CI

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2024-11-26 03:39:57 +00:00
30bc85add8 Add warnings for recently deprecated syntax (#4560)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2024-11-26 14:59:40 +13:00
39a2bd685b Bump tokio from 1.40.0 to 1.41.1 in /src/wasm-lib (#4426)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.40.0 to 1.41.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.40.0...tokio-1.41.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-25 18:45:39 -06:00
23a3e330f6 KCL tests: take fancier snapshots of KCL errors (#4574)
Right now our KCL tests output a debug representation of the KCLError
value. This works OK, but it's difficult to read an error like
"runtime error: SourceRange([44, 48])" because I don't fucking know what
the 44th character in my KCL program is.

In the modeling app, source ranges are turned into nice red squiggly
underlines in the editor. I want nice squiggly underline when I run the
Rust unit tests too, damnit. The JS world should NEVER have fancy toys
that I, a Rust programmer, cannot access. I deserve this. I need this.

So anyway instead of snapshotting debug repr, snapshot a fancy error
via the miette library.
2024-11-25 17:28:57 -06:00
99dd8b87dc Change to use Angle type's comparison (#4575) 2024-11-25 23:17:47 +00:00
5ff1d9e268 Open about section links externally in Settings (#4571)
* Open nightly download link externally

* Applied to other about links
2024-11-25 16:14:40 -05:00
ce1a37e0bc Upgrade to typescript 5.7.2 (#4569)
* Upgrade to typescript 5.7.2

* Fix tsc errors
2024-11-25 20:37:04 +00:00
ac605c2434 Fix yarn tsc in codemirror-lsp-client (#4568) 2024-11-25 15:12:17 -05:00
f6ecdfcb02 Bump kcmc, release kcl-lib (#4567) 2024-11-25 20:10:45 +00:00
28815eb2f1 KCL: Executor returns specific errors, not anyhow (#4566)
Some clients (e.g. the simulation tests) want to know why a KCL program failed. Was it because of a network error? Or because the client wasn't authorized properly? Or was it a KCL runtime type error?

It's difficult for clients to ask these questions, because the interpreter just returns Anyhow error, basically just a string.

Instead, we should return different variants of an Error enum for different kinds of errors.

This lets us render nice Cargo-style error messages that show the exact KCL line where an error occurred, instead of just printing off a source range. We have that in the CLI, but I'd like it for running normal KCL unit tests.

# Testing

This is a pure refactor, it doesn't change any behaviour, it just stops hiding the specific error types via anyhow. No testing needed. If it compiles, it works.
2024-11-25 15:06:23 -05:00
166fa71f7e Add nightly link in about section (#4548)
* Add nightly link in about sectoin

* Add nightly detection

* Lint

* Change APP_NAME to PACKAGE_NAME

* To be improved: working implementation on mac for click to download

* Revert "To be improved: working implementation on mac for click to download"

This reverts commit 7ced32a533.

* Nevermind, will process on the website
2024-11-25 14:20:50 -05:00
00c45114ba Release KCL, KCL test server and derive-docs (#4565)
* Release KCL, KCL test server and derive-docs

derive-docs 0.1.31
kcl-test-server 0.1.17
kcl-lib 0.2.25

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

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-25 13:13:07 -06:00
6cfefd8611 Add tangentToEnd stdlib function (#4541) 2024-11-25 18:07:03 +00:00
4fe17fe3ab Implicit conversion of round numbers to integers (#4542)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2024-11-25 10:50:43 +13:00
66f6b741c4 Support = in record initialisation (#4519)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2024-11-24 20:21:55 +00:00
f760a77b14 KCL refactor: implement patternLinear2D as patternTransform (#4553)
Part of https://github.com/KittyCAD/modeling-app/issues/4543
2024-11-23 06:37:53 -06:00
7b36a5d1ee KCL: patternTransform for sketches (#4546)
KCL stdlib has a function `patternTransform` which works for 3D solids. This adds a similar function `patternTransform2d` which, as you might have guessed, is like `patternTransform` but for 2D. I know. I'm really, really really good at naming things.

This shares almost all of its implementation with 3D patterns via 💖the power of traits💖

This will assist with https://github.com/KittyCAD/modeling-app/issues/4543
2024-11-22 19:43:09 -06:00
b415349af6 Hide the Fillet command from the command palette (#4550)
* Add the ability to hide a command based on its availability status

* Hide the Fillet command from the command bar unless in dev mode
2024-11-22 16:32:28 -05:00
6f169ab297 Tag-based release process (#4530)
* WIP: Improve current nightly implementation

* Add nightly icons

* Clean up script

* Clean up

* Clean up

* Clean up2

* Clean up3

* WIP: Make the release process non-blocking
First commit to fix #4522

* Quick fix

* Test release and updater-test

* Try nightly build

* WIP nightly tag creation

* Change of direction

* Quick fix

* Test nightly

* Better release notes for nightly

* Migrate to artifact@v4 and prepare publish release

* Fix out-yml for artifact@v4

* Progress towards publish-release

* merge-multiple: true

* Add dependency

* Clean up. Change direction again on updater-test (now with RELEASE workflow)

* Clean up and test release builds

* Fix name

* Clean up, add README

* Add release notes override, another release test

* Fake release version & better draft release

* Test nightly

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)

* Clean up and first attempt at publish-release-apps

* Add GH_TOKEN

* Add github-token to download-artifact step

* Add github-token to all download-artifact steps

* Add checkout and node steps

* Clean up

* Remove whitespace

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)

* Quick typo

* Add Kevin's semantic-release.sh script to replace make-release.sh

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-22 15:29:54 -05:00
2529066f38 Nadro/adhoc/enter sketch mode bug fix (#4529)
* fix: fixing bugs relating to entering sketchmode

* fix: reverting

* fix: reverting code and running auto fixers
2024-11-22 16:05:04 +00:00
79dc537900 KCL refactor: implement patternLinear3D as patternTransform (#4539)
Part of https://github.com/KittyCAD/modeling-app/issues/4543

Changes patternLinear3D's implementation so it just calls into patternTransform instead of needing all its own logic and API calls.
2024-11-22 01:18:21 -05:00
77bae6983d KCL: Simulation tests don't tokenize anymore (#4545)
There wasn't a lot of value add. We weren't really using these.
2024-11-21 21:32:10 -06:00
56ef859bb3 Move more KCL executor tests into simulation tests (#4540) 2024-11-21 19:33:02 -05:00
455fb49fb6 Support multiple errors and warnings in the parser (#4534)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2024-11-21 19:25:14 -05:00
676ac201bb Fix argument error to point to the arg at the call site (#4533)
* Fix argument error to point to the arg at the call site

* Change MemoryFunction to accept Vec<Arg> instead of Vec<KclValue>

* Rename variable to be clearer

* Fix one more argument error message

* Clean up from PR feedback
2024-11-21 18:10:03 +00:00
0092922565 Refactor: Move KclValue into its own module (#4535) 2024-11-21 11:47:32 -05:00
d6b26ff718 Improve current nightly implementation (#4514)
* WIP: Improve current nightly implementation

* Add nightly icons

* Clean up script

* Clean up

* Clean up

* Clean up2

* Clean up3
2024-11-21 10:12:06 -05:00
fcb0a6d9ca Allow transform patterns to return multiple transforms (#4531)
* Support multiple transforms in patterns
* New examples in docs
* Refactor: move large block into its own function
2024-11-21 09:49:54 -05:00
59e0df7879 Selections Refactor (#4381)
* selection stuff

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)

* trigger CI

* fix bugs

* some edge cut stuff

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

* trigger CI

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)

* fix sketch mode issues

* fix more tests, selection in sketch related

* more test fixing

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)

* Trigger ci

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)

* Trigger ci

* more sketch mode selection fixes

* fix unit tests

* rename function

* remove .only

* migrate a more selections types

* migrate a more selections types

* migrate a more selections types

* lint

* migrate a more selections types

* migrate a more selections types

* migrate a more selections types

* migrate a more selections types

* migrate a more selections types

* migrate a more selections types

* migrate a more selections types

* migrate a more selections types

* migrate a more selections types

* migrate a more selections types

* fix bad pathToNode issue

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)

* fix sketch on face

* migrate a more selections types

* migrate a more selections types

* fix code selection of fillets

* migrate a more selections types

* migrate a more selections types

* migrate a more selections types

* migrate a more selections types

* migrate a more selections types

* fix bad path to node, looks like a race

* migrate a more selections types

* migrate a more selections types

* fix cmd bar selections

* fix cmd bar selections

* fix display issues

* migrate a more selections types

* Revert "migrate a more selections types"

This reverts commit 0d0e453bbb.

* migrate a more selections types

* clean up1

* clean up 2

* fix types after main merge

* review tweaks

* fix wall selection bug

* Update src/lang/std/engineConnection.ts

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

* add franks TODO comment

* fix type after main merge, plus a touch of clean up

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
c17cb1067f Factor away the Parser struct (#4520)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2024-11-21 07:52:10 +13:00
6fb493f209 KCL: Object literals like {x} as shorthand for {x: x} (#4521)
If the key and value in an object literal use the same identifier, allow abbreviating it.

Basically these two are now equivalent:

```
x = 2
obj = { x: x, y: 3}
```

```diff
x = 2
- obj = { x: x, y: 3}
+ obj = { x, y: 3}
```

This syntax is used in JS, Rust and probably elsewhere too.

Here's a more realistic example. Before:

```
radius = 10

startSketchAt([0, 0])
|> circle({center: [0, 0], radius: radius}, %)
```
After:
```diff
radius = 10

startSketchAt([0, 0])
- |> circle({center: [0, 0], radius: radius}, %)
+ |> circle({center: [0, 0], radius}, %)
```
2024-11-20 11:23:32 -05:00
30afa65ccf Cut release v0.27.0 (#4516)
* Cut release v0.26.6

* Cut release v0.27.0
2024-11-20 10:09:53 -06:00
a2f9e70d18 breaking change: Change "type" to be a keyword, import() "type:" parameter to "format:" (#4517) 2024-11-20 14:53:37 +00:00
986675fe89 Fix formatting for nested function returns (#4518)
Previously, this was the output of the formatter:

```
fn f = () => {
  return () => {
  return 1
}
}
```

Now the above will be reformatted as

```
fn f = () => {
  return () => {
    return 1
  }
}
```

Much better!
2024-11-20 09:23:30 -05:00
d8ce5ad8bd Make most top-level modules in KCL private (#4478)
* Make ast module private

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

* Make most other modules private

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

* Expand API to support CLI, Python bindings, and LSP crate

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

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2024-11-20 15:19:25 +13:00
1a9926be8a Fix to not have unneeded console errors (#4482)
* Fix to not have unneeded console errors

* Change to use a type that isn't string
2024-11-19 17:34:54 -05:00
max
54b5774f9e Add Support for Fillet with Extrude in the Sketch Pipe (#4168)
* update code mod

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)

* fmt

* lint

* make yarn-tsc happy

* fmt

* typo

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-19 21:30:26 +01:00
66bbbf81e2 Pass current file name through to export command (#4503)
* Pass current file name through to export command

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

* Oops I needed a couple other things, not just that one line change

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

* Undo overriding of internal zipped file names
That was liable to cause conflicts and whatnot per @jessfraz feedback

* Update E2E test that was still looking for `output.gltf`

* Missed one other test my bad

* Should've just grepped for output.gltf to begin with

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Paul Tagliamonte <paul@zoo.dev>
2024-11-19 11:30:23 -05:00
652519aeae fix: center rectangle code writing bug (#4512)
fix: bug that did not write the code to the editor when the workflow finished
2024-11-19 11:10:08 -05:00
f826afb32d Clear code mirror history on file change (#4510)
* clear history when loading a new file

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>
2024-11-19 02:08:22 +00:00
f71fafdece breaking change: Add more KCL reserved words, part 1 (#4502) 2024-11-19 00:54:25 +00:00
16b7544d69 fix missing docs files (#4509)
* fix missing docs files

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

* fix justfile

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

* fix justfile

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-11-18 22:58:33 +00:00
34f019305b Move tests into simulation (#4487)
Replace wasm-lib integration tests with KCL simulation tests.
2024-11-18 22:20:32 +00:00
79e06b3a00 Nadro/adhoc/stdlib arcTo (three point arc) (#4485)
* feat: implementing arcTo in standard library, first pass

* feat: computing center and radius for arcto

* fix: updating comment for arcTo

* fix: cargo fmt fix

* fix: bug, the x was used twice!

* fix: Cleaning up some code and adding more comments

* fix: this has to be removed

* fix: resolved merge conflicts with main and updated the codebase to remove the JSON stuff

* fix: addressing cargo clippy issues

* fix: typos

* fix: adding generated docs

* Update doc test snapshots

---------

Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-18 22:17:16 +00:00
24bc4fcd8c Show offset planes in the scene, let user select them (#4481)
* Update offset_plane to actually create and show the plane in-engine

* Fix broken ability to use offsetPlanes in startSketchOn

* Make the newly-visible offset planes usable for sketching via UI

* Add a playwright test for sketching on an offset plane via point-and-click

* cargo clippy & cargo fmt

* Make `PlaneData` the first item of `SketchData` so autocomplete continues to work well for `startSketchOn`

* @nadr0 feedback re: `offsetIndex`

* From @jtran: "Need to call the ID generator so that IDs are stable."

* More feedback from @jtran and fix incomplete use of `id_generator` in last commit

* Oops I missed saving `isPathToNodeNumber` earlier 🤦🏻

* Make the distinction between `Plane` and `PlaneOrientationData` more clear per @nadr0 and @lf94's feedback

* Make `newPathToNode` less hardcoded, per @lf94's feedback

* Don't need to unbox and rebox `plane`

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

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)

* Rearranging of enums and structs, but the offsetPlanes are still not used by their sketches

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

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)

* Revert all my little newtype fiddling it's a waste of time.

* Update docs

* cargo fmt

* Remove log

* Print the unexpected diagnostics

* Undo renaming of `PlaneData`

* Remove generated PlaneRientationData docs page

* Redo doc generation after undoing `PlaneData` rename

* Impl FromKclValue for the new plane datatypes

* Clippy lint

* When starting a sketch, only hide the plane if it's a custom plane

* Fix FromKclValue and macro use since merge

* Fix to not convert Plane to PlaneData

* Make sure offset planes are `Custom` type

* SketchData actually doesn't need to be in a certain order
This avoids the autocompletion issue I was having.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Adam Chalmers <adam.chalmers@zoo.dev>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-18 16:25:25 -05:00
97b9529c81 doc: Add more docs and links for KCL import (#4488)
* Add links in docs to KCL module documentation

* Add import statement test in import() stdlib doc comments

* Update doc test outputs

* Update doc outputs
2024-11-18 18:47:24 +00:00
8e5fc02941 Revert electron-updater to 6.3.0 (Linux AppImage updater fix) (#4501)
* WIP: Fix linux updater 'mv' error

First commit to test the updater-test builds

* Downgrade electron-updater to 6.3.0

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

* Trigger CI

* Pin to 6.3.0

* Clean up

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-18 18:31:45 +00:00
909690f3c7 Better reduce docs (#4493)
Based on conversation with Josh and Jordan earlier this week.
2024-11-18 10:34:57 -06:00
14ba66378d Nadro/adhoc/center rectangle (#4480)
* fix: big commit, doing this to save work then do a PR cleanup; center rectangle

* fix: making a center function for each scenario

* fix: reverting the update rectangle code since I have a center rectangle one

* fix: does not allow seletcing circle or rectangle tool while selecting a face

* chore: adding comment to better read the HTML

* fix: cleaning up for PR

* fix: pushing broken code for someone to checkout

* fix: fixed the typescript issues, removed the as keyword for my center rectangle expressions

* fix: removing comment

* fix: removed as for type narrowing checks
2024-11-18 09:04:09 -06:00
b2e895e508 Fix finding path to node for import and if-else (#4483) 2024-11-17 18:03:21 -05:00
05f4f34269 Do not write to file or update code editor a ridiculous amount of times and update them both at the most appropriate moments. (#4479)
* Reapply "Deflake project settings override on desktop (#4370)" (#4450)

This reverts commit b11040c23c.

* Refactor writeToFile and updateCodeEditor to happen at appropriate times

* Turn error into warning about out of date AST.

* Rename setUp to setup

* ONLY reload current file on changes.

* If value is falsey then don't try to executeAst

* Fix up code based selections after constraints

* Correct any last missing code mods

* Update src/clientSideScene/ClientSideSceneComp.tsx

Remove eslint rule no-floating-promises

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

* Fixups

* Fix FileTree failing

---------

Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-16 21:49:44 +00:00
fbb7b08b62 Refactor: Clean up FromKclValue code (#4489)
* Rename ::from_mem_item to ::from_kcl_val

The old name is from a dark time lost to human memory,
when we had an enum called MemoryItem.

* Simplify the FromKclValue macros

There's only really need for one macro, not three.
2024-11-16 12:19:00 -05:00
16c7a2457a Add docs for modules and import statements (#4435) 2024-11-15 11:36:38 -05:00
c429bc6ed7 chore: implemented a O(n) unique and added unit tests (#4429) 2024-11-15 09:09:16 -06:00
a0493cb332 Divorce JSON and KCL (#4436)
Removes JSON from the KCL object model. Closes https://github.com/KittyCAD/modeling-app/issues/1130 -- it was filed on Nov 27 last year. Hopefully I close it before its one year anniversary.

Changes:

- Removed the UserVal variant from `enum KclValue`. That variant held JSON data.
- Replaced it with several new variants like Number, String, Array (of KCL values), Object (where keys are String and values are KCL values)
- Added a dedicated Sketch variant to KclValue. We used to have a variant like this, but I removed it as an experimental approach to fix this issue. Eventually I decided to undo it and use the approach of this PR instead.
- Removed the `impl_from_arg_via_json` macro, which implemented conversion from KclValue to Rust types by matching the KclValue to its UserVal variant, grabbing the JSON, then deserializing that into the desired Rust type. 
- Instead, replaced it with manual conversion from KclValue to Rust types, using some convenience macros like `field!`
2024-11-14 17:27:19 -06:00
b798f7da03 Add basic horizontal and vertical snapping for Line tool (#4465)
* Add on-click snapping behavior

* Fix math error with horizontal/vertical determination

* Move snap constant to where other sketch constants are

* fmt

* Fixing up some of the tests, some still need updating

* A couple other little PW test issues

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

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

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)

* Fix remaining tests that need updating

* Make `yarn lint` happy

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-13 09:41:27 -05:00
c5d051855f Fix description of angleToMatchLengthX (#4467)
* fix description of angleToMatchLengthX

* Update docs

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

* update doc regen instructions

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

* Re-run CI after snapshots

---------

Co-authored-by: Adam Chalmers <adam.chalmers@zoo.dev>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Frank Noirot <frank@kittycad.io>
2024-11-13 09:04:35 -05:00
626 changed files with 281572 additions and 23651 deletions

View File

@ -1,21 +1,20 @@
name: build-publish-apps
name: build-apps
on:
pull_request:
push:
branches:
- main
release:
types: [published]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
schedule:
- cron: '0 4 * * *'
# Daily at 04:00 AM UTC
# Will checkout the last commit from the default branch (main as of 2023-10-04)
env:
CUT_RELEASE_PR: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.title, 'Cut release v')) }}
BUILD_RELEASE: ${{ github.event_name == 'release' || github.event_name == 'schedule' || github.event_name == 'pull_request' && (contains(github.event.pull_request.title, 'Cut release v')) }}
NOTES: ${{ github.event_name == 'release' && github.event.release.body || format('Non-release build, commit {0}', github.sha) }}
IS_RELEASE: ${{ github.ref_type == 'tag' }}
IS_NIGHTLY: ${{ github.event_name == 'schedule' }}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@ -26,6 +25,7 @@ jobs:
runs-on: ubuntu-22.04 # seperate job on Ubuntu for easy string manipulations (compared to Windows)
outputs:
version: ${{ steps.export_version.outputs.version }}
notes: ${{ steps.export_notes.outputs.notes }}
steps:
- uses: actions/checkout@v4
@ -47,48 +47,40 @@ jobs:
- name: Run build:wasm
run: "yarn build:wasm"
- name: Set nightly version
if: github.event_name == 'schedule'
- name: Set nightly version, product name, release notes, and icons
if: ${{ env.IS_NIGHTLY == 'true' }}
run: yarn files:flip-to-nightly
- name: Set release version
if: ${{ env.IS_RELEASE == 'true' }}
run: |
VERSION=$(date +'%-y.%-m.%-d') yarn bump-jsons
export VERSION=${GITHUB_REF_NAME#v}
yarn files:set-version
# TODO: see if we need to inject updater nightly URL here https://dl.zoo.dev/releases/modeling-app/nightly/last_update.json
- name: Generate release notes
run: |
echo "$NOTES" > release-notes.md
cat release-notes.md
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: prepared-files
path: |
package.json
electron-builder.yml
src/wasm-lib/pkg/wasm_lib*
release-notes.md
assets/icon.ico
assets/icon.png
- id: export_version
run: echo "version=`cat package.json | jq -r '.version'`" >> "$GITHUB_OUTPUT"
- name: Prepare electron-builder.yml file for nightly
if: ${{ github.event_name == 'schedule' }}
run: |
yq -i '.publish[0].url = "https://dl.zoo.dev/releases/modeling-app/nightly"' electron-builder.yml
- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'schedule' }}
with:
name: prepared-files-nightly
path: |
electron-builder.yml
- id: export_notes
run: echo "notes=`cat release-notes.md`" >> "$GITHUB_OUTPUT"
- name: Prepare electron-builder.yml file for updater test
if: ${{ env.CUT_RELEASE_PR == 'true' }}
if: ${{ env.IS_RELEASE == 'true' }}
run: |
yq -i '.publish[0].url = "https://dl.zoo.dev/releases/modeling-app/updater-test"' electron-builder.yml
- uses: actions/upload-artifact@v3
if: ${{ env.CUT_RELEASE_PR == 'true' }}
- uses: actions/upload-artifact@v4
if: ${{ env.IS_RELEASE == 'true' }}
with:
name: prepared-files-updater-test
path: |
@ -109,32 +101,24 @@ jobs:
platform: linux
runs-on: ${{ matrix.os }}
env:
VERSION: ${{ github.event_name == 'schedule' && needs.prepare-files.outputs.version || format('v{0}', needs.prepare-files.outputs.version) }}
VERSION_NO_V: ${{ needs.prepare-files.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
name: prepared-files
- name: Copy prepared files
run: |
ls -R prepared-files
cp prepared-files/package.json package.json
cp prepared-files/electron-builder.yml electron-builder.yml
cp prepared-files/src/wasm-lib/pkg/wasm_lib_bg.wasm public
mkdir src/wasm-lib/pkg
cp prepared-files/src/wasm-lib/pkg/wasm_lib* src/wasm-lib/pkg
cp prepared-files/release-notes.md release-notes.md
- uses: actions/download-artifact@v3
if: ${{ github.event_name == 'schedule' }}
name: prepared-files-nightly
- name: Copy updated electron-builder.yml file for nightly build
if: ${{ github.event_name == 'schedule' }}
run: |
ls -R prepared-files-nightly
cp prepared-files-nightly/electron-builder.yml electron-builder.yml
cp prepared-files/assets/icon.ico assets/icon.ico
cp prepared-files/assets/icon.png assets/icon.png
- name: Sync node version and setup cache
uses: actions/setup-node@v4
@ -147,7 +131,7 @@ jobs:
- run: yarn tronb:vite
- name: Prepare certificate and variables (Windows only)
if: ${{ env.BUILD_RELEASE == 'true' && matrix.os == 'windows-2022' }}
if: ${{ (env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true') && matrix.os == 'windows-2022' }}
run: |
echo "${{secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
cat /d/Certificate_pkcs12.p12
@ -162,7 +146,7 @@ jobs:
shell: bash
- name: Setup certicate with SSM KSP (Windows only)
if: ${{ env.BUILD_RELEASE == 'true' && matrix.os == 'windows-2022' }}
if: ${{ (env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true') && matrix.os == 'windows-2022' }}
run: |
curl -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o smtools-windows-x64.msi
msiexec /i smtools-windows-x64.msi /quiet /qn
@ -173,13 +157,13 @@ jobs:
shell: cmd
- name: Build the app (debug)
if: ${{ env.BUILD_RELEASE == 'false' }}
if: ${{ env.IS_RELEASE == 'false' && env.IS_NIGHTLY == 'false' }}
# electron-builder doesn't have a concept of release vs debug,
# this is just not doing any codesign or release yml generation
run: yarn electron-builder --config
- name: Build the app (release)
if: ${{ env.BUILD_RELEASE == 'true' }}
if: ${{ env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true' }}
env:
PUBLISH_FOR_PULL_REQUEST: true
APPLE_ID: ${{ secrets.APPLE_ID }}
@ -196,7 +180,7 @@ jobs:
- name: List artifacts in out/
run: ls -R out
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: out-arm64-${{ matrix.platform }}
# first two will pick both Zoo Modeling App-$VERSION-arm64-win.exe and Zoo Modeling App-$VERSION-win.exe
@ -206,7 +190,7 @@ jobs:
out/*-arm64-mac.*
out/*-arm64-linux.*
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: out-x64-${{ matrix.platform }}
path: |
@ -214,27 +198,29 @@ jobs:
out/*-x64-mac.*
out/*-x86_64-linux.*
- uses: actions/upload-artifact@v3
if: ${{ env.BUILD_RELEASE == 'true' }}
- uses: actions/upload-artifact@v4
if: ${{ env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true' }}
with:
name: out-yml
name: out-yml-${{ matrix.platform }}
path: |
out/latest*.yml
# TODO: add the 'Build for Mac TestFlight (nightly)' stage back
- uses: actions/download-artifact@v3
if: ${{ env.CUT_RELEASE_PR == 'true' }}
# The steps below are for updater-test builds, only on release
- uses: actions/download-artifact@v4
if: ${{ env.IS_RELEASE == 'true' }}
name: prepared-files-updater-test
- name: Copy updated electron-builder.yml file for updater test
if: ${{ env.CUT_RELEASE_PR == 'true' }}
if: ${{ env.IS_RELEASE == 'true' }}
run: |
ls -R prepared-files-updater-test
cp prepared-files-updater-test/electron-builder.yml electron-builder.yml
- name: Build the app (updater-test)
if: ${{ env.CUT_RELEASE_PR == 'true' }}
if: ${{ env.IS_RELEASE == 'true' }}
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
@ -247,8 +233,8 @@ jobs:
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
run: yarn electron-builder --config --publish always
- uses: actions/upload-artifact@v3
if: ${{ env.CUT_RELEASE_PR == 'true' }}
- uses: actions/upload-artifact@v4
if: ${{ env.IS_RELEASE == 'true' }}
with:
name: updater-test-arm64-${{ matrix.platform }}
path: |
@ -256,8 +242,8 @@ jobs:
out/*-arm64-mac.dmg
out/*-arm64-linux.AppImage
- uses: actions/upload-artifact@v3
if: ${{ env.CUT_RELEASE_PR == 'true' }}
- uses: actions/upload-artifact@v4
if: ${{ env.IS_RELEASE == 'true' }}
with:
name: updater-test-x64-${{ matrix.platform }}
path: |
@ -266,58 +252,69 @@ jobs:
out/*-x86_64-linux.AppImage
publish-apps-release:
upload-apps-release:
runs-on: ubuntu-22.04
permissions:
contents: write
if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }}
needs: [prepare-files, build-apps]
if: ${{ github.ref_type == 'tag' || github.event_name == 'schedule' }}
env:
VERSION_NO_V: ${{ needs.prepare-files.outputs.version }}
VERSION: ${{ github.event_name == 'schedule' && needs.prepare-files.outputs.version || format('v{0}', needs.prepare-files.outputs.version) }}
PUB_DATE: ${{ github.event_name == 'release' && github.event.release.created_at || github.event.repository.updated_at }}
BUCKET_DIR: ${{ github.event_name == 'schedule' && 'dl.kittycad.io/releases/modeling-app/nightly' || 'dl.kittycad.io/releases/modeling-app' }}
WEBSITE_DIR: ${{ github.event_name == 'schedule' && 'dl.zoo.dev/releases/modeling-app/nightly' || 'dl.zoo.dev/releases/modeling-app' }}
URL_CODED_NAME: ${{ github.event_name == 'schedule' && 'Zoo%20Modeling%20App%20%28Nightly%29' || 'Zoo%20Modeling%20App' }}
VERSION: ${{ format('v{0}', needs.prepare-files.outputs.version) }}
needs: [prepare-files, build-apps]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: out-arm64-win
path: out
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: out-x64-win
path: out
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: out-yml-win
path: out
- uses: actions/download-artifact@v4
with:
name: out-arm64-mac
path: out
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: out-x64-mac
path: out
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: out-yml-mac
path: out
- uses: actions/download-artifact@v4
with:
name: out-arm64-linux
path: out
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: out-x64-linux
path: out
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: out-yml
name: out-yml-linux
path: out
- name: Generate the download static endpoint
env:
NOTES: ${{ needs.prepare-files.outputs.notes }}
PUB_DATE: ${{ github.event.repository.updated_at }}
WEBSITE_DIR: ${{ github.event_name == 'schedule' && 'dl.zoo.dev/releases/modeling-app/nightly' || 'dl.zoo.dev/releases/modeling-app' }}
URL_CODED_NAME: ${{ github.event_name == 'schedule' && 'Zoo%20Modeling%20App%20%28Nightly%29' || 'Zoo%20Modeling%20App' }}
run: |
RELEASE_DIR=https://${WEBSITE_DIR}
jq --null-input \
@ -354,78 +351,44 @@ jobs:
"url": $linux_x64_url
}
}
}' > last_download.json
cat last_download.json
}' > out/last_download.json
cat out/last_download.json
- uses: actions/upload-artifact@v4
with:
name: out-download-json
path: out/last_download.json
- name: List artifacts
run: "ls -R out"
- name: Authenticate to Google Cloud
if: ${{ env.IS_NIGHTLY == 'true' }}
uses: 'google-github-actions/auth@v2.1.7'
with:
credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}'
- name: Set up Google Cloud SDK
if: ${{ env.IS_NIGHTLY == 'true' }}
uses: google-github-actions/setup-gcloud@v2.1.2
with:
project_id: ${{ env.GOOGLE_CLOUD_PROJECT_ID }}
- name: Upload release files to public bucket
- name: Upload nightly files to public bucket
if: ${{ env.IS_NIGHTLY == 'true' }}
uses: google-github-actions/upload-cloud-storage@v2.2.1
with:
path: out
glob: 'Zoo*'
glob: '*'
parent: false
destination: ${{ env.BUCKET_DIR }}
destination: 'dl.kittycad.io/releases/modeling-app/nightly'
- name: Upload update endpoint to public bucket
uses: google-github-actions/upload-cloud-storage@v2.2.1
with:
path: out
glob: 'latest*'
parent: false
destination: ${{ env.BUCKET_DIR }}
- name: Upload download endpoint to public bucket
uses: google-github-actions/upload-cloud-storage@v2.2.1
with:
path: last_download.json
destination: ${{ env.BUCKET_DIR }}
- name: Upload release files to Github
if: ${{ github.event_name == 'release' }}
- name: Create draft release
uses: softprops/action-gh-release@v2
if: ${{ env.IS_RELEASE == 'true' }}
with:
name: ${{ env.VERSION }}
tag_name: ${{ env.VERSION }}
draft: true
generate_release_notes: true
files: 'out/Zoo*'
- name: Invalidate bucket cache on latest*.yml and last_download.json files
run: |
gcloud compute url-maps invalidate-cdn-cache dl-url-map --path="/releases/modeling-app/last_download.json" --async
gcloud compute url-maps invalidate-cdn-cache dl-url-map --path="/releases/modeling-app/latest-linux-arm64.yml" --async
gcloud compute url-maps invalidate-cdn-cache dl-url-map --path="/releases/modeling-app/latest-mac.yml" --async
gcloud compute url-maps invalidate-cdn-cache dl-url-map --path="/releases/modeling-app/latest.yml" --async
announce_release:
needs: [publish-apps-release]
runs-on: ubuntu-22.04
if: github.event_name == 'release'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: Announce Release
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
RELEASE_VERSION: ${{ github.event.release.tag_name }}
RELEASE_BODY: ${{ github.event.release.body}}
run: python public/announce_release.py

View File

@ -1,37 +0,0 @@
name: Create Release
on:
push:
branches:
- main
jobs:
create-release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
if: contains(github.event.head_commit.message, 'Cut release v')
steps:
- uses: actions/github-script@v7
name: Read Cut release PR info and create release
with:
script: |
const { owner, repo } = context.repo
const pulls = await github.rest.repos.listPullRequestsAssociatedWithCommit({
owner,
repo,
commit_sha: context.sha,
})
const { title, body } = pulls.data[0]
const version = title.split('Cut release ')[1]
const result = await github.rest.repos.createRelease({
owner,
repo,
body,
tag_name: version,
name: version,
draft: true,
})
console.log(result)

View File

@ -0,0 +1,158 @@
name: publish-apps-release
on:
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
publish-apps-release:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Find tag workflow id
id: tag_workflow_id
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
id=$(gh run ls --repo kittycad/modeling-app -w build-apps.yml --branch ${{ github.event.release.tag_name }} --json databaseId | jq '.[0].databaseId')
echo "id=$id" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4
with:
name: out-arm64-win
path: out
run-id: ${{ steps.tag_workflow_id.outputs.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: out-x64-win
path: out
run-id: ${{ steps.tag_workflow_id.outputs.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: out-yml-win
path: out
run-id: ${{ steps.tag_workflow_id.outputs.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: out-arm64-mac
path: out
run-id: ${{ steps.tag_workflow_id.outputs.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: out-x64-mac
path: out
run-id: ${{ steps.tag_workflow_id.outputs.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: out-yml-mac
path: out
run-id: ${{ steps.tag_workflow_id.outputs.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: out-arm64-linux
path: out
run-id: ${{ steps.tag_workflow_id.outputs.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: out-x64-linux
path: out
run-id: ${{ steps.tag_workflow_id.outputs.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: out-yml-linux
path: out
run-id: ${{ steps.tag_workflow_id.outputs.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: out-download-json
path: out
run-id: ${{ steps.tag_workflow_id.outputs.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: List artifacts
run: ls -R out
- name: Override release notes
env:
NOTES: ${{ github.event.release.body }}
run: yarn files:set-notes
- name: Authenticate to Google Cloud
uses: 'google-github-actions/auth@v2.1.7'
with:
credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}'
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v2.1.2
with:
project_id: ${{ env.GOOGLE_CLOUD_PROJECT_ID }}
- name: Upload release files to public bucket
uses: google-github-actions/upload-cloud-storage@v2.2.1
with:
path: out
glob: '*'
parent: false
destination: 'dl.kittycad.io/releases/modeling-app'
- name: Invalidate bucket cache on latest*.yml and last_download.json files
run: |
gcloud compute url-maps invalidate-cdn-cache dl-url-map --path="/releases/modeling-app/last_download.json" --async
gcloud compute url-maps invalidate-cdn-cache dl-url-map --path="/releases/modeling-app/latest-linux-arm64.yml" --async
gcloud compute url-maps invalidate-cdn-cache dl-url-map --path="/releases/modeling-app/latest-mac.yml" --async
gcloud compute url-maps invalidate-cdn-cache dl-url-map --path="/releases/modeling-app/latest.yml" --async
announce_release:
needs: [publish-apps-release]
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: Announce Release
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
RELEASE_VERSION: ${{ github.event.release.tag_name }}
RELEASE_BODY: ${{ github.event.release.body }}
run: python public/announce_release.py

View File

@ -128,45 +128,39 @@ Before you submit a contribution PR to this repo, please ensure that:
## Release a new version
#### 1. Bump the versions by running `./make-release.sh`
#### 1. Create a 'Cut release $VERSION' issue
The `./make-release.sh` script has git commands to pull main but to be sure you can run the following git commands to have a fresh `main` locally.
It will be used to document changelog discussions and release testing.
https://github.com/KittyCAD/modeling-app/issues/new
#### 2. Push a new tag
Create a new tag and push it to the repo (eg. `v0.28.0` for `$VERSION`)
```
git branch -D main
git checkout main
git pull origin
./make-release.sh
# Copy within the back ticks and paste the stdout of the change log
git push --set-upstream origin <branch name created from ./make-release.sh>
VERSION=$(./scripts/semantic-release.sh)
git tag $VERSION
git push origin --tags
```
That will create the branch with the updated json files for you:
- run `./make-release.sh` or `./make-release.sh patch` for a patch update;
- run `./make-release.sh minor` for minor; or
- run `./make-release.sh major` for major.
This will trigger the `build-apps` workflow, set the version, build & sign the apps, and generate release files as well as updater-test artifacts.
After it runs you should just need the push the branch and open a PR.
#### 2. Create a Cut Release PR
When you open the PR copy the change log from the output of the `./make-release.sh` script into the description of the PR.
**Important:** Pull request title needs to be prefixed with `Cut release v` to build in release mode and a few other things to test in the best context possible, the intent would be for instance to have `Cut release v1.2.3` for the `v1.2.3` release candidate.
The PR may then serve as a place to discuss the human-readable changelog and extra QA. The `make-release.sh` tool suggests a changelog for you too to be used as PR description, just make sure to delete lines that are not user facing.
Once the workflow succeeds, a draft release will be created at https://github.com/KittyCAD/modeling-app/releases.
#### 3. Manually test artifacts from the Cut Release PR
##### Release builds
The release builds can be found under the `out-{platform}` zip, at the very bottom of the `build-publish-apps` summary page for each commit on this branch.
The release builds can be found under the `out-{arch}-{platform}` zip files, at the very bottom of the `build-apps` summary page for the workflow (triggered by the tag in 2.).
Manually test against this [list](https://github.com/KittyCAD/modeling-app/issues/3588) across Windows, MacOS, Linux and posting results as comments in the Cut Release PR.
Alternatively, the draft release will also include these builds.
Manually test against this [list](https://github.com/KittyCAD/modeling-app/issues/3588) across Windows, MacOS, Linux and posting results as comments in the issue.
##### Updater-test builds
The other `build-publish-apps` output in Cut Release PRs is `updater-test-{platform}`. As we don't have a way to test this fully automatically, we have a semi-automated process. For macOS, Windows, and Linux, download the corresponding updater-test artifact file, install the app, run it, expect an updater prompt to a dummy v0.255.255, install it and check that the app comes back at that version.
The other `build-apps` output in the release `build-apps` workflow (triggered by 2.) is `updater-test-{arch}-{platform}`. It's a semi-automated process: for macOS, Windows, and Linux, download the corresponding updater-test artifact file, install the app, run it, expect an updater prompt to a dummy v0.255.255, install it and check that the app comes back at that version.
The only difference with these builds is that they point to a different update location on the release bucket, with this dummy v0.255.255 always available. This helps ensuring that the version we release will be able to update to the next one available.
@ -182,18 +176,15 @@ If the prompt doesn't show up, start the app in command line to grab the electro
./Zoo Modeling App-{version}-{arch}-linux.AppImage
```
#### 4. Merge the Cut Release PR
#### 4. Publish the release
This will kick the `create-release` action, that creates a _Draft_ release out of this Cut Release PR merge after less than a minute, with the new version as title and Cut Release PR as description.
Head over to https://github.com/KittyCAD/modeling-app/releases, paste in the changelog discussed in the issue, and publish the draft release created by the `build-apps` workflow from step 2.
A new Action kicks in at https://github.com/KittyCAD/modeling-app/actions, which can be found under `release` event filter. On success, the files will be uploaded to the public bucket and the announcement on Discord will be sent.
#### 5. Publish the release
#### 5. Close the issue
Head over to https://github.com/KittyCAD/modeling-app/releases, the draft release corresponding to the merged Cut Release PR should show up at the top as _Draft_. Click on it, verify the content, and hit _Publish_.
#### 6. Profit
A new Action kicks in at https://github.com/KittyCAD/modeling-app/actions, which can be found under `release` event filter.
If everything is well and the release is out to the public, the issue tracking the release shall be closed.
## Fuzzing the parser

BIN
assets/icon-nightly.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

BIN
assets/icon-nightly.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

Binary file not shown.

View File

@ -36,9 +36,9 @@ myAngle = -120
sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([8, 0], %)
|> angledLine({ angle: abs(myAngle), length: 5 }, %)
|> angledLine({ angle = abs(myAngle), length = 5 }, %)
|> line([-5, 0], %)
|> angledLine({ angle: myAngle, length: 5 }, %)
|> angledLine({ angle = myAngle, length = 5 }, %)
|> close(%)
baseExtrusion = extrude(5, sketch001)

View File

@ -34,8 +34,8 @@ acos(num: number) -> number
sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> angledLine({
angle: toDegrees(acos(0.5)),
length: 10
angle = toDegrees(acos(0.5)),
length = 10
}, %)
|> line([5, 0], %)
|> lineTo([12, 0], %)

View File

@ -1,10 +1,10 @@
---
title: "angleToMatchLengthX"
excerpt: "Compute the angle (in degrees) in o"
excerpt: "Returns the angle to match the given length for x."
layout: manual
---
Compute the angle (in degrees) in o
Returns the angle to match the given length for x.

View File

@ -33,8 +33,8 @@ sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([1, 2], %, $seg01)
|> angledLine({
angle: angleToMatchLengthY(seg01, 15, %),
length: 5
angle = angleToMatchLengthY(seg01, 15, %),
length = 5
}, %)
|> yLineTo(0, %)
|> close(%)

View File

@ -32,7 +32,7 @@ angledLine(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> yLineTo(15, %)
|> angledLine({ angle: 30, length: 15 }, %)
|> angledLine({ angle = 30, length = 15 }, %)
|> line([8, -10], %)
|> yLineTo(0, %)
|> close(%)

View File

@ -31,8 +31,8 @@ angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -
```js
sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> angledLineOfXLength({ angle: 45, length: 10 }, %, $edge1)
|> angledLineOfXLength({ angle: -15, length: 20 }, %, $edge2)
|> angledLineOfXLength({ angle = 45, length = 10 }, %, $edge1)
|> angledLineOfXLength({ angle = -15, length = 20 }, %, $edge2)
|> line([0, -5], %)
|> close(%, $edge3)

View File

@ -32,9 +32,9 @@ angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([10, 0], %)
|> angledLineOfYLength({ angle: 45, length: 10 }, %)
|> angledLineOfYLength({ angle = 45, length = 10 }, %)
|> line([0, 10], %)
|> angledLineOfYLength({ angle: 135, length: 10 }, %)
|> angledLineOfYLength({ angle = 135, length = 10 }, %)
|> line([-10, 0], %)
|> line([0, -30], %)

View File

@ -35,9 +35,9 @@ exampleSketch = startSketchOn('XZ')
|> lineTo([-10, 10], %, $lineToIntersect)
|> lineTo([0, 20], %)
|> angledLineThatIntersects({
angle: 80,
intersectTag: lineToIntersect,
offset: 10
angle = 80,
intersectTag = lineToIntersect,
offset = 10
}, %)
|> close(%)

View File

@ -31,7 +31,7 @@ angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sk
```js
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> angledLineToX({ angle: 30, to: 10 }, %)
|> angledLineToX({ angle = 30, to = 10 }, %)
|> line([0, 10], %)
|> line([-10, 0], %)
|> close(%)

View File

@ -31,9 +31,9 @@ angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sk
```js
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> angledLineToY({ angle: 60, to: 20 }, %)
|> angledLineToY({ angle = 60, to = 20 }, %)
|> line([-20, 0], %)
|> angledLineToY({ angle: 70, to: 10 }, %)
|> angledLineToY({ angle = 70, to = 10 }, %)
|> close(%)
example = extrude(10, exampleSketch)

File diff suppressed because one or more lines are too long

41
docs/kcl/arcTo.md Normal file

File diff suppressed because one or more lines are too long

View File

@ -34,8 +34,8 @@ asin(num: number) -> number
sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> angledLine({
angle: toDegrees(asin(0.5)),
length: 20
angle = toDegrees(asin(0.5)),
length = 20
}, %)
|> yLineTo(0, %)
|> close(%)

View File

@ -34,8 +34,8 @@ atan(num: number) -> number
sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> angledLine({
angle: toDegrees(atan(1.25)),
length: 20
angle = toDegrees(atan(1.25)),
length = 20
}, %)
|> yLineTo(0, %)
|> close(%)

View File

@ -33,9 +33,9 @@ exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([0, 10], %)
|> bezierCurve({
to: [10, 10],
control1: [5, 0],
control2: [5, 10]
to = [10, 10],
control1 = [5, 0],
control2 = [5, 10]
}, %)
|> lineTo([10, 0], %)
|> close(%)

View File

@ -44,8 +44,8 @@ mountingPlateSketch = startSketchOn("XY")
mountingPlate = extrude(thickness, mountingPlateSketch)
|> chamfer({
length: chamferLength,
tags: [
length = chamferLength,
tags = [
getNextAdjacentEdge(edge1),
getNextAdjacentEdge(edge2),
getNextAdjacentEdge(edge3),
@ -72,8 +72,8 @@ part001 = cube([0, 0], 20)
|> close(%, $line1)
|> extrude(20, %)
|> chamfer({
length: 10,
tags: [getOppositeEdge(line1)]
length = 10,
tags = [getOppositeEdge(line1)]
}, %, $chamfer1) // We tag the chamfer to reference it later.
sketch001 = startSketchOn(part001, chamfer1)

View File

@ -30,7 +30,7 @@ circle(data: CircleData, sketch_surface_or_group: SketchOrSurface, tag?: TagDecl
```js
exampleSketch = startSketchOn("-XZ")
|> circle({ center: [0, 0], radius: 10 }, %)
|> circle({ center = [0, 0], radius = 10 }, %)
example = extrude(5, exampleSketch)
```
@ -44,7 +44,7 @@ exampleSketch = startSketchOn("XZ")
|> line([0, 30], %)
|> line([-30, 0], %)
|> close(%)
|> hole(circle({ center: [0, 15], radius: 5 }, %), %)
|> hole(circle({ center = [0, 15], radius = 5 }, %), %)
example = extrude(5, exampleSketch)
```

View File

@ -34,8 +34,8 @@ cos(num: number) -> number
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({
angle: 30,
length: 3 / cos(toRadians(30))
angle = 30,
length = 3 / cos(toRadians(30))
}, %)
|> yLineTo(0, %)
|> close(%)

View File

@ -28,7 +28,7 @@ e() -> number
```js
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 30, length: 2 * e() ^ 2 }, %)
|> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %)
|> yLineTo(0, %)
|> close(%)

View File

@ -32,16 +32,16 @@ example = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([10, 0], %)
|> arc({
angleStart: 120,
angleEnd: 0,
radius: 5
angleStart = 120,
angleEnd = 0,
radius = 5
}, %)
|> line([5, 0], %)
|> line([0, 10], %)
|> bezierCurve({
control1: [-10, 0],
control2: [2, 10],
to: [-5, 10]
control1 = [-10, 0],
control2 = [2, 10],
to = [-5, 10]
}, %)
|> line([-5, -2], %)
|> close(%)
@ -54,16 +54,16 @@ example = startSketchOn('XZ')
exampleSketch = startSketchOn('XZ')
|> startProfileAt([-10, 0], %)
|> arc({
angleStart: 120,
angleEnd: -60,
radius: 5
angleStart = 120,
angleEnd = -60,
radius = 5
}, %)
|> line([10, 0], %)
|> line([5, 0], %)
|> bezierCurve({
control1: [-3, 0],
control2: [2, 10],
to: [-5, 10]
control1 = [-3, 0],
control2 = [2, 10],
to = [-5, 10]
}, %)
|> line([-4, 10], %)
|> line([-5, -2], %)

View File

@ -43,8 +43,8 @@ mountingPlateSketch = startSketchOn("XY")
mountingPlate = extrude(thickness, mountingPlateSketch)
|> fillet({
radius: filletRadius,
tags: [
radius = filletRadius,
tags = [
getNextAdjacentEdge(edge1),
getNextAdjacentEdge(edge2),
getNextAdjacentEdge(edge3),
@ -70,9 +70,9 @@ mountingPlateSketch = startSketchOn("XY")
mountingPlate = extrude(thickness, mountingPlateSketch)
|> fillet({
radius: filletRadius,
tolerance: 0.000001,
tags: [
radius = filletRadius,
tolerance = 0.000001,
tags = [
getNextAdjacentEdge(edge1),
getNextAdjacentEdge(edge2),
getNextAdjacentEdge(edge3),

View File

@ -30,16 +30,16 @@ getNextAdjacentEdge(tag: TagIdentifier) -> Uuid
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([10, 0], %)
|> angledLine({ angle: 60, length: 10 }, %)
|> angledLine({ angle: 120, length: 10 }, %)
|> angledLine({ angle = 60, length = 10 }, %)
|> angledLine({ angle = 120, length = 10 }, %)
|> line([-10, 0], %)
|> angledLine({ angle: 240, length: 10 }, %, $referenceEdge)
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|> close(%)
example = extrude(5, exampleSketch)
|> fillet({
radius: 3,
tags: [getNextAdjacentEdge(referenceEdge)]
radius = 3,
tags = [getNextAdjacentEdge(referenceEdge)]
}, %)
```

View File

@ -30,16 +30,16 @@ getOppositeEdge(tag: TagIdentifier) -> Uuid
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([10, 0], %)
|> angledLine({ angle: 60, length: 10 }, %)
|> angledLine({ angle: 120, length: 10 }, %)
|> angledLine({ angle = 60, length = 10 }, %)
|> angledLine({ angle = 120, length = 10 }, %)
|> line([-10, 0], %)
|> angledLine({ angle: 240, length: 10 }, %, $referenceEdge)
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|> close(%)
example = extrude(5, exampleSketch)
|> fillet({
radius: 3,
tags: [getOppositeEdge(referenceEdge)]
radius = 3,
tags = [getOppositeEdge(referenceEdge)]
}, %)
```

View File

@ -30,16 +30,16 @@ getPreviousAdjacentEdge(tag: TagIdentifier) -> Uuid
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([10, 0], %)
|> angledLine({ angle: 60, length: 10 }, %)
|> angledLine({ angle: 120, length: 10 }, %)
|> angledLine({ angle = 60, length = 10 }, %)
|> angledLine({ angle = 120, length = 10 }, %)
|> line([-10, 0], %)
|> angledLine({ angle: 240, length: 10 }, %, $referenceEdge)
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|> close(%)
example = extrude(5, exampleSketch)
|> fillet({
radius: 3,
tags: [getPreviousAdjacentEdge(referenceEdge)]
radius = 3,
tags = [getPreviousAdjacentEdge(referenceEdge)]
}, %)
```

View File

@ -29,12 +29,12 @@ helix(data: HelixData, solid: Solid) -> Solid
```js
part001 = startSketchOn('XY')
|> circle({ center: [5, 5], radius: 10 }, %)
|> circle({ center = [5, 5], radius = 10 }, %)
|> extrude(10, %)
|> helix({
angleStart: 0,
ccw: true,
revolutions: 16
angleStart = 0,
ccw = true,
revolutions = 16
}, %)
```

View File

@ -34,8 +34,8 @@ exampleSketch = startSketchOn('XY')
|> line([5, 0], %)
|> line([0, -5], %)
|> close(%)
|> hole(circle({ center: [1, 1], radius: .25 }, %), %)
|> hole(circle({ center: [1, 4], radius: .25 }, %), %)
|> hole(circle({ center = [1, 1], radius = .25 }, %), %)
|> hole(circle({ center = [1, 4], radius = .25 }, %), %)
example = extrude(1, exampleSketch)
```
@ -54,7 +54,7 @@ fn squareHoleSketch = () => {
}
exampleSketch = startSketchOn('-XZ')
|> circle({ center: [0, 0], radius: 3 }, %)
|> circle({ center = [0, 0], radius = 3 }, %)
|> hole(squareHoleSketch(), %)
example = extrude(1, exampleSketch)
```

View File

@ -68,15 +68,15 @@ case = startSketchOn('-XZ')
thing1 = startSketchOn(case, 'end')
|> circle({
center: [-size / 2, -size / 2],
radius: 25
center = [-size / 2, -size / 2],
radius = 25
}, %)
|> extrude(50, %)
thing2 = startSketchOn(case, 'end')
|> circle({
center: [size / 2, -size / 2],
radius: 25
center = [size / 2, -size / 2],
radius = 25
}, %)
|> extrude(50, %)

File diff suppressed because one or more lines are too long

View File

@ -7,6 +7,7 @@ layout: manual
## Table of Contents
* [Types](kcl/types)
* [Modules](kcl/modules)
* [Known Issues](kcl/KNOWN-ISSUES)
* [`abs`](kcl/abs)
* [`acos`](kcl/acos)
@ -19,6 +20,7 @@ layout: manual
* [`angledLineToX`](kcl/angledLineToX)
* [`angledLineToY`](kcl/angledLineToY)
* [`arc`](kcl/arc)
* [`arcTo`](kcl/arcTo)
* [`asin`](kcl/asin)
* [`assert`](kcl/assert)
* [`assertEqual`](kcl/assertEqual)
@ -72,6 +74,7 @@ layout: manual
* [`patternLinear2d`](kcl/patternLinear2d)
* [`patternLinear3d`](kcl/patternLinear3d)
* [`patternTransform`](kcl/patternTransform)
* [`patternTransform2d`](kcl/patternTransform2d)
* [`pi`](kcl/pi)
* [`polar`](kcl/polar)
* [`polygon`](kcl/polygon)
@ -83,6 +86,7 @@ layout: manual
* [`reduce`](kcl/reduce)
* [`rem`](kcl/rem)
* [`revolve`](kcl/revolve)
* [`round`](kcl/round)
* [`segAng`](kcl/segAng)
* [`segEnd`](kcl/segEnd)
* [`segEndX`](kcl/segEndX)
@ -98,6 +102,7 @@ layout: manual
* [`startSketchAt`](kcl/startSketchAt)
* [`startSketchOn`](kcl/startSketchOn)
* [`tan`](kcl/tan)
* [`tangentToEnd`](kcl/tangentToEnd)
* [`tangentialArc`](kcl/tangentialArc)
* [`tangentialArcTo`](kcl/tangentialArcTo)
* [`tangentialArcToRelative`](kcl/tangentialArcToRelative)

View File

@ -6,12 +6,10 @@ layout: manual
Convert a number to an integer.
Callers should use floor(), ceil(), or other rounding function first if they care about how numbers with fractional parts are converted. If the number has a fractional part, it's truncated, moving the number towards zero.
If the number is NaN or has a magnitude, either positive or negative, that is too large to fit into the internal integer representation, the result is a runtime error.
DEPRECATED use floor(), ceil(), or round().
```js
int(num: number) -> i64
int(num: number) -> number
```
### Tags
@ -27,7 +25,7 @@ int(num: number) -> i64
### Returns
`i64`
`number`
### Examples
@ -37,10 +35,10 @@ n = int(ceil(5 / 2))
assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
// Draw n cylinders.
startSketchOn('XZ')
|> circle({ center: [0, 0], radius: 2 }, %)
|> circle({ center = [0, 0], radius = 2 }, %)
|> extrude(5, %)
|> patternTransform(n, (id) => {
return { translate: [4 * id, 0, 0] }
return { translate = [4 * id, 0, 0] }
}, %)
```

View File

@ -60,10 +60,10 @@ squareSketch = startSketchOn('XY')
|> close(%)
circleSketch0 = startSketchOn(offsetPlane('XY', 75))
|> circle({ center: [0, 100], radius: 50 }, %)
|> circle({ center = [0, 100], radius = 50 }, %)
circleSketch1 = startSketchOn(offsetPlane('XY', 150))
|> circle({ center: [0, 100], radius: 20 }, %)
|> circle({ center = [0, 100], radius = 20 }, %)
loft([
squareSketch,
@ -85,10 +85,10 @@ squareSketch = startSketchOn('XY')
|> close(%)
circleSketch0 = startSketchOn(offsetPlane('XY', 75))
|> circle({ center: [0, 100], radius: 50 }, %)
|> circle({ center = [0, 100], radius = 50 }, %)
circleSketch1 = startSketchOn(offsetPlane('XY', 150))
|> circle({ center: [0, 100], radius: 20 }, %)
|> circle({ center = [0, 100], radius = 20 }, %)
loft([
squareSketch,
@ -97,17 +97,17 @@ loft([
], {
// This can be set to override the automatically determined
// topological base curve, which is usually the first section encountered.
baseCurveIndex: 0,
baseCurveIndex = 0,
// Attempt to approximate rational curves (such as arcs) using a bezier.
// This will remove banding around interpolations between arcs and non-arcs.
// It may produce errors in other scenarios Over time, this field won't be necessary.
bezApproximateRational: false,
bezApproximateRational = false,
// Tolerance for the loft operation.
tolerance: 0.000001,
tolerance = 0.000001,
// Degree of the interpolation. Must be greater than zero.
// For example, use 2 for quadratic, or 3 for cubic interpolation in
// the V direction. This defaults to 2, if not specified.
vDegree: 2
vDegree = 2
})
```

View File

@ -31,7 +31,7 @@ map(array: [KclValue], map_fn: FunctionParam) -> [KclValue]
r = 10 // radius
fn drawCircle = (id) => {
return startSketchOn("XY")
|> circle({ center: [id * 2 * r, 0], radius: r }, %)
|> circle({ center = [id * 2 * r, 0], radius = r }, %)
}
// Call `drawCircle`, passing in each element of the array.
@ -47,7 +47,7 @@ r = 10 // radius
// Call `map`, using an anonymous function instead of a named one.
circles = map([1..3], (id) => {
return startSketchOn("XY")
|> circle({ center: [id * 2 * r, 0], radius: r }, %)
|> circle({ center = [id * 2 * r, 0], radius = r }, %)
})
```

View File

@ -34,8 +34,8 @@ max(args: [number]) -> number
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({
angle: 70,
length: max(15, 31, 4, 13, 22)
angle = 70,
length = max(15, 31, 4, 13, 22)
}, %)
|> line([20, 0], %)
|> close(%)

View File

@ -34,8 +34,8 @@ min(args: [number]) -> number
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({
angle: 70,
length: min(15, 31, 4, 13, 22)
angle = 70,
length = min(15, 31, 4, 13, 22)
}, %)
|> line([20, 0], %)
|> close(%)

View File

@ -41,7 +41,7 @@ sketch001 = startSketchOn('XZ')
|> line([-8, -3], %)
|> line([9, -1], %)
|> line([-19, -0], %)
|> mirror2d({ axis: 'Y' }, %)
|> mirror2d({ axis = 'Y' }, %)
example = extrude(10, sketch001)
```
@ -54,7 +54,7 @@ sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 8.5], %)
|> line([20, -8.5], %)
|> line([-20, -8.5], %)
|> mirror2d({ axis: 'Y' }, %)
|> mirror2d({ axis = 'Y' }, %)
example = extrude(10, sketch001)
```
@ -71,7 +71,7 @@ sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 8.5], %)
|> line([20, -8.5], %)
|> line([-20, -8.5], %)
|> mirror2d({ axis: edge001 }, %)
|> mirror2d({ axis = edge001 }, %)
example = extrude(10, sketch001)
```
@ -85,8 +85,11 @@ sketch001 = startSketchOn('XZ')
|> line([20, -8.5], %)
|> line([-20, -8.5], %)
|> mirror2d({
axis: {
custom: { axis: [0.0, 1.0], origin: [0.0, 0.0] }
axis = {
custom = {
axis = [0.0, 1.0],
origin = [0.0, 0.0]
}
}
}, %)

59
docs/kcl/modules.md Normal file
View File

@ -0,0 +1,59 @@
---
title: "KCL Modules"
excerpt: "Documentation of modules for the KCL language for the Zoo Modeling App."
layout: manual
---
`KCL` allows splitting code up into multiple files. Each file is somewhat
isolated from other files as a separate module.
When you define a function, you can use `export` before it to make it available
to other modules.
```
// util.kcl
export fn increment = (x) => {
return x + 1
}
```
Other files in the project can now import functions that have been exported.
This makes them available to use in another file.
```
// main.kcl
import increment from "util.kcl"
answer = increment(41)
```
Imported files _must_ be in the same project so that units are uniform across
modules. This means that it must be in the same directory.
Import statements must be at the top-level of a file. It is not allowed to have
an `import` statement inside a function or in the body of an if-else.
Multiple functions can be exported in a file.
```
// util.kcl
export fn increment = (x) => {
return x + 1
}
export fn decrement = (x) => {
return x - 1
}
```
When importing, you can import multiple functions at once.
```
import increment, decrement from "util.kcl"
```
Imported symbols can be renamed for convenience or to avoid name collisions.
```
import increment as inc, decrement as dec from "util.kcl"
```

File diff suppressed because one or more lines are too long

View File

@ -35,10 +35,10 @@ exampleSketch = startSketchOn('XZ')
|> line([0, -5], %)
|> close(%)
|> patternCircular2d({
center: [0, 0],
instances: 13,
arcDegrees: 360,
rotateDuplicates: true
center = [0, 0],
instances = 13,
arcDegrees = 360,
rotateDuplicates = true
}, %)
example = extrude(1, exampleSketch)

View File

@ -29,15 +29,15 @@ patternCircular3d(data: CircularPattern3dData, solid_set: SolidSet) -> [Solid]
```js
exampleSketch = startSketchOn('XZ')
|> circle({ center: [0, 0], radius: 1 }, %)
|> circle({ center = [0, 0], radius = 1 }, %)
example = extrude(-5, exampleSketch)
|> patternCircular3d({
axis: [1, -1, 0],
center: [10, -20, 0],
instances: 11,
arcDegrees: 360,
rotateDuplicates: true
axis = [1, -1, 0],
center = [10, -20, 0],
instances = 11,
arcDegrees = 360,
rotateDuplicates = true
}, %)
```

View File

@ -29,11 +29,11 @@ patternLinear2d(data: LinearPattern2dData, sketch_set: SketchSet) -> [Sketch]
```js
exampleSketch = startSketchOn('XZ')
|> circle({ center: [0, 0], radius: 1 }, %)
|> circle({ center = [0, 0], radius = 1 }, %)
|> patternLinear2d({
axis: [1, 0],
instances: 7,
distance: 4
axis = [1, 0],
instances = 7,
distance = 4
}, %)
example = extrude(1, exampleSketch)

View File

@ -37,9 +37,9 @@ exampleSketch = startSketchOn('XZ')
example = extrude(1, exampleSketch)
|> patternLinear3d({
axis: [1, 0, 1],
instances: 7,
distance: 6
axis = [1, 0, 1],
instances = 7,
distance = 6
}, %)
```

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -30,8 +30,8 @@ circumference = 70
exampleSketch = startSketchOn("XZ")
|> circle({
center: [0, 0],
radius: circumference / (2 * pi())
center = [0, 0],
radius = circumference / (2 * pi())
}, %)
example = extrude(5, exampleSketch)

View File

@ -29,7 +29,7 @@ polar(data: PolarCoordsData) -> [number]
```js
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line(polar({ angle: 30, length: 5 }), %, $thing)
|> line(polar({ angle = 30, length = 5 }), %, $thing)
|> line([0, 5], %)
|> line([segEndX(thing), 0], %)
|> line([-20, 10], %)

File diff suppressed because one or more lines are too long

View File

@ -34,7 +34,7 @@ pow(num: number, pow: number) -> number
```js
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: pow(5, 2) }, %)
|> angledLine({ angle = 50, length = pow(5, 2) }, %)
|> yLineTo(0, %)
|> close(%)

View File

@ -29,10 +29,10 @@ profileStart(sketch: Sketch) -> [number]
```js
sketch001 = startSketchOn('XY')
|> startProfileAt([5, 2], %)
|> angledLine({ angle: 120, length: 50 }, %, $seg01)
|> angledLine({ angle = 120, length = 50 }, %, $seg01)
|> angledLine({
angle: segAng(seg01) + 120,
length: 50
angle = segAng(seg01) + 120,
length = 50
}, %)
|> lineTo(profileStart(%), %)
|> close(%)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

46
docs/kcl/round.md Normal file

File diff suppressed because one or more lines are too long

View File

@ -38,7 +38,10 @@ cube = startSketchAt([0, 0])
fn cylinder = (radius, tag) => {
return startSketchAt([0, 0])
|> circle({ radius: radius, center: segEnd(tag) }, %)
|> circle({
radius = radius,
center = segEnd(tag)
}, %)
|> extrude(radius, %)
}

View File

@ -29,9 +29,9 @@ segLen(tag: TagIdentifier) -> number
```js
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 60, length: 10 }, %, $thing)
|> tangentialArc({ offset: -120, radius: 5 }, %)
|> angledLine({ angle: -60, length: segLen(thing) }, %)
|> angledLine({ angle = 60, length = 10 }, %, $thing)
|> tangentialArc({ offset = -120, radius = 5 }, %)
|> angledLine({ angle = -60, length = segLen(thing) }, %)
|> close(%)
example = extrude(5, exampleSketch)

View File

@ -39,8 +39,8 @@ cube = startSketchAt([0, 0])
fn cylinder = (radius, tag) => {
return startSketchAt([0, 0])
|> circle({
radius: radius,
center: segStart(tag)
radius = radius,
center = segStart(tag)
}, %)
|> extrude(radius, %)
}

File diff suppressed because one or more lines are too long

View File

@ -34,8 +34,8 @@ sin(num: number) -> number
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({
angle: 50,
length: 15 / sin(toDegrees(135))
angle = 50,
length = 15 / sin(toDegrees(135))
}, %)
|> yLineTo(0, %)
|> close(%)

View File

@ -33,7 +33,7 @@ sqrt(num: number) -> number
```js
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: sqrt(2500) }, %)
|> angledLine({ angle = 50, length = sqrt(2500) }, %)
|> yLineTo(0, %)
|> close(%)

View File

@ -101,7 +101,7 @@ exampleSketch = startSketchOn('XY')
|> line([-2, 0], %)
|> close(%)
example = revolve({ axis: 'y', angle: 180 }, exampleSketch)
example = revolve({ axis = 'y', angle = 180 }, exampleSketch)
exampleSketch002 = startSketchOn(example, 'end')
|> startProfileAt([4.5, -5], %)
@ -117,11 +117,11 @@ example002 = extrude(5, exampleSketch002)
```js
a1 = startSketchOn({
plane: {
origin: { x: 0, y: 0, z: 0 },
xAxis: { x: 1, y: 0, z: 0 },
yAxis: { x: 0, y: 1, z: 0 },
zAxis: { x: 0, y: 0, z: 1 }
plane = {
origin = { x = 0, y = 0, z = 0 },
xAxis = { x = 1, y = 0, z = 0 },
yAxis = { x = 0, y = 1, z = 0 },
zAxis = { x = 0, y = 0, z = 1 }
}
})
|> startProfileAt([0, 0], %)

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,7 @@ tan(num: number) -> number
```js
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: 50 * tan(1 / 2) }, %)
|> angledLine({ angle = 50, length = 50 * tan(1 / 2) }, %)
|> yLineTo(0, %)
|> close(%)

105
docs/kcl/tangentToEnd.md Normal file

File diff suppressed because one or more lines are too long

View File

@ -31,9 +31,9 @@ tangentialArc(data: TangentialArcData, sketch: Sketch, tag?: TagDeclarator) -> S
```js
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 60, length: 10 }, %)
|> tangentialArc({ radius: 10, offset: -120 }, %)
|> angledLine({ angle: -60, length: 10 }, %)
|> angledLine({ angle = 60, length = 10 }, %)
|> tangentialArc({ radius = 10, offset = -120 }, %)
|> angledLine({ angle = -60, length = 10 }, %)
|> close(%)
example = extrude(10, exampleSketch)

View File

@ -31,7 +31,7 @@ tangentialArcTo(to: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
```js
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 60, length: 10 }, %)
|> angledLine({ angle = 60, length = 10 }, %)
|> tangentialArcTo([15, 15], %)
|> line([10, -15], %)
|> close(%)

View File

@ -31,7 +31,7 @@ tangentialArcToRelative(delta: [number], sketch: Sketch, tag?: TagDeclarator) ->
```js
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 45, length: 10 }, %)
|> angledLine({ angle = 45, length = 10 }, %)
|> tangentialArcToRelative([0, -10], %)
|> line([-10, 0], %)
|> close(%)

View File

@ -28,7 +28,7 @@ tau() -> number
```js
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: 10 * tau() }, %)
|> angledLine({ angle = 50, length = 10 * tau() }, %)
|> yLineTo(0, %)
|> close(%)

View File

@ -34,8 +34,8 @@ toDegrees(num: number) -> number
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({
angle: 50,
length: 70 * cos(toDegrees(pi() / 4))
angle = 50,
length = 70 * cos(toDegrees(pi() / 4))
}, %)
|> yLineTo(0, %)
|> close(%)

View File

@ -34,8 +34,8 @@ toRadians(num: number) -> number
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({
angle: 50,
length: 70 * cos(toRadians(45))
angle = 50,
length = 70 * cos(toRadians(45))
}, %)
|> yLineTo(0, %)
|> close(%)

View File

@ -0,0 +1,22 @@
---
title: "ArcToData"
excerpt: "Data to draw a three point arc (arcTo)."
layout: manual
---
Data to draw a three point arc (arcTo).
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `end` |`[number, number]`| End point of the arc. A point in 3D space | No |
| `interior` |`[number, number]`| Interior point of the arc. A point in 3D space | No |

View File

@ -16,7 +16,7 @@ Data for a circular pattern on a 2D sketch.
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `instances` |[`Uint`](/docs/kcl/types/Uint)| The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | No |
| `instances` |`integer`| The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | No |
| `center` |`[number, number]`| The center about which to make the pattern. This is a 2D vector. | No |
| `arcDegrees` |`number`| The arc angle (in degrees) to place the repetitions. Must be greater than 0. | No |
| `rotateDuplicates` |`boolean`| Whether or not to rotate the duplicates as they are copied. | No |

View File

@ -16,7 +16,7 @@ Data for a circular pattern on a 3D model.
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `instances` |[`Uint`](/docs/kcl/types/Uint)| The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | No |
| `instances` |`integer`| The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | No |
| `axis` |`[number, number, number]`| The axis around which to make the pattern. This is a 3D vector. | No |
| `center` |`[number, number, number]`| The center about which to make the pattern. This is a 3D vector. | No |
| `arcDegrees` |`number`| The arc angle (in degrees) to place the repetitions. Must be greater than 0. | No |

View File

@ -24,7 +24,7 @@ Autodesk Filmbox (FBX) format
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `fbx`| | No |
| `format` |enum: `fbx`| | No |
----
@ -40,7 +40,7 @@ Binary glTF 2.0. We refer to this as glTF since that is how our customers refer
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `gltf`| | No |
| `format` |enum: `gltf`| | No |
----
@ -56,7 +56,7 @@ Wavefront OBJ format.
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `obj`| | No |
| `format` |enum: `obj`| | No |
| `coords` |[`System`](/docs/kcl/types/System)| Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. | No |
| `units` |[`UnitLength`](/docs/kcl/types/UnitLength)| The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. | No |
@ -74,7 +74,7 @@ The PLY Polygon File Format.
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `ply`| | No |
| `format` |enum: `ply`| | No |
| `coords` |[`System`](/docs/kcl/types/System)| Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. | No |
| `units` |[`UnitLength`](/docs/kcl/types/UnitLength)| The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. | No |
@ -92,7 +92,7 @@ SolidWorks part (SLDPRT) format.
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `sldprt`| | No |
| `format` |enum: `sldprt`| | No |
----
@ -108,7 +108,7 @@ ISO 10303-21 (STEP) format.
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `step`| | No |
| `format` |enum: `step`| | No |
----
@ -124,7 +124,7 @@ ST**ereo**L**ithography format.
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `stl`| | No |
| `format` |enum: `stl`| | No |
| `coords` |[`System`](/docs/kcl/types/System)| Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. | No |
| `units` |[`UnitLength`](/docs/kcl/types/UnitLength)| The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. | No |

16
docs/kcl/types/KclNone.md Normal file
View File

@ -0,0 +1,16 @@
---
title: "KclNone"
excerpt: "KCL value for an optional parameter which was not given an argument. (remember, parameters are in the function declaration, arguments are in the function call/application)."
layout: manual
---
KCL value for an optional parameter which was not given an argument. (remember, parameters are in the function declaration, arguments are in the function call/application).
**Type:** `object`

View File

@ -23,8 +23,110 @@ Any KCL value.
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `UserVal`| | No |
| `value` |``| | No |
| `type` |enum: `Uuid`| | No |
| `value` |`string`| | No |
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
----
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `Bool`| | No |
| `value` |`boolean`| | No |
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
----
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `Number`| | No |
| `value` |`number`| | No |
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
----
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `Int`| | No |
| `value` |`integer`| | No |
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
----
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `String`| | No |
| `value` |`string`| | No |
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
----
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `Array`| | No |
| `value` |`[` [`KclValue`](/docs/kcl/types/KclValue) `]`| | No |
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
----
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `Object`| | No |
| `value` |`object`| | No |
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
@ -78,7 +180,7 @@ A plane.
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `Plane`| | No |
| `type` |enum: [`Plane`](/docs/kcl/types/Plane)| | No |
| `id` |`string`| The id of the plane. | No |
| `value` |[`PlaneType`](/docs/kcl/types/PlaneType)| Any KCL value. | No |
| `origin` |[`Point3d`](/docs/kcl/types/Point3d)| Origin of the plane. | No |
@ -111,6 +213,38 @@ A face.
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
----
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: [`Sketch`](/docs/kcl/types/Sketch)| | No |
| `value` |[`Sketch`](/docs/kcl/types/Sketch)| Any KCL value. | No |
----
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `Sketches`| | No |
| `value` |`[` [`Sketch`](/docs/kcl/types/Sketch) `]`| | No |
----
An solid is a collection of extrude surfaces.
@ -190,6 +324,23 @@ Data for an imported geometry.
----
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: [`KclNone`](/docs/kcl/types/KclNone)| | No |
| `value` |[`KclNone`](/docs/kcl/types/KclNone)| Any KCL value. | No |
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
----

View File

@ -16,7 +16,7 @@ Data for a linear pattern on a 2D sketch.
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `instances` |[`Uint`](/docs/kcl/types/Uint)| The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | No |
| `instances` |`integer`| The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | No |
| `distance` |`number`| The distance between each repetition. This can also be referred to as spacing. | No |
| `axis` |`[number, number]`| The axis of the pattern. This is a 2D vector. | No |

View File

@ -16,7 +16,7 @@ Data for a linear pattern on a 3D model.
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `instances` |[`Uint`](/docs/kcl/types/Uint)| The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | No |
| `instances` |`integer`| The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | No |
| `distance` |`number`| The distance between each repetition. This can also be referred to as spacing. | No |
| `axis` |`[number, number, number]`| The axis of the pattern. | No |

View File

@ -11,16 +11,6 @@ layout: manual
**This schema accepts any of the following:**
**Type:** `integer` (`int64`)
----
**Type:** `number` (`double`)

View File

@ -11,23 +11,6 @@ layout: manual
**This schema accepts exactly one of the following:**
A shebang. This is a special type of comment that is at the top of the file. It looks like this: ```python,no_run #!/usr/bin/env python ```
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `shebang`| | No |
| `value` |`string`| | No |
----
An inline comment. Here are examples: `1 + 1 // This is an inline comment`. `1 + 1 /* Here's another */`.
**Type:** `object`

View File

@ -91,7 +91,7 @@ a complete arc
| `type` |enum: `Circle`| | No |
| `center` |`[number, number]`| the arc's center | No |
| `radius` |`number`| the arc's radius | No |
| `ccw` |`boolean`| arc's direction | No |
| `ccw` |`boolean`| arc's direction This is used to compute the tangential angle. | No |
| `from` |`[number, number]`| The from point. | No |
| `to` |`[number, number]`| The to point. | No |
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
@ -177,6 +177,7 @@ A circular arc, not necessarily tangential to the current point.
| `type` |enum: `Arc`| | No |
| `center` |`[number, number]`| Center of the circle that this arc is drawn on. | No |
| `radius` |`number`| Radius of the circle that this arc is drawn on. | No |
| `ccw` |`boolean`| True if the arc is counterclockwise. | No |
| `from` |`[number, number]`| The from point. | No |
| `to` |`[number, number]`| The to point. | No |
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |

27
docs/kcl/types/Plane.md Normal file
View File

@ -0,0 +1,27 @@
---
title: "Plane"
excerpt: "A plane."
layout: manual
---
A plane.
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `id` |`string`| The id of the plane. | No |
| `value` |[`PlaneType`](/docs/kcl/types/PlaneType)| A plane. | No |
| `origin` |[`Point3d`](/docs/kcl/types/Point3d)| Origin of the plane. | No |
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the planes X axis be? | No |
| `yAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the planes Y axis be? | No |
| `zAxis` |[`Point3d`](/docs/kcl/types/Point3d)| The z-axis (normal). | No |
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |

View File

@ -1,10 +1,10 @@
---
title: "PlaneData"
excerpt: "Data for a plane."
excerpt: "Orientation data that can be used to construct a plane, not a plane in itself."
layout: manual
---
Data for a plane.
Orientation data that can be used to construct a plane, not a plane in itself.

View File

@ -18,6 +18,7 @@ A KCL program top level, or function body.
|----------|------|-------------|----------|
| `body` |`[` [`BodyItem`](/docs/kcl/types/BodyItem) `]`| | No |
| `nonCodeMeta` |[`NonCodeMeta`](/docs/kcl/types/NonCodeMeta)| A KCL program top level, or function body. | No |
| `shebang` |[`Shebang`](/docs/kcl/types/Shebang)| | No |
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
| `start` |`integer`| | No |
| `end` |`integer`| | No |

23
docs/kcl/types/Shebang.md Normal file
View File

@ -0,0 +1,23 @@
---
title: "Shebang"
excerpt: "A shebang. This is a special type of comment that is at the top of the file. It looks like this: ```python,no_run #!/usr/bin/env python ```"
layout: manual
---
A shebang. This is a special type of comment that is at the top of the file. It looks like this: ```python,no_run #!/usr/bin/env python ```
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `content` |`string`| | No |
| `start` |`integer`| | No |
| `end` |`integer`| | No |

View File

@ -22,6 +22,18 @@ Data for start sketch on. You can start a sketch on a plane or an solid.
----
Data for start sketch on. You can start a sketch on a plane or an solid.
[`Plane`](/docs/kcl/types/Plane)
----
Data for start sketch on. You can start a sketch on a plane or an solid.

View File

@ -32,10 +32,10 @@ xLine(length: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> xLine(15, %)
|> angledLine({ angle: 80, length: 15 }, %)
|> angledLine({ angle = 80, length = 15 }, %)
|> line([8, -10], %)
|> xLine(10, %)
|> angledLine({ angle: 120, length: 30 }, %)
|> angledLine({ angle = 120, length = 30 }, %)
|> xLine(-15, %)
|> close(%)

View File

@ -32,10 +32,10 @@ xLineTo(to: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> xLineTo(15, %)
|> angledLine({ angle: 80, length: 15 }, %)
|> angledLine({ angle = 80, length = 15 }, %)
|> line([8, -10], %)
|> xLineTo(40, %)
|> angledLine({ angle: 135, length: 30 }, %)
|> angledLine({ angle = 135, length = 30 }, %)
|> xLineTo(10, %)
|> close(%)

View File

@ -32,7 +32,7 @@ yLine(length: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> yLine(15, %)
|> angledLine({ angle: 30, length: 15 }, %)
|> angledLine({ angle = 30, length = 15 }, %)
|> line([8, -10], %)
|> yLine(-5, %)
|> close(%)

View File

@ -31,7 +31,7 @@ yLineTo(to: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
```js
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: 45 }, %)
|> angledLine({ angle = 50, length = 45 }, %)
|> yLineTo(0, %)
|> close(%)

View File

@ -67,15 +67,15 @@ async function doBasicSketch(page: Page, openPanes: string[]) {
if (openPanes.includes('code')) {
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')
|> startProfileAt(${commonPoints.startAt}, %)
|> line([${commonPoints.num1}, 0], %)`)
|> xLine(${commonPoints.num1}, %)`)
}
await page.waitForTimeout(500)
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
if (openPanes.includes('code')) {
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')
|> startProfileAt(${commonPoints.startAt}, %)
|> line([${commonPoints.num1}, 0], %)
|> line([0, ${commonPoints.num1 + 0.01}], %)`)
|> xLine(${commonPoints.num1}, %)
|> yLine(${commonPoints.num1 + 0.01}, %)`)
} else {
await page.waitForTimeout(500)
}
@ -84,9 +84,9 @@ async function doBasicSketch(page: Page, openPanes: string[]) {
if (openPanes.includes('code')) {
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')
|> startProfileAt(${commonPoints.startAt}, %)
|> line([${commonPoints.num1}, 0], %)
|> line([0, ${commonPoints.num1 + 0.01}], %)
|> lineTo([0, ${commonPoints.num3}], %)`)
|> xLine(${commonPoints.num1}, %)
|> yLine(${commonPoints.num1 + 0.01}, %)
|> xLine(${commonPoints.num2 * -1}, %)`)
}
// deselect line tool
@ -142,9 +142,9 @@ async function doBasicSketch(page: Page, openPanes: string[]) {
await u.openKclCodePanel()
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')
|> startProfileAt(${commonPoints.startAt}, %)
|> line([${commonPoints.num1}, 0], %, $seg01)
|> line([0, ${commonPoints.num1 + 0.01}], %)
|> angledLine([180, segLen(seg01)], %)`)
|> xLine(${commonPoints.num1}, %, $seg01)
|> yLine(${commonPoints.num1 + 0.01}, %)
|> xLine(-segLen(seg01), %)`)
}
test.describe('Basic sketch', () => {

View File

@ -87,7 +87,7 @@ extrude001 = extrude(-10, sketch001)`
await page.keyboard.press('Enter') // submit
await page.waitForTimeout(100)
await expect(page.locator('.cm-activeLine')).toContainText(
`fillet({ radius: ${KCL_DEFAULT_LENGTH}, tags: [seg01] }, %)`
`fillet({ radius = ${KCL_DEFAULT_LENGTH}, tags = [seg01] }, %)`
)
})

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