Compare commits

...

30 Commits

Author SHA1 Message Date
c44f81aa1e Disable rectangle tool 2024-07-30 13:10:12 -04:00
07a90b3171 Use kcl_input! macro (#3189)
* Use kcl_input! macro

These two lines are equivalent:
`kcl_input!("foo")`
`include_str!("inputs/foo.kcl")`

Simplifies the tests.

* Move more KCL test programs into their own files

* Move twenty-twenty asserts into their own function

* Move more asserts into 'assert_out'
2024-07-30 11:14:37 -05:00
54936f6932 actually fix lint styles (#3187)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-07-30 07:27:47 +00:00
6e296af507 initialize codemirror lint styles once (#3185)
* fix diagnostic styles

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

* fixes

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

* Revert "fixes"

This reverts commit e7b2411ebc.

* Revert "fix diagnostic styles"

This reverts commit 625099d9c8.

* actual fix

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-07-30 04:42:05 +00:00
60c152bf14 fix edge functions when after sketch on face/fn (#3184)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-07-30 04:30:25 +00:00
59de494125 Bump kittycad from 0.3.8 to 0.3.9 in /src/wasm-lib (#3183)
Bumps [kittycad](https://github.com/KittyCAD/kittycad.rs) from 0.3.8 to 0.3.9.
- [Release notes](https://github.com/KittyCAD/kittycad.rs/releases)
- [Commits](https://github.com/KittyCAD/kittycad.rs/compare/v0.3.8...v0.3.9)

---
updated-dependencies:
- dependency-name: kittycad
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-29 20:49:39 -07:00
1c44b01d16 Fix lazy fillet (#3176)
* WIP: Fix lazy fillet

* cleanup

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
2024-07-30 03:22:52 +00:00
789fb83a5d ensure we clear _before_ we execute when there is a race (#3177)
* updates

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

* comment

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-07-29 19:55:53 -07:00
63fc287742 bugfix: KCL Test Server should clear scene properly (#3174)
There was already a Reset Scene method which properly cleaned up the
3D modeling scene. I didn't know about it, so I wrote my own. But my own
one didn't call the necessary post-clear hooks, so it didn't recreate
the default planes.

This PR calls the right Reset Scene method, so the default planes get
recreated after the scene is cleared.
2024-07-29 20:40:07 -05:00
5e1b91b0e7 wrap with retry - wait on error in gutter (#3137)
* wrap with retry - wait on error in gutter

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

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

This reverts commit 2ca97f90a2.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch>
2024-07-30 07:16:52 +10:00
a1c2e817a4 internal linter for making sure everything is camel case (#3172)
* updates

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

* add lint rule for object property key

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

* add linter to example shit

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

* fix samples

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

* fix lints

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

* updates

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

* generate docs

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-07-29 20:18:55 +00:00
6ed4e72e1d KCL execution server can use a local engine (#3171)
Allow the KCL execution server to choose a local engine, instead of just
the remote engine.

Technically this was already possible, via the $LOCAL_ENGINE_ADDR
environment variable. But it was hard to discover this.
2024-07-29 13:43:27 -05:00
6477011c0f Fix to not crash when there's no var declaration (#3168) 2024-07-29 13:09:12 -04:00
cd9dc3e6a5 Move KCL tests into files (#3169) 2024-07-29 12:05:31 -05:00
4b424de5a6 Add a test for onboarding code reset confirmation and persistence (#3167)
* Add a test for onboarding code reset confirmation and persistence

* Don't use PW's `context` it doesn't have our teardown code
2024-07-29 12:50:01 -04:00
0f1b94f8b9 remove suss linter ext we dont use (#3150)
remove suss linter ext we dont use

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-07-29 15:41:02 +00:00
8879f488bb fix autocomplete for ints (#3166)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-07-29 08:16:18 +00:00
67d0fb76f6 make a space work parse in fn call, recast well (#3165)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-07-29 00:39:26 -07:00
fff3c58560 add a test for fn as operand (#3164)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-07-29 00:33:31 -07:00
8880df4fbb Bump @babel/preset-env from 7.24.7 to 7.25.0 (#3154)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.24.7 to 7.25.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.25.0/packages/babel-preset-env)

---
updated-dependencies:
- dependency-name: "@babel/preset-env"
  dependency-type: direct:development
  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-07-29 00:27:00 -07:00
d94017c5e3 fix source code ranges for function calls (#3163) 2024-07-28 23:49:28 -07:00
8fe91259fa add polar function (#3158)
* add polarCoords fn

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-07-28 22:45:40 -07:00
57d4204f47 Bump tokio from 1.38.1 to 1.39.2 in /src/wasm-lib (#3162)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.38.1 to 1.39.2.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.38.1...tokio-1.39.2)

---
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-07-28 22:06:55 -07:00
ee601f93bf Bump syn from 2.0.71 to 2.0.72 in /src/wasm-lib (#3161)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.71 to 2.0.72.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.71...2.0.72)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-28 22:03:27 -07:00
b0b48a2e9f Make codemirror tooltips selectable. (#3149)
Co-authored-by: Paul Tagliamonte <paul@zoo.dev>
Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
2024-07-28 21:34:58 -07:00
46f940ead5 Bump serde_json from 1.0.120 to 1.0.121 in /src/wasm-lib (#3160)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.120 to 1.0.121.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.120...v1.0.121)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-28 21:21:55 -07:00
014cedb2cc Bump clap from 4.5.9 to 4.5.11 in /src/wasm-lib (#3159)
Bumps [clap](https://github.com/clap-rs/clap) from 4.5.9 to 4.5.11.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.9...clap_complete-v4.5.11)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-28 21:21:18 -07:00
2375f900b9 fix errors for bad angles x/y constrained (#3152)
* fix errors for bad angles x/y constrained

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-07-28 20:36:18 -07:00
9fd4fd0dd8 Make onboarding code resets persist again, await confirmation to reset code (#3151) 2024-07-28 21:59:06 -04:00
ee5037bf35 fix arc error (#3148)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-07-28 23:09:54 +00:00
127 changed files with 2850 additions and 1887 deletions

View File

@ -124,7 +124,7 @@ const extrusion = extrude(5, sketch001)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -166,7 +166,7 @@ const extrusion = extrude(5, sketch001)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -180,7 +180,7 @@ const extrusion = extrude(5, sketch001)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -198,7 +198,7 @@ const extrusion = extrude(5, sketch001)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -128,7 +128,7 @@ const extrusion = extrude(5, sketch001)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -170,7 +170,7 @@ const extrusion = extrude(5, sketch001)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -184,7 +184,7 @@ const extrusion = extrude(5, sketch001)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -202,7 +202,7 @@ const extrusion = extrude(5, sketch001)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -33,7 +33,7 @@ const example = extrude(10, exampleSketch)
* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED)
```js
{
// The angle of the line.
// The angle of the line (in degrees).
angle: number,
// The length of the line.
length: number,
@ -43,7 +43,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -85,7 +85,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -99,7 +99,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -117,7 +117,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -455,7 +455,7 @@ const example = extrude(10, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -497,7 +497,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -511,7 +511,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -529,7 +529,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -32,7 +32,7 @@ const extrusion = extrude(10, sketch001)
* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED)
```js
{
// The angle of the line.
// The angle of the line (in degrees).
angle: number,
// The length of the line.
length: number,
@ -42,7 +42,7 @@ const extrusion = extrude(10, sketch001)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -84,7 +84,7 @@ const extrusion = extrude(10, sketch001)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -98,7 +98,7 @@ const extrusion = extrude(10, sketch001)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -116,7 +116,7 @@ const extrusion = extrude(10, sketch001)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -454,7 +454,7 @@ const extrusion = extrude(10, sketch001)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -496,7 +496,7 @@ const extrusion = extrude(10, sketch001)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -510,7 +510,7 @@ const extrusion = extrude(10, sketch001)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -528,7 +528,7 @@ const extrusion = extrude(10, sketch001)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -34,7 +34,7 @@ const example = extrude(10, exampleSketch)
* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED)
```js
{
// The angle of the line.
// The angle of the line (in degrees).
angle: number,
// The length of the line.
length: number,
@ -44,7 +44,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -86,7 +86,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -100,7 +100,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -118,7 +118,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -456,7 +456,7 @@ const example = extrude(10, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -498,7 +498,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -512,7 +512,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -530,7 +530,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -136,7 +136,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -178,7 +178,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -192,7 +192,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -210,7 +210,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -548,7 +548,7 @@ const example = extrude(10, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -590,7 +590,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -604,7 +604,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -622,7 +622,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -41,7 +41,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -83,7 +83,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -97,7 +97,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -115,7 +115,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -453,7 +453,7 @@ const example = extrude(10, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -495,7 +495,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -509,7 +509,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -527,7 +527,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -41,7 +41,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -83,7 +83,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -97,7 +97,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -115,7 +115,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -453,7 +453,7 @@ const example = extrude(10, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -495,7 +495,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -509,7 +509,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -527,7 +527,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -19,8 +19,8 @@ const exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([10, 0], %)
|> arc({
angle_start: 0,
angle_end: 280,
angleStart: 0,
angleEnd: 280,
radius: 16
}, %)
|> close(%)
@ -34,9 +34,9 @@ const exampleSketch = startSketchOn('XZ')
```js
{
// The end angle.
angle_end: number,
angleEnd: number,
// The start angle.
angle_start: number,
angleStart: number,
// The radius.
radius: number,
} |
@ -52,7 +52,7 @@ const exampleSketch = startSketchOn('XZ')
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -94,7 +94,7 @@ const exampleSketch = startSketchOn('XZ')
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -108,7 +108,7 @@ const exampleSketch = startSketchOn('XZ')
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -126,7 +126,7 @@ const exampleSketch = startSketchOn('XZ')
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -464,7 +464,7 @@ const exampleSketch = startSketchOn('XZ')
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -506,7 +506,7 @@ const exampleSketch = startSketchOn('XZ')
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -520,7 +520,7 @@ const exampleSketch = startSketchOn('XZ')
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -538,7 +538,7 @@ const exampleSketch = startSketchOn('XZ')
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -47,7 +47,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -89,7 +89,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -103,7 +103,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -121,7 +121,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -459,7 +459,7 @@ const example = extrude(10, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -501,7 +501,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -515,7 +515,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -533,7 +533,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -149,7 +149,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -163,7 +163,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -181,7 +181,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -223,7 +223,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -237,7 +237,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -549,7 +549,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -563,7 +563,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -581,7 +581,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -623,7 +623,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -637,7 +637,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,

View File

@ -82,7 +82,7 @@ const example = extrude(5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -96,7 +96,7 @@ const example = extrude(5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -114,7 +114,7 @@ const example = extrude(5, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -324,7 +324,7 @@ const example = extrude(5, exampleSketch)
},
} |
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -366,7 +366,7 @@ const example = extrude(5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -380,7 +380,7 @@ const example = extrude(5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -619,7 +619,7 @@ const example = extrude(5, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -661,7 +661,7 @@ const example = extrude(5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -675,7 +675,7 @@ const example = extrude(5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -693,7 +693,7 @@ const example = extrude(5, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -42,7 +42,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -84,7 +84,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -98,7 +98,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -116,7 +116,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -454,7 +454,7 @@ const example = extrude(10, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -496,7 +496,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -510,7 +510,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -528,7 +528,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -19,8 +19,8 @@ const example = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([10, 0], %)
|> arc({
angle_end: 0,
angle_start: 120,
angleStart: 120,
angleEnd: 0,
radius: 5
}, %)
|> line([5, 0], %)
@ -41,8 +41,8 @@ const example = startSketchOn('XZ')
const exampleSketch = startSketchOn('XZ')
|> startProfileAt([-10, 0], %)
|> arc({
angle_end: -60,
angle_start: 120,
angleStart: 120,
angleEnd: -60,
radius: 5
}, %)
|> line([10, 0], %)
@ -67,7 +67,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group_set`: `SketchGroupSet` - A sketch group or a group of sketch groups. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -109,7 +109,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -123,7 +123,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -141,7 +141,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -479,7 +479,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -493,7 +493,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -511,7 +511,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -553,7 +553,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -567,7 +567,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,

View File

@ -149,7 +149,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -163,7 +163,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -181,7 +181,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -223,7 +223,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -237,7 +237,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -549,7 +549,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -563,7 +563,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -581,7 +581,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -623,7 +623,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -637,7 +637,7 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,

View File

@ -19,10 +19,9 @@ const part001 = startSketchOn('XY')
|> circle([5, 5], 10, %)
|> extrude(10, %)
|> helix({
angle_start: 0,
angleStart: 0,
ccw: true,
revolutions: 16,
angle_start: 0
revolutions: 16
}, %)
```
@ -34,7 +33,7 @@ const part001 = startSketchOn('XY')
```js
{
// Start angle (in degrees).
angle_start: number,
angleStart: number,
// Is the helix rotation counter clockwise? The default is `false`.
ccw: string,
// Length of the helix. If this argument is not provided, the height of the extrude group is used.
@ -51,7 +50,7 @@ const part001 = startSketchOn('XY')
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -65,7 +64,7 @@ const part001 = startSketchOn('XY')
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -83,7 +82,7 @@ const part001 = startSketchOn('XY')
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -125,7 +124,7 @@ const part001 = startSketchOn('XY')
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -139,7 +138,7 @@ const part001 = startSketchOn('XY')
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -442,7 +441,7 @@ const part001 = startSketchOn('XY')
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -456,7 +455,7 @@ const part001 = startSketchOn('XY')
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -474,7 +473,7 @@ const part001 = startSketchOn('XY')
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -516,7 +515,7 @@ const part001 = startSketchOn('XY')
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -530,7 +529,7 @@ const part001 = startSketchOn('XY')
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,

View File

@ -53,7 +53,7 @@ const example = extrude(1, exampleSketch)
* `hole_sketch_group`: `SketchGroupSet` - A sketch group or a group of sketch groups. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -95,7 +95,7 @@ const example = extrude(1, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -109,7 +109,7 @@ const example = extrude(1, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -127,7 +127,7 @@ const example = extrude(1, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -457,7 +457,7 @@ const example = extrude(1, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -499,7 +499,7 @@ const example = extrude(1, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -513,7 +513,7 @@ const example = extrude(1, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -531,7 +531,7 @@ const example = extrude(1, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -860,7 +860,7 @@ const example = extrude(1, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -902,7 +902,7 @@ const example = extrude(1, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -916,7 +916,7 @@ const example = extrude(1, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -934,7 +934,7 @@ const example = extrude(1, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -62,6 +62,7 @@ layout: manual
* [`patternLinear3d`](kcl/patternLinear3d)
* [`patternTransform`](kcl/patternTransform)
* [`pi`](kcl/pi)
* [`polar`](kcl/polar)
* [`pow`](kcl/pow)
* [`profileStart`](kcl/profileStart)
* [`profileStartX`](kcl/profileStartX)

View File

@ -33,7 +33,7 @@ const example = extrude(5, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -75,7 +75,7 @@ const example = extrude(5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -89,7 +89,7 @@ const example = extrude(5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -107,7 +107,7 @@ const example = extrude(5, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -33,7 +33,7 @@ const example = extrude(5, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -75,7 +75,7 @@ const example = extrude(5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -89,7 +89,7 @@ const example = extrude(5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -107,7 +107,7 @@ const example = extrude(5, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -46,7 +46,7 @@ const example = extrude(5, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -88,7 +88,7 @@ const example = extrude(5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -102,7 +102,7 @@ const example = extrude(5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -120,7 +120,7 @@ const example = extrude(5, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -458,7 +458,7 @@ const example = extrude(5, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -500,7 +500,7 @@ const example = extrude(5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -514,7 +514,7 @@ const example = extrude(5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -532,7 +532,7 @@ const example = extrude(5, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -33,7 +33,7 @@ const example = extrude(5, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -75,7 +75,7 @@ const example = extrude(5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -89,7 +89,7 @@ const example = extrude(5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -107,7 +107,7 @@ const example = extrude(5, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -445,7 +445,7 @@ const example = extrude(5, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -487,7 +487,7 @@ const example = extrude(5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -501,7 +501,7 @@ const example = extrude(5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -519,7 +519,7 @@ const example = extrude(5, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -51,7 +51,7 @@ const example = extrude(1, exampleSketch)
* `sketch_group_set`: `SketchGroupSet` - A sketch group or a group of sketch groups. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -93,7 +93,7 @@ const example = extrude(1, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -107,7 +107,7 @@ const example = extrude(1, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -125,7 +125,7 @@ const example = extrude(1, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -55,7 +55,7 @@ const example = extrude(-5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -69,7 +69,7 @@ const example = extrude(-5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -87,7 +87,7 @@ const example = extrude(-5, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -129,7 +129,7 @@ const example = extrude(-5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -143,7 +143,7 @@ const example = extrude(-5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,

View File

@ -44,7 +44,7 @@ const example = extrude(1, exampleSketch)
* `sketch_group_set`: `SketchGroupSet` - A sketch group or a group of sketch groups. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -86,7 +86,7 @@ const example = extrude(1, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -100,7 +100,7 @@ const example = extrude(1, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -118,7 +118,7 @@ const example = extrude(1, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -53,7 +53,7 @@ const example = extrude(1, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -67,7 +67,7 @@ const example = extrude(1, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -85,7 +85,7 @@ const example = extrude(1, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -127,7 +127,7 @@ const example = extrude(1, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -141,7 +141,7 @@ const example = extrude(1, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,

View File

@ -55,7 +55,7 @@ let vase = layer()
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -69,7 +69,7 @@ let vase = layer()
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -87,7 +87,7 @@ let vase = layer()
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -129,7 +129,7 @@ let vase = layer()
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -143,7 +143,7 @@ let vase = layer()
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,

48
docs/kcl/polar.md Normal file

File diff suppressed because one or more lines are too long

View File

@ -34,7 +34,7 @@ const sketch001 = startSketchOn('XY')
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -76,7 +76,7 @@ const sketch001 = startSketchOn('XY')
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -90,7 +90,7 @@ const sketch001 = startSketchOn('XY')
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -108,7 +108,7 @@ const sketch001 = startSketchOn('XY')
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -29,7 +29,7 @@ const sketch001 = startSketchOn('XY')
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -71,7 +71,7 @@ const sketch001 = startSketchOn('XY')
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -85,7 +85,7 @@ const sketch001 = startSketchOn('XY')
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -103,7 +103,7 @@ const sketch001 = startSketchOn('XY')
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -28,7 +28,7 @@ const sketch001 = startSketchOn('XY')
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -70,7 +70,7 @@ const sketch001 = startSketchOn('XY')
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -84,7 +84,7 @@ const sketch001 = startSketchOn('XY')
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -102,7 +102,7 @@ const sketch001 = startSketchOn('XY')
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -250,7 +250,7 @@ uuid |
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -292,7 +292,7 @@ uuid |
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -306,7 +306,7 @@ uuid |
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -324,7 +324,7 @@ uuid |
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -658,7 +658,7 @@ uuid |
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -672,7 +672,7 @@ uuid |
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -690,7 +690,7 @@ uuid |
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -732,7 +732,7 @@ uuid |
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -746,7 +746,7 @@ uuid |
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,

View File

@ -137,7 +137,7 @@ shell({ faces: ['end'], thickness: 0.25 }, firstSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -151,7 +151,7 @@ shell({ faces: ['end'], thickness: 0.25 }, firstSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -169,7 +169,7 @@ shell({ faces: ['end'], thickness: 0.25 }, firstSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -211,7 +211,7 @@ shell({ faces: ['end'], thickness: 0.25 }, firstSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -225,7 +225,7 @@ shell({ faces: ['end'], thickness: 0.25 }, firstSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -528,7 +528,7 @@ shell({ faces: ['end'], thickness: 0.25 }, firstSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -542,7 +542,7 @@ shell({ faces: ['end'], thickness: 0.25 }, firstSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -560,7 +560,7 @@ shell({ faces: ['end'], thickness: 0.25 }, firstSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -602,7 +602,7 @@ shell({ faces: ['end'], thickness: 0.25 }, firstSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -616,7 +616,7 @@ shell({ faces: ['end'], thickness: 0.25 }, firstSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,

View File

@ -97,7 +97,7 @@ const example = extrude(5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -111,7 +111,7 @@ const example = extrude(5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -129,7 +129,7 @@ const example = extrude(5, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -411,7 +411,7 @@ const example = extrude(5, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -453,7 +453,7 @@ const example = extrude(5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -467,7 +467,7 @@ const example = extrude(5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -485,7 +485,7 @@ const example = extrude(5, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -59,7 +59,7 @@ const example = extrude(5, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -101,7 +101,7 @@ const example = extrude(5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -115,7 +115,7 @@ const example = extrude(5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -133,7 +133,7 @@ const example = extrude(5, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -106,9 +106,9 @@ const example002 = extrude(5, exampleSketch002)
const a1 = startSketchOn({
plane: {
origin: { x: 0, y: 0, z: 0 },
x_axis: { x: 1, y: 0, z: 0 },
y_axis: { x: 0, y: 1, z: 0 },
z_axis: { x: 0, y: 0, z: 1 }
xAxis: { x: 1, y: 0, z: 0 },
yAxis: { x: 0, y: 1, z: 0 },
zAxis: { x: 0, y: 0, z: 1 }
}
})
|> startProfileAt([0, 0], %)
@ -141,19 +141,19 @@ const a1 = startSketchOn({
z: number,
},
// What should the planes X axis be?
x_axis: {
xAxis: {
x: number,
y: number,
z: number,
},
// What should the planes Y axis be?
y_axis: {
yAxis: {
x: number,
y: number,
z: number,
},
// The z-axis (normal).
z_axis: {
zAxis: {
x: number,
y: number,
z: number,
@ -166,7 +166,7 @@ const a1 = startSketchOn({
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -180,7 +180,7 @@ const a1 = startSketchOn({
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -198,7 +198,7 @@ const a1 = startSketchOn({
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -578,7 +578,7 @@ const a1 = startSketchOn({
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -592,7 +592,7 @@ const a1 = startSketchOn({
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -610,7 +610,7 @@ const a1 = startSketchOn({
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -84,7 +84,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -98,7 +98,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -116,7 +116,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -454,7 +454,7 @@ const example = extrude(10, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -496,7 +496,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -510,7 +510,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -528,7 +528,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -33,7 +33,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -75,7 +75,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -89,7 +89,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -107,7 +107,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -445,7 +445,7 @@ const example = extrude(10, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -487,7 +487,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -501,7 +501,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -519,7 +519,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -36,7 +36,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -78,7 +78,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -92,7 +92,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -110,7 +110,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -448,7 +448,7 @@ const example = extrude(10, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -490,7 +490,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -504,7 +504,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -522,7 +522,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -36,7 +36,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -78,7 +78,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -92,7 +92,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -110,7 +110,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -448,7 +448,7 @@ const example = extrude(10, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -490,7 +490,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -504,7 +504,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -522,7 +522,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -34,7 +34,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -76,7 +76,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -90,7 +90,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -108,7 +108,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -446,7 +446,7 @@ const example = extrude(10, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -488,7 +488,7 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -502,7 +502,7 @@ const example = extrude(10, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -520,7 +520,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -32,7 +32,7 @@ const example = extrude(5, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -74,7 +74,7 @@ const example = extrude(5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -88,7 +88,7 @@ const example = extrude(5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -106,7 +106,7 @@ const example = extrude(5, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -444,7 +444,7 @@ const example = extrude(5, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -486,7 +486,7 @@ const example = extrude(5, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
@ -500,7 +500,7 @@ const example = extrude(5, exampleSketch)
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
edgeId: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -518,7 +518,7 @@ const example = extrude(5, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
// The id of the sketch group (this will change when the engine's reference to it changes.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,

View File

@ -925,10 +925,10 @@ test.describe('Editor tests', () => {
await expect(page.locator('.cm-lint-marker-error')).toBeVisible()
await expect(
page.locator('.cm-lintRange.cm-lintRange-error').first()
page.locator('.cm-lint-marker.cm-lint-marker-error')
).toBeVisible()
await page.locator('.cm-lintRange.cm-lintRange-error').hover()
await page.locator('.cm-lint-marker.cm-lint-marker-error').hover()
await expect(page.locator('.cm-diagnosticText').first()).toBeVisible()
await expect(
page.getByText('Cannot redefine `topAng`').first()
@ -1045,7 +1045,7 @@ test.describe('Editor tests', () => {
await page.hover('.cm-lint-marker-error')
const searchText =
'sketch profile must lie entirely on one side of the revolution axis'
await expect(page.getByText(searchText).first()).toBeVisible()
await expect(page.getByText(searchText)).toBeVisible()
})
test.describe('Autocomplete works', () => {
test('with enter/click to accept the completion', async ({ page }) => {
@ -2265,6 +2265,50 @@ test.describe('Onboarding tests', () => {
await expect(page.locator('.cm-content')).toContainText('// Shelf Bracket')
})
test('Code resets after confirmation', async ({ page }) => {
const initialCode = `const sketch001 = startSketchOn('XZ')`
// Load the page up with some code so we see the confirmation warning
// when we go to replay onboarding
await page.addInitScript((code) => {
localStorage.setItem('persistCode', code)
}, initialCode)
const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
// Replay the onboarding
await page.getByRole('link', { name: 'Settings' }).last().click()
const replayButton = page.getByRole('button', { name: 'Replay onboarding' })
await expect(replayButton).toBeVisible()
await replayButton.click()
// Ensure we see the warning, and that the code has not yet updated
await expect(
page.getByText('Replaying onboarding resets your code')
).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(initialCode)
const nextButton = page.getByTestId('onboarding-next')
await expect(nextButton).toBeVisible()
await nextButton.click()
// Ensure we see the introduction and that the code has been reset
await expect(page.getByText('Welcome to Modeling App!')).toBeVisible()
await expect(page.locator('.cm-content')).toContainText('// Shelf Bracket')
// Ensure we persisted the code to local storage.
// Playwright's addInitScript method unfortunately will reset
// this code if we try reloading the page as a test,
// so this is our best way to test persistence afaik.
expect(
await page.evaluate(() => {
return localStorage.getItem('persistCode')
})
).toContain('// Shelf Bracket')
})
test('Click through each onboarding step', async ({ page }) => {
const u = await getUtils(page)
@ -3975,16 +4019,19 @@ test.describe('Regression tests', () => {
)
})
await page.goto('/')
await u.waitForPageLoad()
// error in guter
await expect(page.locator('.cm-lint-marker-error')).toBeVisible()
await page.waitForTimeout(200)
// expect it still to be there (sometimes it just clears for a bit?)
await expect(page.locator('.cm-lint-marker-error')).toBeVisible({
timeout: 10_000,
})
await expect(async () => {
await page.goto('/')
await u.waitForPageLoad()
// error in guter
await expect(page.locator('.cm-lint-marker-error')).toBeVisible({
timeout: 1_000,
})
await page.waitForTimeout(200)
// expect it still to be there (sometimes it just clears for a bit?)
await expect(page.locator('.cm-lint-marker-error')).toBeVisible({
timeout: 1_000,
})
}).toPass({ timeout: 40_000, intervals: [1_000] })
// error text on hover
await page.hover('.cm-lint-marker-error')

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -109,7 +109,7 @@
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-env": "^7.24.3",
"@babel/preset-env": "^7.25.0",
"@iarna/toml": "^2.2.5",
"@lezer/generator": "^1.7.1",
"@playwright/test": "^1.45.1",

View File

@ -1,5 +1,10 @@
import { Extension } from '@codemirror/state'
import { hoverTooltip, tooltips, ViewPlugin } from '@codemirror/view'
import {
hoverTooltip,
tooltips,
ViewPlugin,
EditorView,
} from '@codemirror/view'
import { LanguageServerPlugin } from './lsp'
import { offsetToPos } from './util'
@ -17,6 +22,13 @@ export default function lspHoverExt(
}),
tooltips({
position: 'absolute',
parent: document.body,
}),
EditorView.baseTheme({
'.cm-tooltip': {
fontSize: '12px',
maxWidth: '400px',
},
}),
]
}

View File

@ -1,12 +0,0 @@
import { Extension } from '@codemirror/state'
import { linter, forEachDiagnostic, Diagnostic } from '@codemirror/lint'
export default function lspLintExt(): Extension {
return linter((view) => {
let diagnostics: Diagnostic[] = []
forEachDiagnostic(view.state, (d: Diagnostic, from: number, to: number) => {
diagnostics.push(d)
})
return diagnostics
})
}

View File

@ -17,8 +17,8 @@ import type {
PluginSpec,
ViewPlugin,
} from '@codemirror/view'
import { setDiagnosticsEffect } from '@codemirror/lint'
import { EditorView, Tooltip } from '@codemirror/view'
import { linter } from '@codemirror/lint'
import type { PublishDiagnosticsParams } from 'vscode-languageserver-protocol'
import type * as LSP from 'vscode-languageserver-protocol'
@ -36,7 +36,6 @@ import lspAutocompleteExt from './autocomplete'
import lspHoverExt from './hover'
import lspFormatExt from './format'
import lspIndentExt from './indent'
import lspLintExt from './lint'
import lspSemanticTokensExt from './semantic-tokens'
const useLast = (values: readonly any[]) => values.reduce((_, v) => v, '')
@ -216,20 +215,6 @@ export class LanguageServerPlugin implements PluginValue {
if (!this.client.ready) return
// TODO(paultag): This is the *wrong* place for this to live.
//
// We need to clear diagnostics before updating the code, because
// if the code shrinks, the errors/diagnostics can go out of range
// of the source code, which cause an exception, breaking all the
// things.
//
// We need some sort of clear diagnostics boolean on the editor
// and we can drop this.
this.view.dispatch({
effects: [setDiagnosticsEffect.of([])],
annotations: [],
})
try {
// Update the state (not the editor) with the new code.
this.client.textDocumentDidChange({
@ -587,8 +572,8 @@ export class LanguageServerPluginSpec
lspFormatExt(plugin),
lspHoverExt(plugin),
lspIndentExt(),
lspLintExt(),
lspSemanticTokensExt(),
linter(null),
]
}
}

168
src-tauri/Cargo.lock generated
View File

@ -188,7 +188,7 @@ dependencies = [
"tauri-plugin-shell",
"tauri-plugin-updater",
"tokio",
"toml 0.8.14",
"toml 0.8.16",
"url",
]
@ -332,7 +332,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -367,7 +367,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -407,7 +407,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -550,7 +550,7 @@ dependencies = [
"proc-macro-crate 3.1.0",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
"syn_derive",
]
@ -721,7 +721,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a969e13a7589e9e3e4207e153bae624ade2b5622fb4684a4923b23ec3d57719"
dependencies = [
"serde",
"toml 0.8.14",
"toml 0.8.16",
]
[[package]]
@ -792,9 +792,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.9"
version = "4.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462"
checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3"
dependencies = [
"clap_builder",
"clap_derive",
@ -802,9 +802,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.9"
version = "4.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942"
checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa"
dependencies = [
"anstream",
"anstyle",
@ -816,14 +816,14 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "4.5.8"
version = "4.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085"
checksum = "5d029b67f89d30bbb547c89fd5161293c0aec155fc691d7924b64550662db93e"
dependencies = [
"heck 0.5.0",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1073,7 +1073,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
dependencies = [
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1083,7 +1083,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f"
dependencies = [
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1107,7 +1107,7 @@ dependencies = [
"proc-macro2",
"quote",
"strsim 0.10.0",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1118,7 +1118,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f"
dependencies = [
"darling_core",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1179,7 +1179,7 @@ checksum = "4078275de501a61ceb9e759d37bdd3d7210e654dbc167ac1a3678ef4435ed57b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
"synstructure",
]
@ -1206,7 +1206,7 @@ dependencies = [
[[package]]
name = "derive-docs"
version = "0.1.20"
version = "0.1.21"
dependencies = [
"Inflector",
"convert_case 0.6.0",
@ -1216,7 +1216,7 @@ dependencies = [
"regex",
"serde",
"serde_tokenstream",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1227,7 +1227,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1288,7 +1288,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1320,7 +1320,7 @@ checksum = "f2b99bf03862d7f545ebc28ddd33a665b50865f4dfd84031a393823879bd4c54"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1383,7 +1383,7 @@ dependencies = [
"cc",
"memchr",
"rustc_version",
"toml 0.8.14",
"toml 0.8.16",
"vswhom",
"winreg 0.52.0",
]
@ -1427,7 +1427,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1588,7 +1588,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1704,7 +1704,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1980,7 +1980,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -2008,7 +2008,7 @@ dependencies = [
"inflections",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -2083,7 +2083,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -2571,7 +2571,7 @@ dependencies = [
[[package]]
name = "kcl-lib"
version = "0.2.0"
version = "0.2.2"
dependencies = [
"anyhow",
"approx",
@ -2581,6 +2581,7 @@ dependencies = [
"bson",
"chrono",
"clap",
"convert_case 0.6.0",
"dashmap 6.0.1",
"databake",
"derive-docs",
@ -2602,7 +2603,7 @@ dependencies = [
"thiserror",
"tokio",
"tokio-tungstenite",
"toml 0.8.14",
"toml 0.8.16",
"tower-lsp",
"ts-rs",
"url",
@ -2628,9 +2629,9 @@ dependencies = [
[[package]]
name = "kittycad"
version = "0.3.7"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1777b503442fa4666564cc3ab237d456df853a09648a4b2bb09622d25d021a5"
checksum = "36b87a9cca545825ba18005c1944b8525fac28867d99984178bf22c79fb5ec25"
dependencies = [
"anyhow",
"async-trait",
@ -3368,7 +3369,7 @@ dependencies = [
"regex",
"regex-syntax 0.8.3",
"structmeta",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -3487,7 +3488,7 @@ dependencies = [
"phf_shared 0.11.2",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -3555,7 +3556,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -4429,7 +4430,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde_derive_internals",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -4549,7 +4550,7 @@ checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -4560,17 +4561,18 @@ checksum = "330f01ce65a3a5fe59a60c82f3c9a024b573b8a6e875bd233fe5f934e71d54e3"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
name = "serde_json"
version = "1.0.120"
version = "1.0.121"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5"
checksum = "4ab380d7d9f22ef3f21ad3e6c1ebe8e4fc7a2000ccba2e4d71fc96f15b2cb609"
dependencies = [
"indexmap 2.2.6",
"itoa 1.0.11",
"memchr",
"ryu",
"serde",
]
@ -4593,14 +4595,14 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
name = "serde_spanned"
version = "0.6.6"
version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0"
checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d"
dependencies = [
"serde",
]
@ -4614,7 +4616,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -4656,7 +4658,7 @@ dependencies = [
"darling",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -4924,7 +4926,7 @@ dependencies = [
"proc-macro2",
"quote",
"structmeta-derive",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -4935,7 +4937,7 @@ checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -4957,7 +4959,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -4990,9 +4992,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.71"
version = "2.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462"
checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af"
dependencies = [
"proc-macro2",
"quote",
@ -5008,7 +5010,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -5025,7 +5027,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -5067,7 +5069,7 @@ dependencies = [
"cfg-expr",
"heck 0.5.0",
"pkg-config",
"toml 0.8.14",
"toml 0.8.16",
"version-compare",
]
@ -5220,7 +5222,7 @@ dependencies = [
"serde_json",
"tauri-utils",
"tauri-winres",
"toml 0.8.14",
"toml 0.8.16",
"walkdir",
]
@ -5242,7 +5244,7 @@ dependencies = [
"serde",
"serde_json",
"sha2",
"syn 2.0.71",
"syn 2.0.72",
"tauri-utils",
"thiserror",
"time",
@ -5260,7 +5262,7 @@ dependencies = [
"heck 0.5.0",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
"tauri-codegen",
"tauri-utils",
]
@ -5278,7 +5280,7 @@ dependencies = [
"serde",
"serde_json",
"tauri-utils",
"toml 0.8.14",
"toml 0.8.16",
"walkdir",
]
@ -5562,7 +5564,7 @@ dependencies = [
"serde_with",
"swift-rs",
"thiserror",
"toml 0.8.14",
"toml 0.8.16",
"url",
"urlpattern",
"walkdir",
@ -5618,22 +5620,22 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"
[[package]]
name = "thiserror"
version = "1.0.62"
version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2675633b1499176c2dff06b0856a27976a8f9d436737b4cf4f312d4d91d8bbb"
checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.62"
version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d20468752b09f49e909e55a5d338caa8bedf615594e9d80bc4c565d30faf798c"
checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -5730,7 +5732,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -5809,21 +5811,21 @@ dependencies = [
[[package]]
name = "toml"
version = "0.8.14"
version = "0.8.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335"
checksum = "81967dd0dd2c1ab0bc3468bd7caecc32b8a4aa47d0c8c695d8c2b2108168d62c"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit 0.22.14",
"toml_edit 0.22.17",
]
[[package]]
name = "toml_datetime"
version = "0.6.6"
version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf"
checksum = "f8fb9f64314842840f1d940ac544da178732128f1c78c21772e876579e0da1db"
dependencies = [
"serde",
]
@ -5865,9 +5867,9 @@ dependencies = [
[[package]]
name = "toml_edit"
version = "0.22.14"
version = "0.22.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38"
checksum = "8d9f8729f5aea9562aac1cc0441f5d6de3cff1ee0c5d67293eeca5eb36ee7c16"
dependencies = [
"indexmap 2.2.6",
"serde",
@ -5930,7 +5932,7 @@ checksum = "84fd902d4e0b9a4b27f2f440108dc034e1758628a9b702f8ec61ad66355422fa"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -5959,7 +5961,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -6089,7 +6091,7 @@ checksum = "c88cc88fd23b5a04528f3a8436024f20010a16ec18eb23c164b1242f65860130"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
"termcolor",
]
@ -6306,7 +6308,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -6405,7 +6407,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
"wasm-bindgen-shared",
]
@ -6439,7 +6441,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -6580,7 +6582,7 @@ checksum = "ac1345798ecd8122468840bcdf1b95e5dc6d2206c5e4b0eafa078d061f59c9bc"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -6686,7 +6688,7 @@ checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -6697,7 +6699,7 @@ checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -7149,7 +7151,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]

View File

@ -72,7 +72,6 @@ import { err, trap } from 'lib/trap'
import { useCommandsContext } from 'hooks/useCommandsContext'
import { modelingMachineEvent } from 'editor/manager'
import { hasValidFilletSelection } from 'lang/modifyAst/addFillet'
import { uuidv4 } from 'lib/utils'
type MachineContext<T extends AnyStateMachine> = {
state: StateFrom<T>

View File

@ -136,7 +136,6 @@ export function ModelingSidebar({ paneOpacity }: ModelingSidebarProps) {
iconClassName: action.iconClassName,
iconSize: 'md',
}}
paneIsOpen={false}
onClick={action.action}
/>
))}
@ -186,7 +185,7 @@ interface ModelingPaneButtonProps
iconSize?: 'sm' | 'md' | 'lg'
}
onClick: () => void
paneIsOpen: boolean
paneIsOpen?: boolean
}
function ModelingPaneButton({
@ -220,12 +219,20 @@ function ModelingPaneButton({
'rounded-sm ' + (paneIsOpen ? '!bg-primary' : '!bg-transparent')
}
/>
<span className="sr-only">{paneConfig.title} pane</span>
<Tooltip position="right" hoverOnly>
<span className="flex-1">{paneConfig.title} pane: </span>
<span className="hotkey text-xs capitalize">
{paneConfig.keybinding}
<span className="sr-only">
{paneConfig.title}
{paneIsOpen !== undefined ? ` pane` : ''}
</span>
<Tooltip
position="right"
contentClassName="max-w-none flex items-center gap-4"
hoverOnly
>
<span className="flex-1">
{paneConfig.title}
{paneIsOpen !== undefined ? ` pane` : ''}
</span>
<kbd className="hotkey text-xs capitalize">{paneConfig.keybinding}</kbd>
</Tooltip>
</button>
)

View File

@ -6,11 +6,7 @@ import { Selections, processCodeMirrorRanges, Selection } from 'lib/selections'
import { undo, redo } from '@codemirror/commands'
import { CommandBarMachineEvent } from 'machines/commandBarMachine'
import { addLineHighlight, addLineHighlightEvent } from './highlightextension'
import {
forEachDiagnostic,
Diagnostic,
setDiagnosticsEffect,
} from '@codemirror/lint'
import { Diagnostic, setDiagnosticsEffect } from '@codemirror/lint'
const updateOutsideEditorAnnotation = Annotation.define<boolean>()
export const updateOutsideEditorEvent = updateOutsideEditorAnnotation.of(true)
@ -114,12 +110,20 @@ export default class EditorManager {
}
}
clearDiagnostics(): void {
this.setDiagnostics([])
}
setDiagnostics(diagnostics: Diagnostic[]): void {
if (!this._editorView) return
// Clear out any existing diagnostics that are the same.
for (const diagnostic of diagnostics) {
for (const otherDiagnostic of diagnostics) {
if (diagnosticIsEqual(diagnostic, otherDiagnostic)) {
diagnostics = diagnostics.filter(
(d) => !diagnosticIsEqual(d, diagnostic)
)
diagnostics.push(diagnostic)
break
}
}
}
this._editorView.dispatch({
effects: [setDiagnosticsEffect.of(diagnostics)],
@ -131,26 +135,6 @@ export default class EditorManager {
})
}
addDiagnostics(diagnostics: Diagnostic[]): void {
if (!this._editorView) return
forEachDiagnostic(this._editorView.state, function (diag) {
diagnostics.push(diag)
})
const uniqueDiagnostics = new Set<Diagnostic>()
diagnostics.forEach((diagnostic) => {
for (const knownDiagnostic of uniqueDiagnostics.values()) {
if (diagnosticIsEqual(diagnostic, knownDiagnostic)) {
return
}
}
uniqueDiagnostics.add(diagnostic)
})
this.setDiagnostics([...uniqueDiagnostics])
}
undo() {
if (this._editorView) {
undo(this._editorView)

View File

@ -17,6 +17,7 @@ import {
} from 'lang/wasm'
import { getNodeFromPath } from './queryAst'
import { codeManager, editorManager, sceneInfra } from 'lib/singletons'
import { Diagnostic } from '@codemirror/lint'
export class KclManager {
private _ast: Program = {
@ -32,6 +33,7 @@ export class KclManager {
}
private _programMemory: ProgramMemory = ProgramMemory.empty()
private _logs: string[] = []
private _lints: Diagnostic[] = []
private _kclErrors: KCLError[] = []
private _isExecuting = false
private _wasmInitFailed = true
@ -72,16 +74,36 @@ export class KclManager {
this._logsCallBack(logs)
}
get lints() {
return this._lints
}
set lints(lints) {
if (lints === this._lints) return
this._lints = lints
// Run the lints through the diagnostics.
this.kclErrors = this._kclErrors
}
get kclErrors() {
return this._kclErrors
}
set kclErrors(kclErrors) {
if (kclErrors === this._kclErrors && this.lints.length === 0) return
this._kclErrors = kclErrors
let diagnostics = kclErrorsToDiagnostics(kclErrors)
editorManager.addDiagnostics(diagnostics)
if (this.lints.length > 0) {
diagnostics = diagnostics.concat(this.lints)
}
editorManager.setDiagnostics(diagnostics)
this._kclErrorsCallBack(kclErrors)
}
addKclErrors(kclErrors: KCLError[]) {
if (kclErrors.length === 0) return
this.kclErrors = this.kclErrors.concat(kclErrors)
}
get isExecuting() {
return this._isExecuting
}
@ -148,12 +170,12 @@ export class KclManager {
safeParse(code: string): Program | null {
const ast = parse(code)
this.lints = []
this.kclErrors = []
if (!err(ast)) return ast
const kclerror: KCLError = ast as KCLError
console.error('error parsing code', kclerror)
this.kclErrors = [kclerror]
this.addKclErrors([kclerror])
// TODO: re-eval if session should end?
if (kclerror.msg === 'file is empty')
this.engineCommandManager?.endSession()
@ -190,13 +212,15 @@ export class KclManager {
this._cancelTokens.set(currentExecutionId, false)
this.isExecuting = true
// Make sure we clear before starting again. End session will do this.
this.engineCommandManager?.endSession()
await this.ensureWasmInit()
const { logs, errors, programMemory } = await executeAst({
ast,
engineCommandManager: this.engineCommandManager,
})
editorManager.addDiagnostics(await lintAst({ ast: ast }))
this.lints = await lintAst({ ast: ast })
sceneInfra.modelingSend({ type: 'code edit during sketch' })
defaultSelectionFilter(programMemory, this.engineCommandManager)
@ -228,7 +252,7 @@ export class KclManager {
return
}
this.logs = logs
this.kclErrors = errors
this.addKclErrors(errors)
this.programMemory = programMemory
this.ast = { ...ast }
this._executeCallback()
@ -272,8 +296,6 @@ export class KclManager {
useFakeExecutor: true,
})
editorManager.addDiagnostics(await lintAst({ ast: ast }))
this._logs = logs
this._kclErrors = errors
this._programMemory = programMemory
@ -305,7 +327,6 @@ export class KclManager {
})
}
async executeCode(zoomToFit?: boolean): Promise<void> {
console.log('[kcl/KclSingleton] executeCode')
const ast = this.safeParse(codeManager.code)
if (!ast) {
this.clearAst()

View File

@ -869,6 +869,7 @@ export function hasSketchPipeBeenExtruded(selection: Selection, ast: Program) {
)
if (err(_varDec)) return false
const varDec = _varDec.node
if (varDec.type !== 'VariableDeclarator') return false
let extruded = false
traverse(ast as any, {
enter(node) {

View File

@ -211,7 +211,7 @@ describe('testing addTagForSketchOnFace', () => {
`
const code = genCode(originalLine)
const ast = parse(code)
const programMemory = await enginelessExecutor(ast)
await enginelessExecutor(ast)
const sourceStart = code.indexOf(originalLine)
const sourceRange: [number, number] = [
sourceStart,

View File

@ -290,10 +290,8 @@ export const toolbarConfig: Record<ToolbarModeName, ToolbarMode> = {
},
}),
icon: 'line',
status: 'available',
disabled: (state) =>
state.matches('Sketch no face') ||
state.matches('Sketch.Rectangle tool.Awaiting second corner'),
status: 'unavailable',
disabled: (state) => true,
title: 'Line',
hotkey: (state) =>
state.matches('Sketch.Line tool') ? ['Esc', 'L'] : 'L',

View File

@ -1,5 +1,11 @@
import { useModelingContext } from 'hooks/useModelingContext'
import { OnboardingButtons, useDemoCode, useDismiss, useNextClick } from '.'
import {
kbdClasses,
OnboardingButtons,
useDemoCode,
useDismiss,
useNextClick,
} from '.'
import { onboardingPaths } from 'routes/Onboarding/paths'
export default function OnboardingCodeEditor() {
@ -66,8 +72,8 @@ export default function OnboardingCodeEditor() {
</p>
<p className="my-4">
You can resize the pane by dragging the handle on the right, and you
can collapse it by clicking the title bar or pressing{' '}
<kbd>Shift</kbd> + <kbd>C</kbd>.
can collapse it by clicking the X button in the pane's title bar or
pressing <kbd className={kbdClasses}>Shift + C</kbd>.
</p>
</section>
<OnboardingButtons

View File

@ -19,8 +19,9 @@ export default function Export() {
<section className="flex-1">
<h2 className="text-2xl font-bold">Export</h2>
<p className="my-4">
Try opening the project menu and clicking the "Export Part" at the
bottom of the pane.
In addition to the "Export current part" button in the project menu,
you can also click the Export button icon at the bottom of the left
sidebar. Try clicking it now.
</p>
<p className="my-4">
{APP_NAME} uses{' '}

View File

@ -21,9 +21,10 @@ export default function FutureWork() {
<div className="max-w-full xl:max-w-2xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded">
<h1 className="text-2xl font-bold">Future Work</h1>
<p className="my-4">
We have curves, cuts, and many more CAD features coming soon. We want
your feedback on this user interface, and we want to know what
features you want to see next. Please message us in{' '}
We have curves, cuts, multi-profile sketch mode, and many more CAD
features coming soon. We want your feedback on this user interface,
and we want to know what features you want to see next. Please message
us in{' '}
<a
href="https://discord.gg/JQEpHR7Nt2"
target="_blank"

View File

@ -18,11 +18,45 @@ import {
PROJECT_ENTRYPOINT,
} from 'lib/constants'
import { createNewProjectDirectory, listProjects } from 'lib/tauri'
import { useState } from 'react'
function OnboardingWithNewFile() {
/**
* Show either a welcome screen or a warning screen
* depending on if the user has code in the editor.
*/
export default function OnboardingIntroduction() {
const [shouldShowWarning, setShouldShowWarning] = useState(
codeManager.code !== '' && codeManager.code !== bracket
)
return shouldShowWarning ? (
<OnboardingResetWarning setShouldShowWarning={setShouldShowWarning} />
) : (
<OnboardingIntroductionInner />
)
}
interface OnboardingResetWarningProps {
setShouldShowWarning: (arg: boolean) => void
}
function OnboardingResetWarning(props: OnboardingResetWarningProps) {
return (
<div className="fixed inset-0 z-50 grid place-content-center bg-chalkboard-110/50">
<div className="max-w-3xl p-8 rounded bg-chalkboard-10 dark:bg-chalkboard-90">
{!isTauri() ? (
<OnboardingWarningWeb {...props} />
) : (
<OnboardingWarningDesktop />
)}
</div>
</div>
)
}
function OnboardingWarningDesktop() {
const navigate = useNavigate()
const dismiss = useDismiss()
const next = useNextClick(onboardingPaths.INDEX)
async function createAndOpenNewProject() {
const projects = await listProjects()
@ -38,60 +72,69 @@ function OnboardingWithNewFile() {
)}${paths.ONBOARDING.INDEX}`
)
}
return (
<div className="fixed inset-0 z-50 grid place-content-center bg-chalkboard-110/50">
<div className="max-w-3xl p-8 rounded bg-chalkboard-10 dark:bg-chalkboard-90">
{!isTauri() ? (
<>
<h1 className="text-3xl font-bold text-warn-80 dark:text-warn-10">
Replaying onboarding resets your code
</h1>
<p className="my-4">
We see you have some of your own code written in this project.
Please save it somewhere else before continuing the onboarding.
</p>
<OnboardingButtons
className="mt-6"
dismiss={dismiss}
next={() => {
// We do want to update both the state and editor here.
codeManager.updateCodeEditor(bracket)
kclManager.executeCode(true)
next()
}}
nextText="Overwrite code and continue"
/>
</>
) : (
<>
<h1 className="flex flex-wrap items-center gap-4 text-3xl font-bold">
Would you like to create a new project?
</h1>
<section className="my-12">
<p className="my-4">
You have some content in this project that we don't want to
overwrite. If you would like to create a new project, please
click the button below.
</p>
</section>
<OnboardingButtons
className="mt-6"
dismiss={dismiss}
next={() => {
void createAndOpenNewProject()
codeManager.updateCodeEditor(bracket)
dismiss()
}}
nextText="Make a new project"
/>
</>
)}
</div>
</div>
<>
<h1 className="flex flex-wrap items-center gap-4 text-3xl font-bold">
Would you like to create a new project?
</h1>
<section className="my-12">
<p className="my-4">
You have some content in this project that we don't want to overwrite.
If you would like to create a new project, please click the button
below.
</p>
</section>
<OnboardingButtons
className="mt-6"
dismiss={dismiss}
next={() => {
void createAndOpenNewProject()
codeManager.updateCodeEditor(bracket)
dismiss()
}}
nextText="Make a new project"
/>
</>
)
}
export default function OnboardingIntroduction() {
function OnboardingWarningWeb(props: OnboardingResetWarningProps) {
const dismiss = useDismiss()
return (
<>
<h1 className="text-3xl font-bold text-warn-80 dark:text-warn-10">
Replaying onboarding resets your code
</h1>
<p className="my-4">
We see you have some of your own code written in this project. Please
save it somewhere else before continuing the onboarding.
</p>
<OnboardingButtons
className="mt-6"
dismiss={dismiss}
next={async () => {
// We do want to update both the state and editor here.
codeManager.updateCodeStateEditor(bracket)
await codeManager.writeToFile()
kclManager.isFirstRender = true
await kclManager.executeCode(true).then(() => {
kclManager.isFirstRender = false
})
props.setShouldShowWarning(false)
}}
nextText="Overwrite code and continue"
/>
</>
)
}
function OnboardingIntroductionInner() {
// Reset the code to the bracket code
useDemoCode()
const {
settings: {
state: {
@ -108,12 +151,8 @@ export default function OnboardingIntroduction() {
: ''
const dismiss = useDismiss()
const next = useNextClick(onboardingPaths.CAMERA)
const currentCode = codeManager.code
const isStarterCode = currentCode === '' || currentCode === bracket
useDemoCode()
return isStarterCode ? (
return (
<div className="fixed inset-0 z-50 grid place-content-center bg-chalkboard-110/50">
<div className="max-w-3xl p-8 rounded bg-chalkboard-10 dark:bg-chalkboard-90">
<h1 className="flex flex-wrap items-center gap-4 text-3xl font-bold">
@ -172,7 +211,5 @@ export default function OnboardingIntroduction() {
/>
</div>
</div>
) : (
<OnboardingWithNewFile />
)
}

View File

@ -20,8 +20,9 @@ export default function ProjectMenu() {
<section className="flex-1">
<h2 className="text-2xl font-bold">Project Menu</h2>
<p className="my-4">
Click on your part's name in the upper left to open the project
menu.
Click on {tauri ? `your part's name` : `the app name`} in the upper
left to open the project menu, where you can open the project
settings and export your current part.
{tauri && (
<> You can click the Zoo logo to quickly navigate home.</>
)}
@ -43,8 +44,8 @@ export default function ProjectMenu() {
) : (
<>
<p className="my-4">
From here you can export your part. You can't manage separate
files and separate projects from the browser; you have to{' '}
You can't manage separate files and separate projects from the
browser; you have to{' '}
<a
href="https://zoo.dev/modeling-app/download"
target="_blank"

View File

@ -10,12 +10,16 @@ export default function Sketching() {
const next = useNextClick(onboardingPaths.FUTURE_WORK)
useEffect(() => {
// We do want to update both the state and editor here.
codeManager.updateCodeEditor('')
if (kclManager.engineCommandManager.engineConnection?.isReady()) {
// If the engine is ready, promptly execute the loaded code
kclManager.executeCode(true)
async function clearEditor() {
// We do want to update both the state and editor here.
codeManager.updateCodeStateEditor('')
kclManager.isFirstRender = true
await kclManager.executeCode(true).then(() => {
kclManager.isFirstRender = false
})
}
clearEditor()
}, [])
return (

View File

@ -43,19 +43,13 @@ export default function UserMenu() {
<h2 className="text-2xl font-bold">User Menu</h2>
<p className="my-4">
Click {buttonDescription} in the upper right to open the user menu.
You can change your settings, sign out, or request a feature.
You can change your user-level settings, sign out, or request a
feature.
</p>
<p className="my-4">
We only support global settings at the moment, but we are working to
implement{' '}
<a
href="https://github.com/KittyCAD/modeling-app/issues/1503"
target="_blank"
rel="noreferrer noopener"
>
per-project settings
</a>{' '}
now.
Many settings can be set either a user or per-project level. User
settings will apply to all projects, while project settings will
only apply to the current project.
</p>
</section>
<OnboardingButtons

View File

@ -19,7 +19,7 @@ import { paths } from 'lib/paths'
import { useAbsoluteFilePath } from 'hooks/useAbsoluteFilePath'
import { ActionButton } from 'components/ActionButton'
import { onboardingPaths } from 'routes/Onboarding/paths'
import { codeManager, editorManager } from 'lib/singletons'
import { codeManager, editorManager, kclManager } from 'lib/singletons'
import { bracket } from 'lib/exampleKcl'
export const kbdClasses =
@ -80,8 +80,13 @@ export const onboardingRoutes = [
export function useDemoCode() {
useEffect(() => {
if (!editorManager.editorView) return
setTimeout(() => {
setTimeout(async () => {
codeManager.updateCodeStateEditor(bracket)
kclManager.isFirstRender = true
await kclManager.executeCode(true).then(() => {
kclManager.isFirstRender = false
})
await codeManager.writeToFile()
})
}, [editorManager.editorView])
}
@ -171,8 +176,8 @@ export function OnboardingButtons({
onClick={dismiss}
iconStart={{
icon: 'close',
className: 'text-chalkboard-10',
bgClassName: 'bg-destroy-80 group-hover:bg-destroy-80',
iconClassName: 'text-destroy-20 group-hover:text-destroy-10',
}}
className="hover:border-destroy-40 hover:bg-destroy-10/50 dark:hover:bg-destroy-80/50"
>

127
src/wasm-lib/Cargo.lock generated
View File

@ -169,7 +169,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -180,7 +180,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -191,7 +191,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -406,9 +406,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.9"
version = "4.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462"
checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3"
dependencies = [
"clap_builder",
"clap_derive",
@ -416,9 +416,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.9"
version = "4.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942"
checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa"
dependencies = [
"anstream",
"anstyle",
@ -430,14 +430,14 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "4.5.8"
version = "4.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085"
checksum = "5d029b67f89d30bbb547c89fd5161293c0aec155fc691d7924b64550662db93e"
dependencies = [
"heck 0.5.0",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -637,7 +637,7 @@ dependencies = [
"proc-macro2",
"quote",
"strsim 0.10.0",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -648,7 +648,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f"
dependencies = [
"darling_core",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -703,7 +703,7 @@ checksum = "4078275de501a61ceb9e759d37bdd3d7210e654dbc167ac1a3678ef4435ed57b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
"synstructure",
]
@ -718,7 +718,7 @@ dependencies = [
[[package]]
name = "derive-docs"
version = "0.1.20"
version = "0.1.21"
dependencies = [
"Inflector",
"anyhow",
@ -732,7 +732,7 @@ dependencies = [
"rustfmt-wrapper",
"serde",
"serde_tokenstream",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -743,7 +743,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -770,7 +770,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -942,7 +942,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1032,7 +1032,7 @@ dependencies = [
"inflections",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1391,7 +1391,7 @@ dependencies = [
[[package]]
name = "kcl-lib"
version = "0.2.1"
version = "0.2.3"
dependencies = [
"anyhow",
"approx",
@ -1455,12 +1455,12 @@ dependencies = [
"pretty_assertions",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
name = "kcl-test-server"
version = "0.1.3"
version = "0.1.4"
dependencies = [
"anyhow",
"hyper",
@ -1473,9 +1473,9 @@ dependencies = [
[[package]]
name = "kittycad"
version = "0.3.8"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d95daf74937915b31aa164ba7b34a5d1e0f6a82de748addd926b4dc6c2760c44"
checksum = "36b87a9cca545825ba18005c1944b8525fac28867d99984178bf22c79fb5ec25"
dependencies = [
"anyhow",
"async-trait",
@ -1636,13 +1636,14 @@ dependencies = [
[[package]]
name = "mio"
version = "0.8.11"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4"
dependencies = [
"hermit-abi",
"libc",
"wasi",
"windows-sys 0.48.0",
"windows-sys 0.52.0",
]
[[package]]
@ -1699,16 +1700,6 @@ dependencies = [
"autocfg",
]
[[package]]
name = "num_cpus"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
"hermit-abi",
"libc",
]
[[package]]
name = "object"
version = "0.32.2"
@ -1842,7 +1833,7 @@ dependencies = [
"regex",
"regex-syntax 0.8.3",
"structmeta",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -1895,7 +1886,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -2059,7 +2050,7 @@ dependencies = [
"proc-macro2",
"pyo3-macros-backend",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -2072,7 +2063,7 @@ dependencies = [
"proc-macro2",
"pyo3-build-config",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -2534,7 +2525,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde_derive_internals",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -2608,7 +2599,7 @@ checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -2619,17 +2610,18 @@ checksum = "330f01ce65a3a5fe59a60c82f3c9a024b573b8a6e875bd233fe5f934e71d54e3"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
name = "serde_json"
version = "1.0.120"
version = "1.0.121"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5"
checksum = "4ab380d7d9f22ef3f21ad3e6c1ebe8e4fc7a2000ccba2e4d71fc96f15b2cb609"
dependencies = [
"indexmap 2.2.5",
"itoa",
"memchr",
"ryu",
"serde",
]
@ -2642,7 +2634,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -2663,7 +2655,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -2800,7 +2792,7 @@ dependencies = [
"proc-macro2",
"quote",
"structmeta-derive",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -2811,7 +2803,7 @@ checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -2855,9 +2847,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.71"
version = "2.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462"
checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af"
dependencies = [
"proc-macro2",
"quote",
@ -2878,7 +2870,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -2985,7 +2977,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -3056,32 +3048,31 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.38.1"
version = "1.39.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb2caba9f80616f438e09748d5acda951967e1ea58508ef53d9c6402485a46df"
checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1"
dependencies = [
"backtrace",
"bytes",
"libc",
"mio",
"num_cpus",
"parking_lot 0.12.1",
"pin-project-lite",
"signal-hook-registry",
"socket2",
"tokio-macros",
"windows-sys 0.48.0",
"windows-sys 0.52.0",
]
[[package]]
name = "tokio-macros"
version = "2.3.0"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -3234,7 +3225,7 @@ checksum = "84fd902d4e0b9a4b27f2f440108dc034e1758628a9b702f8ec61ad66355422fa"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -3262,7 +3253,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -3339,7 +3330,7 @@ checksum = "c88cc88fd23b5a04528f3a8436024f20010a16ec18eb23c164b1242f65860130"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
"termcolor",
]
@ -3497,7 +3488,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]
@ -3558,7 +3549,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
"wasm-bindgen-shared",
]
@ -3593,7 +3584,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -3918,7 +3909,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.72",
]
[[package]]

View File

@ -11,12 +11,12 @@ crate-type = ["cdylib"]
[dependencies]
bson = { version = "2.11.0", features = ["uuid-1", "chrono"] }
clap = "4.5.9"
clap = "4.5.11"
gloo-utils = "0.2.0"
kcl-lib = { path = "kcl" }
kittycad.workspace = true
serde_json = "1.0.120"
tokio = { version = "1.38.1", features = ["sync"] }
serde_json = "1.0.121"
tokio = { version = "1.39.2", features = ["sync"] }
toml = "0.8.16"
uuid = { version = "1.10.0", features = ["v4", "js", "serde"] }
wasm-bindgen = "0.2.91"
@ -29,7 +29,7 @@ image = { version = "0.25.1", default-features = false, features = ["png"] }
kittycad = { workspace = true, default-features = true }
pretty_assertions = "1.4.0"
reqwest = { version = "0.11.26", default-features = false }
tokio = { version = "1.38.1", features = ["rt-multi-thread", "macros", "time"] }
tokio = { version = "1.39.2", features = ["rt-multi-thread", "macros", "time"] }
twenty-twenty = "0.8"
uuid = { version = "1.10.0", features = ["v4", "js", "serde"] }
@ -69,7 +69,7 @@ members = [
]
[workspace.dependencies]
kittycad = { version = "0.3.8", default-features = false, features = ["js", "requests"] }
kittycad = { version = "0.3.9", default-features = false, features = ["js", "requests"] }
kittycad-modeling-session = "0.1.4"
[[test]]

View File

@ -1,7 +1,7 @@
[package]
name = "derive-docs"
description = "A tool for generating documentation from Rust derive macros"
version = "0.1.20"
version = "0.1.21"
edition = "2021"
license = "MIT"
repository = "https://github.com/KittyCAD/modeling-app"
@ -20,7 +20,7 @@ quote = "1"
regex = "1.10"
serde = { version = "1.0.204", features = ["derive"] }
serde_tokenstream = "0.2"
syn = { version = "2.0.71", features = ["full"] }
syn = { version = "2.0.72", features = ["full"] }
[dev-dependencies]
anyhow = "1.0.86"

View File

@ -797,6 +797,12 @@ fn generate_code_block_test(fn_name: &str, code_block: &str, index: usize) -> pr
ctx.run(&program, None).await.unwrap();
// Ensure it lints.
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
// Zoom to fit.
ctx.engine
.send_modeling_cmd(

View File

@ -46,6 +46,11 @@ mod test_examples_someFn {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),

View File

@ -46,6 +46,11 @@ mod test_examples_someFn {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),

View File

@ -46,6 +46,11 @@ mod test_examples_show {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),
@ -136,6 +141,11 @@ mod test_examples_show {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),

View File

@ -46,6 +46,11 @@ mod test_examples_show {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),

View File

@ -48,6 +48,11 @@ mod test_examples_my_func {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),
@ -138,6 +143,11 @@ mod test_examples_my_func {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),

View File

@ -48,6 +48,11 @@ mod test_examples_line_to {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),
@ -138,6 +143,11 @@ mod test_examples_line_to {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),

View File

@ -46,6 +46,11 @@ mod test_examples_min {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),
@ -136,6 +141,11 @@ mod test_examples_min {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),

View File

@ -46,6 +46,11 @@ mod test_examples_show {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),

View File

@ -46,6 +46,11 @@ mod test_examples_import {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),

View File

@ -46,6 +46,11 @@ mod test_examples_import {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),

View File

@ -46,6 +46,11 @@ mod test_examples_import {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),

View File

@ -46,6 +46,11 @@ mod test_examples_show {
.await
.unwrap();
ctx.run(&program, None).await.unwrap();
let results = program.lint_all().unwrap();
if !results.is_empty() {
panic!("Linting failed: {:?}", results);
}
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),

View File

@ -15,7 +15,7 @@ databake = "0.1.8"
kcl-lib = { path = "../kcl" }
proc-macro2 = "1"
quote = "1"
syn = { version = "2.0.71", features = ["full"] }
syn = { version = "2.0.72", features = ["full"] }
[dev-dependencies]
pretty_assertions = "1.4.0"

View File

@ -1,7 +1,7 @@
[package]
name = "kcl-test-server"
description = "A test server for KCL"
version = "0.1.3"
version = "0.1.4"
edition = "2021"
license = "MIT"
@ -11,5 +11,5 @@ hyper = { version = "0.14.29", features = ["server"] }
kcl-lib = { version = "0.2", path = "../kcl" }
pico-args = "0.5.0"
serde = { version = "1.0.204", features = ["derive"] }
serde_json = "1.0.120"
tokio = { version = "1.38.1", features = ["macros", "rt-multi-thread"] }
serde_json = "1.0.121"
tokio = { version = "1.39.2", features = ["macros", "rt-multi-thread"] }

View File

@ -28,16 +28,26 @@ pub struct ServerArgs {
pub listen_on: SocketAddr,
/// How many connections to establish with the engine.
pub num_engine_conns: u8,
/// Where to find the engine.
/// If none, uses the prod engine.
/// This is useful for testing a local engine instance.
/// Overridden by the $LOCAL_ENGINE_ADDR environment variable.
pub engine_address: Option<String>,
}
impl ServerArgs {
pub fn parse(mut pargs: pico_args::Arguments) -> Result<Self, pico_args::Error> {
let args = ServerArgs {
let mut args = ServerArgs {
listen_on: pargs
.opt_value_from_str("--listen-on")?
.unwrap_or("0.0.0.0:3333".parse().unwrap()),
num_engine_conns: pargs.opt_value_from_str("--num-engine-conns")?.unwrap_or(1),
engine_address: pargs.opt_value_from_str("--engine-address")?,
};
if let Ok(addr) = std::env::var("LOCAL_ENGINE_ADDR") {
println!("Overriding engine address via $LOCAL_ENGINE_ADDR");
args.engine_address = Some(addr);
}
println!("Config is {args:?}");
Ok(args)
}
@ -54,12 +64,14 @@ struct WorkerReq {
/// Each worker has a connection to the engine, and accepts
/// KCL programs. When it receives one (over the mpsc channel)
/// it executes it and returns the result via a oneshot channel.
fn start_worker(i: u8) -> mpsc::Sender<WorkerReq> {
fn start_worker(i: u8, engine_addr: Option<String>) -> mpsc::Sender<WorkerReq> {
println!("Starting worker {i}");
// Make a work queue for this worker.
let (tx, mut rx) = mpsc::channel(1);
tokio::task::spawn(async move {
let state = ExecutorContext::new_for_unit_test(UnitLength::Mm).await.unwrap();
let state = ExecutorContext::new_for_unit_test(UnitLength::Mm, engine_addr)
.await
.unwrap();
println!("Worker {i} ready");
while let Some(req) = rx.recv().await {
let req: WorkerReq = req;
@ -82,8 +94,11 @@ pub async fn start_server(args: ServerArgs) -> anyhow::Result<()> {
let ServerArgs {
listen_on,
num_engine_conns,
engine_address,
} = args;
let workers: Vec<_> = (0..num_engine_conns).map(start_worker).collect();
let workers: Vec<_> = (0..num_engine_conns)
.map(|i| start_worker(i, engine_address.clone()))
.collect();
let state = Arc::new(ServerState {
workers,
req_num: 0.into(),
@ -151,7 +166,9 @@ async fn snapshot_endpoint(body: Bytes, state: ExecutorContext) -> Response<Body
Err(e) => return bad_request(format!("Parse error: {e}")),
};
eprintln!("Executing {test_name}");
if let Err(e) = state.reset_scene().await {
// This is a shitty source range, I don't know what else to use for it though.
// There's no actual KCL associated with this reset_scene call.
if let Err(e) = state.reset_scene(kcl_lib::executor::SourceRange::default()).await {
return kcl_err(e);
}
// Let users know if the test is taking a long time.

View File

@ -1,7 +1,7 @@
[package]
name = "kcl-lib"
description = "KittyCAD Language implementation and tools"
version = "0.2.1"
version = "0.2.3"
edition = "2021"
license = "MIT"
repository = "https://github.com/KittyCAD/modeling-app"
@ -16,10 +16,11 @@ async-recursion = "1.1.1"
async-trait = "0.1.81"
base64 = "0.22.1"
chrono = "0.4.38"
clap = { version = "4.5.9", default-features = false, optional = true }
clap = { version = "4.5.11", default-features = false, optional = true }
convert_case = "0.6.0"
dashmap = "6.0.1"
databake = { version = "0.1.8", features = ["derive"] }
derive-docs = { version = "0.1.20", path = "../derive-docs" }
derive-docs = { version = "0.1.21", path = "../derive-docs" }
form_urlencoded = "1.2.1"
futures = { version = "0.3.30" }
git_rev = "0.1.0"
@ -33,7 +34,7 @@ reqwest = { version = "0.11.26", default-features = false, features = ["stream",
ropey = "1.6.1"
schemars = { version = "0.8.17", features = ["impl_json_schema", "url", "uuid1"] }
serde = { version = "1.0.204", features = ["derive"] }
serde_json = "1.0.120"
serde_json = "1.0.121"
sha2 = "0.10.8"
tabled = { version = "0.15.0", optional = true }
thiserror = "1.0.63"
@ -47,7 +48,7 @@ zip = { version = "2.0.0", default-features = false }
[target.'cfg(target_arch = "wasm32")'.dependencies]
js-sys = { version = "0.3.69" }
tokio = { version = "1.38.1", features = ["sync", "time"] }
tokio = { version = "1.39.2", features = ["sync", "time"] }
tower-lsp = { version = "0.20.0", default-features = false, features = ["runtime-agnostic"] }
wasm-bindgen = "0.2.91"
wasm-bindgen-futures = "0.4.42"
@ -56,7 +57,7 @@ web-sys = { version = "0.3.69", features = ["console"] }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
approx = "0.5"
bson = { version = "2.11.0", features = ["uuid-1", "chrono"] }
tokio = { version = "1.38.0", features = ["full"] }
tokio = { version = "1.39.2", features = ["full"] }
tokio-tungstenite = { version = "0.23.1", features = ["rustls-tls-native-roots"] }
tower-lsp = { version = "0.20.0", features = ["proposed"] }
@ -82,7 +83,6 @@ debug = true # Flamegraphs of benchmarks require accurate debug symbols
[dev-dependencies]
base64 = "0.22.1"
convert_case = "0.6.0"
criterion = { version = "0.5.1", features = ["async_tokio"] }
expectorate = "1.1.0"
iai = "0.1"
@ -90,7 +90,7 @@ image = { version = "0.25.1", default-features = false, features = ["png"] }
insta = { version = "1.38.0", features = ["json"] }
itertools = "0.13.0"
pretty_assertions = "1.4.0"
tokio = { version = "1.38.1", features = ["rt-multi-thread", "macros", "time"] }
tokio = { version = "1.39.2", features = ["rt-multi-thread", "macros", "time"] }
twenty-twenty = "0.8.0"
[[bench]]

View File

@ -23,8 +23,8 @@ use crate::{
docs::StdLibFn,
errors::{KclError, KclErrorDetails},
executor::{
BodyType, ExecutorContext, MemoryItem, Metadata, PipeInfo, ProgramMemory, SourceRange, StatementKind,
TagEngineInfo, TagIdentifier, UserVal,
BodyType, DynamicState, ExecutorContext, MemoryItem, Metadata, PipeInfo, ProgramMemory, SourceRange,
StatementKind, TagEngineInfo, TagIdentifier, UserVal,
},
parser::PIPE_OPERATOR,
std::{kcl_stdlib::KclStdLibFn, FunctionKind},
@ -209,6 +209,7 @@ impl Program {
pub fn lint_all(&self) -> Result<Vec<crate::lint::Discovered>> {
let rules = vec![
crate::lint::checks::lint_variables,
crate::lint::checks::lint_object_properties,
crate::lint::checks::lint_call_expressions,
];
@ -917,6 +918,7 @@ impl BinaryPart {
pub async fn get_result(
&self,
memory: &mut ProgramMemory,
dynamic_state: &DynamicState,
pipe_info: &PipeInfo,
ctx: &ExecutorContext,
) -> Result<MemoryItem, KclError> {
@ -927,10 +929,16 @@ impl BinaryPart {
Ok(value.clone())
}
BinaryPart::BinaryExpression(binary_expression) => {
binary_expression.get_result(memory, pipe_info, ctx).await
binary_expression
.get_result(memory, dynamic_state, pipe_info, ctx)
.await
}
BinaryPart::CallExpression(call_expression) => {
call_expression.execute(memory, dynamic_state, pipe_info, ctx).await
}
BinaryPart::UnaryExpression(unary_expression) => {
unary_expression.get_result(memory, dynamic_state, pipe_info, ctx).await
}
BinaryPart::CallExpression(call_expression) => call_expression.execute(memory, pipe_info, ctx).await,
BinaryPart::UnaryExpression(unary_expression) => unary_expression.get_result(memory, pipe_info, ctx).await,
BinaryPart::MemberExpression(member_expression) => member_expression.get_result(memory),
}
}
@ -1310,6 +1318,7 @@ impl CallExpression {
pub async fn execute(
&self,
memory: &mut ProgramMemory,
dynamic_state: &DynamicState,
pipe_info: &PipeInfo,
ctx: &ExecutorContext,
) -> Result<MemoryItem, KclError> {
@ -1322,7 +1331,14 @@ impl CallExpression {
source_range: SourceRange([arg.start(), arg.end()]),
};
let result = ctx
.arg_into_mem_item(arg, memory, pipe_info, &metadata, StatementKind::Expression)
.arg_into_mem_item(
arg,
memory,
dynamic_state,
pipe_info,
&metadata,
StatementKind::Expression,
)
.await?;
fn_args.push(result);
}
@ -1330,7 +1346,8 @@ impl CallExpression {
match ctx.stdlib.get_either(&self.callee.name) {
FunctionKind::Core(func) => {
// Attempt to call the function.
let args = crate::std::Args::new(fn_args, self.into(), ctx.clone(), memory.clone());
let args =
crate::std::Args::new(fn_args, self.into(), ctx.clone(), memory.clone(), dynamic_state.clone());
let mut result = func.std_lib_fn()(args).await?;
// If the return result is a sketch group or extrude group, we want to update the
@ -1375,6 +1392,7 @@ impl CallExpression {
let mut info = info.clone();
info.surface = Some(value.clone());
info.sketch_group = extrude_group.id;
t.info = Some(info);
memory.update_tag(&tag.name, t.clone())?;
@ -1383,9 +1401,15 @@ impl CallExpression {
extrude_group.sketch_group.tags.insert(tag.name.clone(), t);
}
}
// Find the stale sketch group in memory and update it.
if let Some(current_env) = memory.environments.get_mut(memory.current_env.index()) {
current_env.update_sketch_group_tags(&extrude_group.sketch_group);
}
}
_ => {}
}
Ok(result)
}
FunctionKind::Std(func) => {
@ -1432,9 +1456,14 @@ impl CallExpression {
}
}
let mut fn_dynamic_state = dynamic_state.clone();
// Call the stdlib function
let p = func.function().clone().body;
let results = match ctx.inner_execute(&p, &mut fn_memory, BodyType::Block).await {
let results = match ctx
.inner_execute(&p, &mut fn_memory, &mut fn_dynamic_state, BodyType::Block)
.await
{
Ok(results) => results,
Err(err) => {
// We need to override the source ranges so we don't get the embedded kcl
@ -1455,10 +1484,14 @@ impl CallExpression {
}
FunctionKind::UserDefined => {
let func = memory.get(&fn_name, self.into())?;
let result = func.call_fn(fn_args, ctx.clone()).await.map_err(|e| {
// Add the call expression to the source ranges.
e.add_source_ranges(vec![self.into()])
})?;
let fn_dynamic_state = dynamic_state.merge(memory);
let result = func
.call_fn(fn_args, &fn_dynamic_state, ctx.clone())
.await
.map_err(|e| {
// Add the call expression to the source ranges.
e.add_source_ranges(vec![self.into()])
})?;
let result = result.ok_or_else(|| {
KclError::UndefinedValue(KclErrorDetails {
@ -2294,6 +2327,7 @@ impl ArrayExpression {
pub async fn execute(
&self,
memory: &mut ProgramMemory,
dynamic_state: &DynamicState,
pipe_info: &PipeInfo,
ctx: &ExecutorContext,
) -> Result<MemoryItem, KclError> {
@ -2309,13 +2343,29 @@ impl ArrayExpression {
value.clone()
}
Value::BinaryExpression(binary_expression) => {
binary_expression.get_result(memory, pipe_info, ctx).await?
binary_expression
.get_result(memory, dynamic_state, pipe_info, ctx)
.await?
}
Value::CallExpression(call_expression) => {
call_expression.execute(memory, dynamic_state, pipe_info, ctx).await?
}
Value::UnaryExpression(unary_expression) => {
unary_expression
.get_result(memory, dynamic_state, pipe_info, ctx)
.await?
}
Value::ObjectExpression(object_expression) => {
object_expression.execute(memory, dynamic_state, pipe_info, ctx).await?
}
Value::ArrayExpression(array_expression) => {
array_expression.execute(memory, dynamic_state, pipe_info, ctx).await?
}
Value::PipeExpression(pipe_expression) => {
pipe_expression
.get_result(memory, dynamic_state, pipe_info, ctx)
.await?
}
Value::CallExpression(call_expression) => call_expression.execute(memory, pipe_info, ctx).await?,
Value::UnaryExpression(unary_expression) => unary_expression.get_result(memory, pipe_info, ctx).await?,
Value::ObjectExpression(object_expression) => object_expression.execute(memory, pipe_info, ctx).await?,
Value::ArrayExpression(array_expression) => array_expression.execute(memory, pipe_info, ctx).await?,
Value::PipeExpression(pipe_expression) => pipe_expression.get_result(memory, pipe_info, ctx).await?,
Value::PipeSubstitution(pipe_substitution) => {
return Err(KclError::Semantic(KclErrorDetails {
message: format!("PipeSubstitution not implemented here: {:?}", pipe_substitution),
@ -2464,6 +2514,7 @@ impl ObjectExpression {
pub async fn execute(
&self,
memory: &mut ProgramMemory,
dynamic_state: &DynamicState,
pipe_info: &PipeInfo,
ctx: &ExecutorContext,
) -> Result<MemoryItem, KclError> {
@ -2478,13 +2529,29 @@ impl ObjectExpression {
value.clone()
}
Value::BinaryExpression(binary_expression) => {
binary_expression.get_result(memory, pipe_info, ctx).await?
binary_expression
.get_result(memory, dynamic_state, pipe_info, ctx)
.await?
}
Value::CallExpression(call_expression) => {
call_expression.execute(memory, dynamic_state, pipe_info, ctx).await?
}
Value::UnaryExpression(unary_expression) => {
unary_expression
.get_result(memory, dynamic_state, pipe_info, ctx)
.await?
}
Value::ObjectExpression(object_expression) => {
object_expression.execute(memory, dynamic_state, pipe_info, ctx).await?
}
Value::ArrayExpression(array_expression) => {
array_expression.execute(memory, dynamic_state, pipe_info, ctx).await?
}
Value::PipeExpression(pipe_expression) => {
pipe_expression
.get_result(memory, dynamic_state, pipe_info, ctx)
.await?
}
Value::CallExpression(call_expression) => call_expression.execute(memory, pipe_info, ctx).await?,
Value::UnaryExpression(unary_expression) => unary_expression.get_result(memory, pipe_info, ctx).await?,
Value::ObjectExpression(object_expression) => object_expression.execute(memory, pipe_info, ctx).await?,
Value::ArrayExpression(array_expression) => array_expression.execute(memory, pipe_info, ctx).await?,
Value::PipeExpression(pipe_expression) => pipe_expression.get_result(memory, pipe_info, ctx).await?,
Value::MemberExpression(member_expression) => member_expression.get_result(memory)?,
Value::PipeSubstitution(pipe_substitution) => {
return Err(KclError::Semantic(KclErrorDetails {
@ -2946,11 +3013,20 @@ impl BinaryExpression {
pub async fn get_result(
&self,
memory: &mut ProgramMemory,
dynamic_state: &DynamicState,
pipe_info: &PipeInfo,
ctx: &ExecutorContext,
) -> Result<MemoryItem, KclError> {
let left_json_value = self.left.get_result(memory, pipe_info, ctx).await?.get_json_value()?;
let right_json_value = self.right.get_result(memory, pipe_info, ctx).await?.get_json_value()?;
let left_json_value = self
.left
.get_result(memory, dynamic_state, pipe_info, ctx)
.await?
.get_json_value()?;
let right_json_value = self
.right
.get_result(memory, dynamic_state, pipe_info, ctx)
.await?
.get_json_value()?;
// First check if we are doing string concatenation.
if self.operator == BinaryOperator::Add {
@ -3155,13 +3231,14 @@ impl UnaryExpression {
pub async fn get_result(
&self,
memory: &mut ProgramMemory,
dynamic_state: &DynamicState,
pipe_info: &PipeInfo,
ctx: &ExecutorContext,
) -> Result<MemoryItem, KclError> {
let num = parse_json_number_as_f64(
&self
.argument
.get_result(memory, pipe_info, ctx)
.get_result(memory, dynamic_state, pipe_info, ctx)
.await?
.get_json_value()?,
self.into(),
@ -3332,10 +3409,11 @@ impl PipeExpression {
pub async fn get_result(
&self,
memory: &mut ProgramMemory,
dynamic_state: &DynamicState,
pipe_info: &PipeInfo,
ctx: &ExecutorContext,
) -> Result<MemoryItem, KclError> {
execute_pipe_body(memory, &self.body, pipe_info, self.into(), ctx).await
execute_pipe_body(memory, dynamic_state, &self.body, pipe_info, self.into(), ctx).await
}
/// Rename all identifiers that have the old name to the new given name.
@ -3349,6 +3427,7 @@ impl PipeExpression {
#[async_recursion::async_recursion]
async fn execute_pipe_body(
memory: &mut ProgramMemory,
dynamic_state: &DynamicState,
body: &[Value],
pipe_info: &PipeInfo,
source_range: SourceRange,
@ -3369,7 +3448,14 @@ async fn execute_pipe_body(
source_range: SourceRange([first.start(), first.end()]),
};
let output = ctx
.arg_into_mem_item(first, memory, pipe_info, &meta, StatementKind::Expression)
.arg_into_mem_item(
first,
memory,
dynamic_state,
pipe_info,
&meta,
StatementKind::Expression,
)
.await?;
// Now that we've evaluated the first child expression in the pipeline, following child expressions
// should use the previous child expression for %.
@ -3380,9 +3466,15 @@ async fn execute_pipe_body(
for expression in body {
let output = match expression {
Value::BinaryExpression(binary_expression) => {
binary_expression.get_result(memory, &new_pipe_info, ctx).await?
binary_expression
.get_result(memory, dynamic_state, &new_pipe_info, ctx)
.await?
}
Value::CallExpression(call_expression) => {
call_expression
.execute(memory, dynamic_state, &new_pipe_info, ctx)
.await?
}
Value::CallExpression(call_expression) => call_expression.execute(memory, &new_pipe_info, ctx).await?,
Value::Identifier(identifier) => memory.get(&identifier.name, identifier.into())?.clone(),
_ => {
// Return an error this should not happen.
@ -4246,6 +4338,30 @@ const myNestedVar = [callExp(bing.yo)]
assert_eq!(recasted, some_program_string);
}
#[test]
fn test_recast_space_in_fn_call() {
let some_program_string = r#"fn thing = (x) => {
return x + 1
}
thing ( 1 )
"#;
let tokens = crate::token::lexer(some_program_string).unwrap();
let parser = crate::parser::Parser::new(tokens);
let program = parser.ast().unwrap();
let recasted = program.recast(&Default::default(), 0);
assert_eq!(
recasted,
r#"fn thing = (x) => {
return x + 1
}
thing(1)
"#
);
}
#[test]
fn test_recast_object_fn_in_array_weird_bracket() {
let some_program_string = r#"const bing = { yo: 55 }

View File

@ -3,6 +3,7 @@
use std::path::Path;
use anyhow::Result;
use convert_case::Casing;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use tower_lsp::lsp_types::{
@ -56,7 +57,10 @@ pub struct StdLibFnArg {
impl StdLibFnArg {
#[allow(dead_code)]
pub fn get_type_string(&self) -> Result<(String, bool)> {
get_type_string_from_schema(&self.schema.clone())
match get_type_string_from_schema(&self.schema.clone()) {
Ok(r) => Ok(r),
Err(e) => anyhow::bail!("error getting type string for {}: {:#?}", self.type_, e),
}
}
pub fn get_autocomplete_string(&self) -> Result<String> {
@ -364,6 +368,13 @@ pub fn get_type_string_from_schema(schema: &schemars::schema::Schema) -> Result<
continue;
}
// Make sure none of the object properties are in snake case.
// We want the language to be consistent.
// This will fail in the docs generation and not at runtime.
if !prop_name.is_case(convert_case::Case::Camel) {
anyhow::bail!("expected camel case: {:#?}", prop_name);
}
if let Some(description) = get_description_string_from_schema(prop) {
fn_docs.push_str(&format!("\t// {}\n", description));
}
@ -489,13 +500,10 @@ pub fn get_autocomplete_snippet_from_schema(
if let Some(format) = &o.format {
if format == "uuid" {
return Ok(Some((index, format!(r#"${{{}:"tag_or_edge_fn"}}"#, index))));
} else if format == "double"
|| format == "uint"
|| format == "int64"
|| format == "uint32"
|| format == "uint64"
{
} else if format == "double" {
return Ok(Some((index, format!(r#"${{{}:3.14}}"#, index))));
} else if format == "uint" || format == "int64" || format == "uint32" || format == "uint64" {
return Ok(Some((index, format!(r#"${{{}:10}}"#, index))));
} else {
anyhow::bail!("unknown format: {}", format);
}
@ -872,6 +880,7 @@ mod tests {
#[test]
fn get_autocomplete_snippet_pattern_circular_3d() {
// We test this one specifically because it has ints and floats and strings.
let pattern_fn: Box<dyn StdLibFn> = Box::new(crate::std::patterns::PatternCircular3D);
let snippet = pattern_fn.to_autocomplete_snippet().unwrap();
assert_eq!(
@ -880,7 +889,7 @@ mod tests {
arcDegrees: ${0:3.14},
axis: [${1:3.14}, ${2:3.14}, ${3:3.14}],
center: [${2:3.14}, ${3:3.14}, ${4:3.14}],
repetitions: ${3:3.14},
repetitions: ${3:10},
rotateDuplicates: ${4:"string"},
}, ${5:%})${}"#
);

View File

@ -45,7 +45,7 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
) -> Result<DefaultPlanes, crate::errors::KclError>;
/// Helpers to be called after clearing a scene.
/// (These really only apply to wasm for now.
/// (These really only apply to wasm for now).
async fn clear_scene_post_hook(
&self,
source_range: crate::executor::SourceRange,

View File

@ -16,7 +16,7 @@ use crate::{
errors::{KclError, KclErrorDetails},
fs::FileManager,
settings::types::UnitLength,
std::{FnAsArg, FunctionKind, StdLib},
std::{FnAsArg, StdLib},
};
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
@ -193,6 +193,66 @@ impl Environment {
pub fn contains_key(&self, key: &str) -> bool {
self.bindings.contains_key(key)
}
pub fn update_sketch_group_tags(&mut self, sg: &SketchGroup) {
if sg.tags.is_empty() {
return;
}
for (_, val) in self.bindings.iter_mut() {
if let MemoryItem::SketchGroup(ref mut sketch_group) = val {
if sketch_group.original_id == sg.original_id {
for tag in sg.tags.iter() {
sketch_group.tags.insert(tag.0.clone(), tag.1.clone());
}
}
}
}
}
}
/// Dynamic state that depends on the dynamic flow of the program, like the call
/// stack. If the language had exceptions, for example, you could store the
/// stack of exception handlers here.
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, ts_rs::TS, JsonSchema)]
pub struct DynamicState {
pub extrude_group_ids: Vec<ExtrudeGroupLazyIds>,
}
impl DynamicState {
pub fn new() -> Self {
Self::default()
}
#[must_use]
pub fn merge(&self, memory: &ProgramMemory) -> Self {
let mut merged = self.clone();
merged.append(memory);
merged
}
pub fn append(&mut self, memory: &ProgramMemory) {
for env in &memory.environments {
for item in env.bindings.values() {
if let MemoryItem::ExtrudeGroup(eg) = item {
self.extrude_group_ids.push(ExtrudeGroupLazyIds::from(eg.as_ref()));
}
}
}
}
pub fn fillet_or_chamfer_ids_on_sketch_group(&self, sketch_group_id: uuid::Uuid) -> Vec<uuid::Uuid> {
self.extrude_group_ids
.iter()
.flat_map(|eg| {
if eg.sketch_group_id == sketch_group_id {
eg.fillet_or_chamfers.clone()
} else {
Vec::new()
}
})
.collect::<Vec<_>>()
}
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
@ -623,6 +683,7 @@ pub type MemoryFunction =
memory: ProgramMemory,
expression: Box<FunctionExpression>,
metadata: Vec<Metadata>,
dynamic_state: DynamicState,
ctx: ExecutorContext,
) -> std::pin::Pin<Box<dyn std::future::Future<Output = Result<Option<ProgramReturn>, KclError>> + Send>>;
@ -632,6 +693,7 @@ fn force_memory_function<
ProgramMemory,
Box<FunctionExpression>,
Vec<Metadata>,
DynamicState,
ExecutorContext,
) -> std::pin::Pin<Box<dyn std::future::Future<Output = Result<Option<ProgramReturn>, KclError>> + Send>>,
>(
@ -800,6 +862,7 @@ impl MemoryItem {
pub async fn call_fn(
&self,
args: Vec<MemoryItem>,
dynamic_state: &DynamicState,
ctx: ExecutorContext,
) -> Result<Option<ProgramReturn>, KclError> {
let MemoryItem::Function {
@ -825,6 +888,7 @@ impl MemoryItem {
closure_memory.as_ref().clone(),
expression.clone(),
meta.clone(),
dynamic_state.clone(),
ctx,
)
.await
@ -851,7 +915,7 @@ pub struct TagEngineInfo {
#[ts(export)]
#[serde(tag = "type", rename_all = "camelCase")]
pub struct SketchGroup {
/// The id of the sketch group.
/// The id of the sketch group (this will change when the engine's reference to it changes.
pub id: uuid::Uuid,
/// The paths in the sketch group.
pub value: Vec<Path>,
@ -862,6 +926,10 @@ pub struct SketchGroup {
/// Tag identifiers that have been declared in this sketch group.
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
pub tags: HashMap<String, TagIdentifier>,
/// The original id of the sketch group. This stays the same even if the sketch group is
/// is sketched on face etc.
#[serde(skip)]
pub original_id: uuid::Uuid,
/// Metadata.
#[serde(rename = "__meta")]
pub meta: Vec<Metadata>,
@ -997,6 +1065,27 @@ impl ExtrudeGroup {
}
}
/// An extrude group ID and its fillet and chamfer IDs. This is needed for lazy
/// fillet evaluation.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, ts_rs::TS, JsonSchema)]
pub struct ExtrudeGroupLazyIds {
pub extrude_group_id: uuid::Uuid,
pub sketch_group_id: uuid::Uuid,
/// Chamfers or fillets on this extrude group.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub fillet_or_chamfers: Vec<uuid::Uuid>,
}
impl From<&ExtrudeGroup> for ExtrudeGroupLazyIds {
fn from(eg: &ExtrudeGroup) -> Self {
Self {
extrude_group_id: eg.id,
sketch_group_id: eg.sketch_group.id,
fillet_or_chamfers: eg.fillet_or_chamfers.iter().map(|foc| foc.id()).collect(),
}
}
}
/// A fillet or a chamfer.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
#[ts(export)]
@ -1008,6 +1097,7 @@ pub enum FilletOrChamfer {
id: uuid::Uuid,
radius: f64,
/// The engine id of the edge to fillet.
#[serde(rename = "edgeId")]
edge_id: uuid::Uuid,
tag: Box<Option<TagDeclarator>>,
},
@ -1017,6 +1107,7 @@ pub enum FilletOrChamfer {
id: uuid::Uuid,
length: f64,
/// The engine id of the edge to chamfer.
#[serde(rename = "edgeId")]
edge_id: uuid::Uuid,
tag: Box<Option<TagDeclarator>>,
},
@ -1059,6 +1150,12 @@ pub enum BodyType {
#[ts(export)]
pub struct SourceRange(#[ts(type = "[number, number]")] pub [usize; 2]);
impl From<[usize; 2]> for SourceRange {
fn from(value: [usize; 2]) -> Self {
Self(value)
}
}
impl SourceRange {
/// Create a new source range.
pub fn new(start: usize, end: usize) -> Self {
@ -1544,8 +1641,8 @@ impl ExecutorContext {
/// For executing unit tests.
#[cfg(not(target_arch = "wasm32"))]
pub async fn new_for_unit_test(units: UnitLength) -> Result<Self> {
let user_agent = concat!(env!("CARGO_PKG_NAME"), ".rs/", env!("CARGO_PKG_VERSION"),);
pub async fn new_for_unit_test(units: UnitLength, engine_addr: Option<String>) -> Result<Self> {
let user_agent = concat!(env!("CARGO_PKG_NAME"), ".rs/", env!("CARGO_PKG_VERSION"));
let http_client = reqwest::Client::builder()
.user_agent(user_agent)
// For file conversions we need this to be long.
@ -1568,6 +1665,9 @@ impl ExecutorContext {
if let Ok(addr) = std::env::var("LOCAL_ENGINE_ADDR") {
client.set_base_url(addr);
}
if let Some(addr) = engine_addr {
client.set_base_url(addr);
}
let ctx = ExecutorContext::new(
&client,
@ -1582,15 +1682,8 @@ impl ExecutorContext {
Ok(ctx)
}
/// Clear everything in the scene.
pub async fn reset_scene(&self) -> Result<()> {
self.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),
SourceRange::default(),
kittycad::types::ModelingCmd::SceneClearAll {},
)
.await?;
pub async fn reset_scene(&self, source_range: crate::executor::SourceRange) -> Result<()> {
self.engine.clear_scene(source_range).await?;
Ok(())
}
@ -1617,8 +1710,14 @@ impl ExecutorContext {
} else {
Default::default()
};
self.inner_execute(program, &mut memory, crate::executor::BodyType::Root)
.await
let mut dynamic_state = DynamicState::default();
self.inner_execute(
program,
&mut memory,
&mut dynamic_state,
crate::executor::BodyType::Root,
)
.await
}
/// Execute an AST's program.
@ -1627,6 +1726,7 @@ impl ExecutorContext {
&self,
program: &crate::ast::types::Program,
memory: &mut ProgramMemory,
dynamic_state: &mut DynamicState,
body_type: BodyType,
) -> Result<ProgramMemory, KclError> {
let pipe_info = PipeInfo::default();
@ -1636,40 +1736,9 @@ impl ExecutorContext {
match statement {
BodyItem::ExpressionStatement(expression_statement) => {
if let Value::PipeExpression(pipe_expr) = &expression_statement.expression {
pipe_expr.get_result(memory, &pipe_info, self).await?;
pipe_expr.get_result(memory, dynamic_state, &pipe_info, self).await?;
} else if let Value::CallExpression(call_expr) = &expression_statement.expression {
let fn_name = call_expr.callee.name.to_string();
let mut args: Vec<MemoryItem> = Vec::new();
for arg in &call_expr.arguments {
let metadata = Metadata {
source_range: SourceRange([arg.start(), arg.end()]),
};
let mem_item = self
.arg_into_mem_item(arg, memory, &pipe_info, &metadata, StatementKind::Expression)
.await?;
args.push(mem_item);
}
match self.stdlib.get_either(&call_expr.callee.name) {
FunctionKind::Core(func) => {
let args = crate::std::Args::new(args, call_expr.into(), self.clone(), memory.clone());
let result = func.std_lib_fn()(args).await?;
memory.return_ = Some(ProgramReturn::Value(result));
}
FunctionKind::Std(func) => {
let mut newmem = memory.clone();
let result = self.inner_execute(func.program(), &mut newmem, BodyType::Block).await?;
memory.return_ = result.return_;
}
FunctionKind::UserDefined => {
// TODO: Why do we change the source range to
// the call expression instead of keeping the
// range of the callee?
let func = memory.get(&fn_name, call_expr.into())?;
let result = func.call_fn(args.clone(), self.clone()).await?;
memory.return_ = result;
}
}
call_expr.execute(memory, dynamic_state, &pipe_info, self).await?;
}
}
BodyItem::VariableDeclaration(variable_declaration) => {
@ -1682,6 +1751,7 @@ impl ExecutorContext {
.arg_into_mem_item(
&declaration.init,
memory,
dynamic_state,
&pipe_info,
&metadata,
StatementKind::Declaration { name: &var_name },
@ -1692,11 +1762,11 @@ impl ExecutorContext {
}
BodyItem::ReturnStatement(return_statement) => match &return_statement.argument {
Value::BinaryExpression(bin_expr) => {
let result = bin_expr.get_result(memory, &pipe_info, self).await?;
let result = bin_expr.get_result(memory, dynamic_state, &pipe_info, self).await?;
memory.return_ = Some(ProgramReturn::Value(result));
}
Value::UnaryExpression(unary_expr) => {
let result = unary_expr.get_result(memory, &pipe_info, self).await?;
let result = unary_expr.get_result(memory, dynamic_state, &pipe_info, self).await?;
memory.return_ = Some(ProgramReturn::Value(result));
}
Value::Identifier(identifier) => {
@ -1710,15 +1780,15 @@ impl ExecutorContext {
memory.return_ = Some(ProgramReturn::Value(tag.into()));
}
Value::ArrayExpression(array_expr) => {
let result = array_expr.execute(memory, &pipe_info, self).await?;
let result = array_expr.execute(memory, dynamic_state, &pipe_info, self).await?;
memory.return_ = Some(ProgramReturn::Value(result));
}
Value::ObjectExpression(obj_expr) => {
let result = obj_expr.execute(memory, &pipe_info, self).await?;
let result = obj_expr.execute(memory, dynamic_state, &pipe_info, self).await?;
memory.return_ = Some(ProgramReturn::Value(result));
}
Value::CallExpression(call_expr) => {
let result = call_expr.execute(memory, &pipe_info, self).await?;
let result = call_expr.execute(memory, dynamic_state, &pipe_info, self).await?;
memory.return_ = Some(ProgramReturn::Value(result));
}
Value::MemberExpression(member_expr) => {
@ -1726,7 +1796,7 @@ impl ExecutorContext {
memory.return_ = Some(ProgramReturn::Value(result));
}
Value::PipeExpression(pipe_expr) => {
let result = pipe_expr.get_result(memory, &pipe_info, self).await?;
let result = pipe_expr.get_result(memory, dynamic_state, &pipe_info, self).await?;
memory.return_ = Some(ProgramReturn::Value(result));
}
Value::PipeSubstitution(_) => {}
@ -1757,6 +1827,7 @@ impl ExecutorContext {
&self,
init: &Value,
memory: &mut ProgramMemory,
dynamic_state: &DynamicState,
pipe_info: &PipeInfo,
metadata: &Metadata,
statement_kind: StatementKind<'a>,
@ -1769,13 +1840,18 @@ impl ExecutorContext {
let value = memory.get(&identifier.name, identifier.into())?;
value.clone()
}
Value::BinaryExpression(binary_expression) => binary_expression.get_result(memory, pipe_info, self).await?,
Value::BinaryExpression(binary_expression) => {
binary_expression
.get_result(memory, dynamic_state, pipe_info, self)
.await?
}
Value::FunctionExpression(function_expression) => {
let mem_func = force_memory_function(
|args: Vec<MemoryItem>,
memory: ProgramMemory,
function_expression: Box<FunctionExpression>,
_metadata: Vec<Metadata>,
mut dynamic_state: DynamicState,
ctx: ExecutorContext| {
Box::pin(async move {
// Create a new environment to execute the function
@ -1789,7 +1865,12 @@ impl ExecutorContext {
let mut fn_memory = assign_args_to_params(&function_expression, args, body_memory)?;
let result = ctx
.inner_execute(&function_expression.body, &mut fn_memory, BodyType::Block)
.inner_execute(
&function_expression.body,
&mut fn_memory,
&mut dynamic_state,
BodyType::Block,
)
.await?;
Ok(result.return_)
@ -1806,8 +1887,14 @@ impl ExecutorContext {
memory: Box::new(memory.clone()),
}
}
Value::CallExpression(call_expression) => call_expression.execute(memory, pipe_info, self).await?,
Value::PipeExpression(pipe_expression) => pipe_expression.get_result(memory, pipe_info, self).await?,
Value::CallExpression(call_expression) => {
call_expression.execute(memory, dynamic_state, pipe_info, self).await?
}
Value::PipeExpression(pipe_expression) => {
pipe_expression
.get_result(memory, dynamic_state, pipe_info, self)
.await?
}
Value::PipeSubstitution(pipe_substitution) => match statement_kind {
StatementKind::Declaration { name } => {
let message = format!(
@ -1829,10 +1916,20 @@ impl ExecutorContext {
}
},
},
Value::ArrayExpression(array_expression) => array_expression.execute(memory, pipe_info, self).await?,
Value::ObjectExpression(object_expression) => object_expression.execute(memory, pipe_info, self).await?,
Value::ArrayExpression(array_expression) => {
array_expression.execute(memory, dynamic_state, pipe_info, self).await?
}
Value::ObjectExpression(object_expression) => {
object_expression
.execute(memory, dynamic_state, pipe_info, self)
.await?
}
Value::MemberExpression(member_expression) => member_expression.get_result(memory)?,
Value::UnaryExpression(unary_expression) => unary_expression.get_result(memory, pipe_info, self).await?,
Value::UnaryExpression(unary_expression) => {
unary_expression
.get_result(memory, dynamic_state, pipe_info, self)
.await?
}
};
Ok(item)
}
@ -2686,6 +2783,17 @@ const bracket = startSketchOn('XY')
parse_execute(ast).await.unwrap();
}
#[tokio::test(flavor = "multi_thread")]
async fn test_fn_as_operand() {
let ast = r#"fn f = () => { return 1 }
let x = f()
let y = x + 1
let z = f() + 1
let w = f() + f()
"#;
parse_execute(ast).await.unwrap();
}
#[test]
fn test_assign_args_to_params() {
// Set up a little framework for this test.

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