Compare commits
18 Commits
nrc-refact
...
mike/engin
Author | SHA1 | Date | |
---|---|---|---|
5bea90ad9a | |||
d23ddc19eb | |||
4bd7e02271 | |||
26042790b6 | |||
af74f3bb05 | |||
0bdedf5854 | |||
d2c6b5cf3a | |||
e65358f635 | |||
0a1201e680 | |||
9db013e672 | |||
0196d72a2d | |||
e6af4078bd | |||
2b233dc705 | |||
b11e8af9c7 | |||
c017847d7b | |||
9635eea8c1 | |||
5a2df642b1 | |||
621e41080e |
BIN
..env.development.local.swp
Normal file
BIN
..env.development.local.swp
Normal file
Binary file not shown.
@ -1,3 +1,4 @@
|
|||||||
src/wasm-lib/*
|
src/wasm-lib/*
|
||||||
|
src/lib/engine-utils/engine.js
|
||||||
*.typegen.ts
|
*.typegen.ts
|
||||||
packages/codemirror-lsp-client/dist/*
|
packages/codemirror-lsp-client/dist/*
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -66,3 +66,7 @@ venv
|
|||||||
|
|
||||||
# electron
|
# electron
|
||||||
out/
|
out/
|
||||||
|
|
||||||
|
# engine wasm utils
|
||||||
|
src/lib/engine-utils/engine.wasm
|
||||||
|
src/lib/engine-utils/engine.js
|
||||||
|
@ -9,7 +9,7 @@ Draw a line segment relative to the current origin using the polar
|
|||||||
measure of some angle and distance.
|
measure of some angle and distance.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLine(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sketch
|
angledLine(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ angledLine(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Create a line segment from the current 2-dimensional sketch origin
|
|||||||
along some angle (in degrees) for some relative length in the 'x' dimension.
|
along some angle (in degrees) for some relative length in the 'x' dimension.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sketch
|
angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sket
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Create a line segment from the current 2-dimensional sketch origin
|
|||||||
along some angle (in degrees) for some relative length in the 'y' dimension.
|
along some angle (in degrees) for some relative length in the 'y' dimension.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sketch
|
angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sket
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Draw an angled line from the current origin, constructing a line segment
|
|||||||
such that the newly created line intersects the desired target line segment.
|
such that the newly created line intersects the desired target line segment.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch: Sketch, tag?: TagNode) -> Sketch
|
angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch: Sketch, tag
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineThatIntersectsData`](/docs/kcl/types/AngledLineThatIntersectsData) | Data for drawing an angled line that intersects with a given line. | Yes |
|
| `data` | [`AngledLineThatIntersectsData`](/docs/kcl/types/AngledLineThatIntersectsData) | Data for drawing an angled line that intersects with a given line. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Create a line segment from the current 2-dimensional sketch origin
|
|||||||
along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension.
|
along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagNode) -> Sketch
|
angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagNode) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
|
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Create a line segment from the current 2-dimensional sketch origin
|
|||||||
along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension.
|
along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagNode) -> Sketch
|
angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagNode) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
|
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ The arc is constructed such that the current position of the sketch is placed al
|
|||||||
Unless this makes a lot of sense and feels like what you're looking for to construct your shape, you're likely looking for tangentialArc.
|
Unless this makes a lot of sense and feels like what you're looking for to construct your shape, you're likely looking for tangentialArc.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
arc(data: ArcData, sketch: Sketch, tag?: TagNode) -> Sketch
|
arc(data: ArcData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ arc(data: ArcData, sketch: Sketch, tag?: TagNode) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`ArcData`](/docs/kcl/types/ArcData) | Data to draw an arc. | Yes |
|
| `data` | [`ArcData`](/docs/kcl/types/ArcData) | Data to draw an arc. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Draw a smooth, continuous, curved line segment from the current origin to
|
|||||||
the desired (x, y), using a number of control points to shape the curve's shape.
|
the desired (x, y), using a number of control points to shape the curve's shape.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
bezierCurve(data: BezierData, sketch: Sketch, tag?: TagNode) -> Sketch
|
bezierCurve(data: BezierData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ bezierCurve(data: BezierData, sketch: Sketch, tag?: TagNode) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`BezierData`](/docs/kcl/types/BezierData) | Data to draw a bezier curve. | Yes |
|
| `data` | [`BezierData`](/docs/kcl/types/BezierData) | Data to draw a bezier curve. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Cut a straight transitional edge along a tagged path.
|
|||||||
Chamfer is similar in function and use to a fillet, except a fillet will blend the transition along an edge, rather than cut a sharp, straight transitional edge.
|
Chamfer is similar in function and use to a fillet, except a fillet will blend the transition along an edge, rather than cut a sharp, straight transitional edge.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
chamfer(data: ChamferData, solid: Solid, tag?: TagNode) -> Solid
|
chamfer(data: ChamferData, solid: Solid, tag?: TagDeclarator) -> Solid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ chamfer(data: ChamferData, solid: Solid, tag?: TagNode) -> Solid
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`ChamferData`](/docs/kcl/types/ChamferData) | Data for chamfers. | Yes |
|
| `data` | [`ChamferData`](/docs/kcl/types/ChamferData) | Data for chamfers. | Yes |
|
||||||
| `solid` | [`Solid`](/docs/kcl/types/Solid) | An solid is a collection of extrude surfaces. | Yes |
|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | An solid is a collection of extrude surfaces. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Construct a 2-dimensional circle, of the specified radius, centered at
|
|||||||
the provided (x, y) origin point.
|
the provided (x, y) origin point.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
circle(data: CircleData, sketch_surface_or_group: SketchOrSurface, tag?: TagNode) -> Sketch
|
circle(data: CircleData, sketch_surface_or_group: SketchOrSurface, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ circle(data: CircleData, sketch_surface_or_group: SketchOrSurface, tag?: TagNode
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`CircleData`](/docs/kcl/types/CircleData) | Data for drawing an circle | Yes |
|
| `data` | [`CircleData`](/docs/kcl/types/CircleData) | Data for drawing an circle | Yes |
|
||||||
| `sketch_surface_or_group` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
|
| `sketch_surface_or_group` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Construct a line segment from the current origin back to the profile's
|
|||||||
origin, ensuring the resulting 2-dimensional sketch is not open-ended.
|
origin, ensuring the resulting 2-dimensional sketch is not open-ended.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
close(sketch: Sketch, tag?: TagNode) -> Sketch
|
close(sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ close(sketch: Sketch, tag?: TagNode) -> Sketch
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Blend a transitional edge along a tagged path, smoothing the sharp edge.
|
|||||||
Fillet is similar in function and use to a chamfer, except a chamfer will cut a sharp transition along an edge while fillet will smoothly blend the transition.
|
Fillet is similar in function and use to a chamfer, except a chamfer will cut a sharp transition along an edge while fillet will smoothly blend the transition.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
fillet(data: FilletData, solid: Solid, tag?: TagNode) -> Solid
|
fillet(data: FilletData, solid: Solid, tag?: TagDeclarator) -> Solid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ fillet(data: FilletData, solid: Solid, tag?: TagNode) -> Solid
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`FilletData`](/docs/kcl/types/FilletData) | Data for fillets. | Yes |
|
| `data` | [`FilletData`](/docs/kcl/types/FilletData) | Data for fillets. | Yes |
|
||||||
| `solid` | [`Solid`](/docs/kcl/types/Solid) | An solid is a collection of extrude surfaces. | Yes |
|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | An solid is a collection of extrude surfaces. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Draw a line relative to the current origin to a specified (x, y) away
|
|||||||
from the current position.
|
from the current position.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
line(delta: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
line(delta: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ line(delta: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `delta` | `[number]` | | Yes |
|
| `delta` | `[number]` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Draw a line from the current origin to some absolute (x, y) point.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
lineTo(to: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
lineTo(to: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ lineTo(to: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `to` | `[number]` | | Yes |
|
| `to` | `[number]` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Start a new profile at a given point.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
startProfileAt(to: [number], sketch_surface: SketchSurface, tag?: TagNode) -> Sketch
|
startProfileAt(to: [number], sketch_surface: SketchSurface, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ startProfileAt(to: [number], sketch_surface: SketchSurface, tag?: TagNode) -> Sk
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `to` | `[number]` | | Yes |
|
| `to` | `[number]` | | Yes |
|
||||||
| `sketch_surface` | [`SketchSurface`](/docs/kcl/types/SketchSurface) | A sketch type. | Yes |
|
| `sketch_surface` | [`SketchSurface`](/docs/kcl/types/SketchSurface) | A sketch type. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
15819
docs/kcl/std.json
15819
docs/kcl/std.json
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@ Draw a curved line segment along part of an imaginary circle.
|
|||||||
The arc is constructed such that the last line segment is placed tangent to the imaginary circle of the specified radius. The resulting arc is the segment of the imaginary circle from that tangent point for 'offset' degrees along the imaginary circle.
|
The arc is constructed such that the last line segment is placed tangent to the imaginary circle of the specified radius. The resulting arc is the segment of the imaginary circle from that tangent point for 'offset' degrees along the imaginary circle.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
tangentialArc(data: TangentialArcData, sketch: Sketch, tag?: TagNode) -> Sketch
|
tangentialArc(data: TangentialArcData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ tangentialArc(data: TangentialArcData, sketch: Sketch, tag?: TagNode) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`TangentialArcData`](/docs/kcl/types/TangentialArcData) | Data to draw a tangential arc. | Yes |
|
| `data` | [`TangentialArcData`](/docs/kcl/types/TangentialArcData) | Data to draw a tangential arc. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Starting at the current sketch's origin, draw a curved line segment along
|
|||||||
some part of an imaginary circle until it reaches the desired (x, y) coordinates.
|
some part of an imaginary circle until it reaches the desired (x, y) coordinates.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
tangentialArcTo(to: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
tangentialArcTo(to: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ tangentialArcTo(to: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `to` | `[number]` | | Yes |
|
| `to` | `[number]` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Starting at the current sketch's origin, draw a curved line segment along
|
|||||||
some part of an imaginary circle until it reaches a point the given (x, y) distance away.
|
some part of an imaginary circle until it reaches a point the given (x, y) distance away.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
tangentialArcToRelative(delta: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
tangentialArcToRelative(delta: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ tangentialArcToRelative(delta: [number], sketch: Sketch, tag?: TagNode) -> Sketc
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `delta` | `[number]` | | Yes |
|
| `delta` | `[number]` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ A base path.
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,10 +22,12 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`Literal`](/docs/kcl/types/Literal)| | No |
|
| `type` |enum: `Literal`| | No |
|
||||||
| `kind` |[`Literal`](/docs/kcl/types/Literal)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `value` |[`LiteralValue`](/docs/kcl/types/LiteralValue)| | No |
|
||||||
|
| `raw` |`string`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -41,9 +43,10 @@ layout: manual
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||||
| `kind` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `name` |`string`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -58,10 +61,13 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`BinaryExpression`](/docs/kcl/types/BinaryExpression)| | No |
|
| `type` |enum: `BinaryExpression`| | No |
|
||||||
| `kind` |[`BinaryExpression`](/docs/kcl/types/BinaryExpression)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `operator` |[`BinaryOperator`](/docs/kcl/types/BinaryOperator)| | No |
|
||||||
|
| `left` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| | No |
|
||||||
|
| `right` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -76,10 +82,13 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`CallExpression`](/docs/kcl/types/CallExpression)| | No |
|
| `type` |enum: `CallExpression`| | No |
|
||||||
| `kind` |[`CallExpression`](/docs/kcl/types/CallExpression)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `callee` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||||
|
| `arguments` |`[` [`Expr`](/docs/kcl/types/Expr) `]`| | No |
|
||||||
|
| `optional` |`boolean`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -94,10 +103,12 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`UnaryExpression`](/docs/kcl/types/UnaryExpression)| | No |
|
| `type` |enum: `UnaryExpression`| | No |
|
||||||
| `kind` |[`UnaryExpression`](/docs/kcl/types/UnaryExpression)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `operator` |[`UnaryOperator`](/docs/kcl/types/UnaryOperator)| | No |
|
||||||
|
| `argument` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -112,10 +123,13 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`MemberExpression`](/docs/kcl/types/MemberExpression)| | No |
|
| `type` |enum: `MemberExpression`| | No |
|
||||||
| `kind` |[`MemberExpression`](/docs/kcl/types/MemberExpression)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `object` |[`MemberObject`](/docs/kcl/types/MemberObject)| | No |
|
||||||
|
| `property` |[`LiteralIdentifier`](/docs/kcl/types/LiteralIdentifier)| | No |
|
||||||
|
| `computed` |`boolean`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -130,10 +144,14 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`IfExpression`](/docs/kcl/types/IfExpression)| | No |
|
| `type` |enum: `IfExpression`| | No |
|
||||||
| `kind` |[`IfExpression`](/docs/kcl/types/IfExpression)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `cond` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||||
|
| `then_val` |[`Program`](/docs/kcl/types/Program)| | No |
|
||||||
|
| `else_ifs` |`[` [`ElseIf`](/docs/kcl/types/ElseIf) `]`| | No |
|
||||||
|
| `final_else` |[`Program`](/docs/kcl/types/Program)| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
@ -22,10 +22,13 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`ImportStatement`](/docs/kcl/types/ImportStatement)| | No |
|
| `type` |enum: `ImportStatement`| | No |
|
||||||
| `kind` |[`ImportStatement`](/docs/kcl/types/ImportStatement)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `items` |`[` [`ImportItem`](/docs/kcl/types/ImportItem) `]`| | No |
|
||||||
|
| `path` |`string`| | No |
|
||||||
|
| `raw_path` |`string`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -40,10 +43,11 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`ExpressionStatement`](/docs/kcl/types/ExpressionStatement)| | No |
|
| `type` |enum: `ExpressionStatement`| | No |
|
||||||
| `kind` |[`ExpressionStatement`](/docs/kcl/types/ExpressionStatement)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `expression` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -58,10 +62,13 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`VariableDeclaration`](/docs/kcl/types/VariableDeclaration)| | No |
|
| `type` |enum: `VariableDeclaration`| | No |
|
||||||
| `kind` |[`VariableDeclaration`](/docs/kcl/types/VariableDeclaration)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `declarations` |`[` [`VariableDeclarator`](/docs/kcl/types/VariableDeclarator) `]`| | No |
|
||||||
|
| `visibility` |[`ItemVisibility`](/docs/kcl/types/ItemVisibility)| | No |
|
||||||
|
| `kind` |[`VariableKind`](/docs/kcl/types/VariableKind)| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -76,10 +83,11 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`ReturnStatement`](/docs/kcl/types/ReturnStatement)| | No |
|
| `type` |enum: `ReturnStatement`| | No |
|
||||||
| `kind` |[`ReturnStatement`](/docs/kcl/types/ReturnStatement)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `argument` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
@ -28,7 +28,7 @@ A fillet.
|
|||||||
| `id` |`string`| The id of the engine command that called this fillet. | No |
|
| `id` |`string`| The id of the engine command that called this fillet. | No |
|
||||||
| `radius` |`number`| | No |
|
| `radius` |`number`| | No |
|
||||||
| `edgeId` |`string`| The engine id of the edge to fillet. | No |
|
| `edgeId` |`string`| The engine id of the edge to fillet. | No |
|
||||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| | No |
|
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -48,7 +48,7 @@ A chamfer.
|
|||||||
| `id` |`string`| The id of the engine command that called this chamfer. | No |
|
| `id` |`string`| The id of the engine command that called this chamfer. | No |
|
||||||
| `length` |`number`| | No |
|
| `length` |`number`| | No |
|
||||||
| `edgeId` |`string`| The engine id of the edge to chamfer. | No |
|
| `edgeId` |`string`| The engine id of the edge to chamfer. | No |
|
||||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| | No |
|
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
@ -15,8 +15,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `cond` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
| `cond` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||||
| `then_val` |[`UnboxedNode_for_Program`](/docs/kcl/types/UnboxedNode_for_Program)| | No |
|
| `then_val` |[`Program`](/docs/kcl/types/Program)| | No |
|
||||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,10 +23,12 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`Literal`](/docs/kcl/types/Literal)| | No |
|
| `type` |enum: `Literal`| | No |
|
||||||
| `kind` |[`Literal`](/docs/kcl/types/Literal)| An expression can be evaluated to yield a single KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `value` |[`LiteralValue`](/docs/kcl/types/LiteralValue)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `raw` |`string`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -42,9 +44,10 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||||
| `kind` |[`Identifier`](/docs/kcl/types/Identifier)| An expression can be evaluated to yield a single KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `name` |`string`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -60,9 +63,10 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
| `type` |enum: [`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
||||||
| `kind` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| An expression can be evaluated to yield a single KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `value` |`string`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -77,10 +81,13 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`BinaryExpression`](/docs/kcl/types/BinaryExpression)| | No |
|
| `type` |enum: `BinaryExpression`| | No |
|
||||||
| `kind` |[`BinaryExpression`](/docs/kcl/types/BinaryExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `operator` |[`BinaryOperator`](/docs/kcl/types/BinaryOperator)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `left` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `right` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -96,9 +103,11 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`FunctionExpression`](/docs/kcl/types/FunctionExpression)| | No |
|
| `type` |enum: [`FunctionExpression`](/docs/kcl/types/FunctionExpression)| | No |
|
||||||
| `kind` |[`FunctionExpression`](/docs/kcl/types/FunctionExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `params` |`[` [`Parameter`](/docs/kcl/types/Parameter) `]`| | No |
|
||||||
|
| `body` |[`Program`](/docs/kcl/types/Program)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -113,10 +122,13 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`CallExpression`](/docs/kcl/types/CallExpression)| | No |
|
| `type` |enum: `CallExpression`| | No |
|
||||||
| `kind` |[`CallExpression`](/docs/kcl/types/CallExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `callee` |[`Identifier`](/docs/kcl/types/Identifier)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `arguments` |`[` [`Expr`](/docs/kcl/types/Expr) `]`| | No |
|
||||||
|
| `optional` |`boolean`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -131,10 +143,12 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`PipeExpression`](/docs/kcl/types/PipeExpression)| | No |
|
| `type` |enum: `PipeExpression`| | No |
|
||||||
| `kind` |[`PipeExpression`](/docs/kcl/types/PipeExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `body` |`[` [`Expr`](/docs/kcl/types/Expr) `]`| | No |
|
||||||
|
| `nonCodeMeta` |[`NonCodeMeta`](/docs/kcl/types/NonCodeMeta)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -149,10 +163,10 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`PipeSubstitution`](/docs/kcl/types/PipeSubstitution)| | No |
|
| `type` |enum: `PipeSubstitution`| | No |
|
||||||
| `kind` |[`PipeSubstitution`](/docs/kcl/types/PipeSubstitution)| An expression can be evaluated to yield a single KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -167,10 +181,12 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`ArrayExpression`](/docs/kcl/types/ArrayExpression)| | No |
|
| `type` |enum: `ArrayExpression`| | No |
|
||||||
| `kind` |[`ArrayExpression`](/docs/kcl/types/ArrayExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `elements` |`[` [`Expr`](/docs/kcl/types/Expr) `]`| | No |
|
||||||
|
| `nonCodeMeta` |[`NonCodeMeta`](/docs/kcl/types/NonCodeMeta)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -185,10 +201,13 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`ArrayRangeExpression`](/docs/kcl/types/ArrayRangeExpression)| | No |
|
| `type` |enum: `ArrayRangeExpression`| | No |
|
||||||
| `kind` |[`ArrayRangeExpression`](/docs/kcl/types/ArrayRangeExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `startElement` |[`Expr`](/docs/kcl/types/Expr)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `endElement` |[`Expr`](/docs/kcl/types/Expr)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `endInclusive` |`boolean`| Is the `end_element` included in the range? | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -203,10 +222,12 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`ObjectExpression`](/docs/kcl/types/ObjectExpression)| | No |
|
| `type` |enum: `ObjectExpression`| | No |
|
||||||
| `kind` |[`ObjectExpression`](/docs/kcl/types/ObjectExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `properties` |`[` [`ObjectProperty`](/docs/kcl/types/ObjectProperty) `]`| | No |
|
||||||
|
| `nonCodeMeta` |[`NonCodeMeta`](/docs/kcl/types/NonCodeMeta)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -221,10 +242,13 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`MemberExpression`](/docs/kcl/types/MemberExpression)| | No |
|
| `type` |enum: `MemberExpression`| | No |
|
||||||
| `kind` |[`MemberExpression`](/docs/kcl/types/MemberExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `object` |[`MemberObject`](/docs/kcl/types/MemberObject)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `property` |[`LiteralIdentifier`](/docs/kcl/types/LiteralIdentifier)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `computed` |`boolean`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -239,10 +263,12 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`UnaryExpression`](/docs/kcl/types/UnaryExpression)| | No |
|
| `type` |enum: `UnaryExpression`| | No |
|
||||||
| `kind` |[`UnaryExpression`](/docs/kcl/types/UnaryExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `operator` |[`UnaryOperator`](/docs/kcl/types/UnaryOperator)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `argument` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -257,10 +283,14 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`IfExpression`](/docs/kcl/types/IfExpression)| | No |
|
| `type` |enum: `IfExpression`| | No |
|
||||||
| `kind` |[`IfExpression`](/docs/kcl/types/IfExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `cond` |[`Expr`](/docs/kcl/types/Expr)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `then_val` |[`Program`](/docs/kcl/types/Program)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `else_ifs` |`[` [`ElseIf`](/docs/kcl/types/ElseIf) `]`| | No |
|
||||||
|
| `final_else` |[`Program`](/docs/kcl/types/Program)| An expression can be evaluated to yield a single KCL value. | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
@ -26,7 +26,7 @@ An extrude plane.
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `extrudePlane`| | No |
|
| `type` |enum: `extrudePlane`| | No |
|
||||||
| `faceId` |`string`| The face id for the extrude plane. | No |
|
| `faceId` |`string`| The face id for the extrude plane. | No |
|
||||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag. | No |
|
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||||
| `id` |`string`| The id of the geometry. | No |
|
| `id` |`string`| The id of the geometry. | No |
|
||||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ An extruded arc.
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `extrudeArc`| | No |
|
| `type` |enum: `extrudeArc`| | No |
|
||||||
| `faceId` |`string`| The face id for the extrude plane. | No |
|
| `faceId` |`string`| The face id for the extrude plane. | No |
|
||||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag. | No |
|
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||||
| `id` |`string`| The id of the geometry. | No |
|
| `id` |`string`| The id of the geometry. | No |
|
||||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ Geometry metadata.
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `chamfer`| | No |
|
| `type` |enum: `chamfer`| | No |
|
||||||
| `faceId` |`string`| The id for the chamfer surface. | No |
|
| `faceId` |`string`| The id for the chamfer surface. | No |
|
||||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag. | No |
|
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||||
| `id` |`string`| The id of the geometry. | No |
|
| `id` |`string`| The id of the geometry. | No |
|
||||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ Geometry metadata.
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `fillet`| | No |
|
| `type` |enum: `fillet`| | No |
|
||||||
| `faceId` |`string`| The id for the fillet surface. | No |
|
| `faceId` |`string`| The id for the fillet surface. | No |
|
||||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag. | No |
|
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||||
| `id` |`string`| The id of the geometry. | No |
|
| `id` |`string`| The id of the geometry. | No |
|
||||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||||
|
|
||||||
|
@ -15,8 +15,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `params` |`[` [`Parameter`](/docs/kcl/types/Parameter) `]`| | No |
|
| `params` |`[` [`Parameter`](/docs/kcl/types/Parameter) `]`| | No |
|
||||||
| `body` |[`UnboxedNode_for_Program`](/docs/kcl/types/UnboxedNode_for_Program)| | No |
|
| `body` |[`Program`](/docs/kcl/types/Program)| | No |
|
||||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `name` |`string`| | No |
|
| `name` |`string`| | No |
|
||||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
@ -15,8 +15,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `name` |[`UnboxedNode_for_Identifier`](/docs/kcl/types/UnboxedNode_for_Identifier)| Name of the item to import. | No |
|
| `name` |[`Identifier`](/docs/kcl/types/Identifier)| Name of the item to import. | No |
|
||||||
| `alias` |[`UnboxedNode_for_Identifier`](/docs/kcl/types/UnboxedNode_for_Identifier)| Rename the item using an identifier after "as". | No |
|
| `alias` |[`Identifier`](/docs/kcl/types/Identifier)| Rename the item using an identifier after "as". | No |
|
||||||
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,9 +59,10 @@ Any KCL value.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
| `type` |enum: [`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
||||||
| `kind` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| Any KCL value. | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `value` |`string`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -182,7 +183,7 @@ Data for an imported geometry.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `Function`| | No |
|
| `type` |enum: `Function`| | No |
|
||||||
| `expression` |[`UnboxedNode_for_FunctionExpression`](/docs/kcl/types/UnboxedNode_for_FunctionExpression)| Any KCL value. | No |
|
| `expression` |[`FunctionExpression`](/docs/kcl/types/FunctionExpression)| Any KCL value. | No |
|
||||||
| `memory` |[`ProgramMemory`](/docs/kcl/types/ProgramMemory)| Any KCL value. | No |
|
| `memory` |[`ProgramMemory`](/docs/kcl/types/ProgramMemory)| Any KCL value. | No |
|
||||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
||||||
|
|
||||||
|
@ -23,9 +23,10 @@ layout: manual
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||||
| `kind` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `name` |`string`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -40,10 +41,12 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`Literal`](/docs/kcl/types/Literal)| | No |
|
| `type` |enum: `Literal`| | No |
|
||||||
| `kind` |[`Literal`](/docs/kcl/types/Literal)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `value` |[`LiteralValue`](/docs/kcl/types/LiteralValue)| | No |
|
||||||
|
| `raw` |`string`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
@ -22,10 +22,13 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`MemberExpression`](/docs/kcl/types/MemberExpression)| | No |
|
| `type` |enum: `MemberExpression`| | No |
|
||||||
| `kind` |[`MemberExpression`](/docs/kcl/types/MemberExpression)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `object` |[`MemberObject`](/docs/kcl/types/MemberObject)| | No |
|
||||||
|
| `property` |[`LiteralIdentifier`](/docs/kcl/types/LiteralIdentifier)| | No |
|
||||||
|
| `computed` |`boolean`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -41,9 +44,10 @@ layout: manual
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||||
| `kind` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `name` |`string`| | No |
|
||||||
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
@ -16,7 +16,7 @@ layout: manual
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `nonCodeNodes` |`object`| | No |
|
| `nonCodeNodes` |`object`| | No |
|
||||||
| `start` |`[` [`UnboxedNode_for_NonCodeNode`](/docs/kcl/types/UnboxedNode_for_NonCodeNode) `]`| | No |
|
| `start` |`[` [`NonCodeNode`](/docs/kcl/types/NonCodeNode) `]`| | No |
|
||||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `value` |[`NonCodeValue`](/docs/kcl/types/NonCodeValue)| | No |
|
| `value` |[`NonCodeValue`](/docs/kcl/types/NonCodeValue)| | No |
|
||||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
@ -15,7 +15,9 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `key` |[`UnboxedNode_for_Identifier`](/docs/kcl/types/UnboxedNode_for_Identifier)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `key` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||||
| `value` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
| `value` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ Parameter of a KCL function.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `identifier` |[`UnboxedNode_for_Identifier`](/docs/kcl/types/UnboxedNode_for_Identifier)| The parameter's label or name. | No |
|
| `identifier` |[`Identifier`](/docs/kcl/types/Identifier)| The parameter's label or name. | No |
|
||||||
| `optional` |`boolean`| Is the parameter optional? | No |
|
| `optional` |`boolean`| Is the parameter optional? | No |
|
||||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ A path that goes to a point.
|
|||||||
| `type` |enum: `ToPoint`| | No |
|
| `type` |enum: `ToPoint`| | No |
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ A arc that is tangential to the last path segment that goes to a point
|
|||||||
| `ccw` |`boolean`| arc's direction | No |
|
| `ccw` |`boolean`| arc's direction | No |
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ A arc that is tangential to the last path segment
|
|||||||
| `ccw` |`boolean`| arc's direction | No |
|
| `ccw` |`boolean`| arc's direction | No |
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ a complete arc
|
|||||||
| `ccw` |`boolean`| arc's direction | No |
|
| `ccw` |`boolean`| arc's direction | No |
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ A path that is horizontal.
|
|||||||
| `x` |`number`| The x coordinate. | No |
|
| `x` |`number`| The x coordinate. | No |
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ An angled line to.
|
|||||||
| `y` |`number`| The y coordinate. | No |
|
| `y` |`number`| The y coordinate. | No |
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ A base path.
|
|||||||
| `type` |enum: `Base`| | No |
|
| `type` |enum: `Base`| | No |
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,8 +16,10 @@ A KCL program top level, or function body.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
|
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `body` |`[` [`BodyItem`](/docs/kcl/types/BodyItem) `]`| | No |
|
| `body` |`[` [`BodyItem`](/docs/kcl/types/BodyItem) `]`| | No |
|
||||||
| `nonCodeMeta` |[`UnboxedNode_for_NonCodeMeta`](/docs/kcl/types/UnboxedNode_for_NonCodeMeta)| A KCL program top level, or function body. | No |
|
| `nonCodeMeta` |[`NonCodeMeta`](/docs/kcl/types/NonCodeMeta)| A KCL program top level, or function body. | No |
|
||||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Draw a line relative to the current origin to a specified distance away
|
|||||||
from the current position along the 'x' axis.
|
from the current position along the 'x' axis.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
xLine(length: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
xLine(length: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ xLine(length: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `length` | `number` | | Yes |
|
| `length` | `number` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Draw a line parallel to the X axis, that ends at the given X.
|
|||||||
E.g. if the previous line ended at (1, 1), then xLineTo(4) draws a line from (1, 1) to (4, 1)
|
E.g. if the previous line ended at (1, 1), then xLineTo(4) draws a line from (1, 1) to (4, 1)
|
||||||
|
|
||||||
```js
|
```js
|
||||||
xLineTo(to: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
xLineTo(to: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ xLineTo(to: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `to` | `number` | | Yes |
|
| `to` | `number` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Draw a line relative to the current origin to a specified distance away
|
|||||||
from the current position along the 'y' axis.
|
from the current position along the 'y' axis.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
yLine(length: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
yLine(length: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ yLine(length: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `length` | `number` | | Yes |
|
| `length` | `number` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Draw a line parallel to the Y axis, that ends at the given Y.
|
|||||||
E.g. if the previous line ended at (1, 1), then yLineTo(4) draws a line from (1, 1) to (1, 4)
|
E.g. if the previous line ended at (1, 1), then yLineTo(4) draws a line from (1, 1) to (1, 4)
|
||||||
|
|
||||||
```js
|
```js
|
||||||
yLineTo(to: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
yLineTo(to: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ yLineTo(to: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `to` | `number` | | Yes |
|
| `to` | `number` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -136,6 +136,9 @@ test.describe('when using the file tree to', () => {
|
|||||||
)
|
)
|
||||||
await pasteCodeInEditor(kclCube)
|
await pasteCodeInEditor(kclCube)
|
||||||
|
|
||||||
|
// TODO: We have a timeout of 1s between edits to write to disk. If you reload the page too quickly it won't write to disk.
|
||||||
|
await tronApp.page.waitForTimeout(2000)
|
||||||
|
|
||||||
await renameFile(fromFile, toFile)
|
await renameFile(fromFile, toFile)
|
||||||
await tronApp.page.reload()
|
await tronApp.page.reload()
|
||||||
|
|
||||||
@ -222,9 +225,11 @@ test.describe('when using the file tree to', () => {
|
|||||||
)
|
)
|
||||||
await pasteCodeInEditor(kclCube)
|
await pasteCodeInEditor(kclCube)
|
||||||
|
|
||||||
|
// TODO: We have a timeout of 1s between edits to write to disk. If you reload the page too quickly it won't write to disk.
|
||||||
|
await tronApp.page.waitForTimeout(2000)
|
||||||
|
|
||||||
const kcl1 = 'main.kcl'
|
const kcl1 = 'main.kcl'
|
||||||
const kcl2 = '2.kcl'
|
const kcl2 = '2.kcl'
|
||||||
|
|
||||||
await createNewFileAndSelect(kcl2)
|
await createNewFileAndSelect(kcl2)
|
||||||
const kclCylinder = await fsp.readFile(
|
const kclCylinder = await fsp.readFile(
|
||||||
'src/wasm-lib/tests/executor/inputs/cylinder.kcl',
|
'src/wasm-lib/tests/executor/inputs/cylinder.kcl',
|
||||||
@ -232,6 +237,9 @@ test.describe('when using the file tree to', () => {
|
|||||||
)
|
)
|
||||||
await pasteCodeInEditor(kclCylinder)
|
await pasteCodeInEditor(kclCylinder)
|
||||||
|
|
||||||
|
// TODO: We have a timeout of 1s between edits to write to disk. If you reload the page too quickly it won't write to disk.
|
||||||
|
await tronApp.page.waitForTimeout(2000)
|
||||||
|
|
||||||
await renameFile(kcl2, kcl1)
|
await renameFile(kcl2, kcl1)
|
||||||
|
|
||||||
await test.step(`Postcondition: ${kcl1} still has the original content`, async () => {
|
await test.step(`Postcondition: ${kcl1} still has the original content`, async () => {
|
||||||
|
@ -64,6 +64,27 @@ export type ReactCameraProperties =
|
|||||||
|
|
||||||
const lastCmdDelay = 50
|
const lastCmdDelay = 50
|
||||||
|
|
||||||
|
class CameraRateLimiter {
|
||||||
|
lastSend?: Date = undefined
|
||||||
|
rateLimitMs: number = 16 //60 FPS
|
||||||
|
|
||||||
|
send = (f: () => void) => {
|
||||||
|
let now = new Date()
|
||||||
|
|
||||||
|
if (
|
||||||
|
this.lastSend === undefined ||
|
||||||
|
now.getTime() - this.lastSend.getTime() > this.rateLimitMs
|
||||||
|
) {
|
||||||
|
f()
|
||||||
|
this.lastSend = now
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reset = () => {
|
||||||
|
this.lastSend = undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class CameraControls {
|
export class CameraControls {
|
||||||
engineCommandManager: EngineCommandManager
|
engineCommandManager: EngineCommandManager
|
||||||
syncDirection: 'clientToEngine' | 'engineToClient' = 'engineToClient'
|
syncDirection: 'clientToEngine' | 'engineToClient' = 'engineToClient'
|
||||||
@ -77,9 +98,8 @@ export class CameraControls {
|
|||||||
enableRotate = true
|
enableRotate = true
|
||||||
enablePan = true
|
enablePan = true
|
||||||
enableZoom = true
|
enableZoom = true
|
||||||
zoomDataFromLastFrame?: number = undefined
|
moveSender: CameraRateLimiter = new CameraRateLimiter()
|
||||||
// holds coordinates, and interaction
|
zoomSender: CameraRateLimiter = new CameraRateLimiter()
|
||||||
moveDataFromLastFrame?: [number, number, string] = undefined
|
|
||||||
lastPerspectiveFov: number = 45
|
lastPerspectiveFov: number = 45
|
||||||
pendingZoom: number | null = null
|
pendingZoom: number | null = null
|
||||||
pendingRotation: Vector2 | null = null
|
pendingRotation: Vector2 | null = null
|
||||||
@ -171,6 +191,36 @@ export class CameraControls {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
doMove = (interaction: any, coordinates: any) => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
this.engineCommandManager.sendSceneCommand({
|
||||||
|
type: 'modeling_cmd_req',
|
||||||
|
cmd: {
|
||||||
|
type: 'camera_drag_move',
|
||||||
|
interaction: interaction,
|
||||||
|
window: {
|
||||||
|
x: coordinates[0],
|
||||||
|
y: coordinates[1],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cmd_id: uuidv4(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
doZoom = (zoom: number) => {
|
||||||
|
this.handleStart()
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
this.engineCommandManager.sendSceneCommand({
|
||||||
|
type: 'modeling_cmd_req',
|
||||||
|
cmd: {
|
||||||
|
type: 'default_camera_zoom',
|
||||||
|
magnitude: (-1 * zoom) / window.devicePixelRatio,
|
||||||
|
},
|
||||||
|
cmd_id: uuidv4(),
|
||||||
|
})
|
||||||
|
this.handleEnd()
|
||||||
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
isOrtho = false,
|
isOrtho = false,
|
||||||
domElement: HTMLCanvasElement,
|
domElement: HTMLCanvasElement,
|
||||||
@ -258,49 +308,6 @@ export class CameraControls {
|
|||||||
this.onCameraChange()
|
this.onCameraChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Our stream is never more than 60fps.
|
|
||||||
// We can get away with capping our "virtual fps" to 60 then.
|
|
||||||
const FPS_VIRTUAL = 60
|
|
||||||
|
|
||||||
const doZoom = () => {
|
|
||||||
if (this.zoomDataFromLastFrame !== undefined) {
|
|
||||||
this.handleStart()
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
||||||
this.engineCommandManager.sendSceneCommand({
|
|
||||||
type: 'modeling_cmd_req',
|
|
||||||
cmd: {
|
|
||||||
type: 'default_camera_zoom',
|
|
||||||
magnitude:
|
|
||||||
(-1 * this.zoomDataFromLastFrame) / window.devicePixelRatio,
|
|
||||||
},
|
|
||||||
cmd_id: uuidv4(),
|
|
||||||
})
|
|
||||||
this.handleEnd()
|
|
||||||
}
|
|
||||||
this.zoomDataFromLastFrame = undefined
|
|
||||||
}
|
|
||||||
setInterval(doZoom, 1000 / FPS_VIRTUAL)
|
|
||||||
|
|
||||||
const doMove = () => {
|
|
||||||
if (this.moveDataFromLastFrame !== undefined) {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
||||||
this.engineCommandManager.sendSceneCommand({
|
|
||||||
type: 'modeling_cmd_req',
|
|
||||||
cmd: {
|
|
||||||
type: 'camera_drag_move',
|
|
||||||
interaction: this.moveDataFromLastFrame[2] as any,
|
|
||||||
window: {
|
|
||||||
x: this.moveDataFromLastFrame[0],
|
|
||||||
y: this.moveDataFromLastFrame[1],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
cmd_id: uuidv4(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.moveDataFromLastFrame = undefined
|
|
||||||
}
|
|
||||||
setInterval(doMove, 1000 / FPS_VIRTUAL)
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.engineCommandManager.subscribeTo({
|
this.engineCommandManager.subscribeTo({
|
||||||
event: 'camera_drag_end',
|
event: 'camera_drag_end',
|
||||||
@ -386,7 +393,9 @@ export class CameraControls {
|
|||||||
if (interaction === 'none') return
|
if (interaction === 'none') return
|
||||||
|
|
||||||
if (this.syncDirection === 'engineToClient') {
|
if (this.syncDirection === 'engineToClient') {
|
||||||
this.moveDataFromLastFrame = [event.clientX, event.clientY, interaction]
|
this.moveSender.send(() => {
|
||||||
|
this.doMove(interaction, [event.clientX, event.clientY])
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,7 +468,9 @@ export class CameraControls {
|
|||||||
|
|
||||||
if (this.syncDirection === 'engineToClient') {
|
if (this.syncDirection === 'engineToClient') {
|
||||||
if (interaction === 'zoom') {
|
if (interaction === 'zoom') {
|
||||||
this.zoomDataFromLastFrame = event.deltaY
|
this.zoomSender.send(() => {
|
||||||
|
this.doZoom(event.deltaY)
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
// This case will get handled when we add pan and rotate using Apple trackpad.
|
// This case will get handled when we add pan and rotate using Apple trackpad.
|
||||||
console.error(
|
console.error(
|
||||||
|
@ -44,7 +44,6 @@ import {
|
|||||||
import { ActionButton } from 'components/ActionButton'
|
import { ActionButton } from 'components/ActionButton'
|
||||||
import { err, reportRejection, trap } from 'lib/trap'
|
import { err, reportRejection, trap } from 'lib/trap'
|
||||||
import { useCommandsContext } from 'hooks/useCommandsContext'
|
import { useCommandsContext } from 'hooks/useCommandsContext'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
function useShouldHideScene(): { hideClient: boolean; hideServer: boolean } {
|
function useShouldHideScene(): { hideClient: boolean; hideServer: boolean } {
|
||||||
const [isCamMoving, setIsCamMoving] = useState(false)
|
const [isCamMoving, setIsCamMoving] = useState(false)
|
||||||
@ -202,7 +201,7 @@ const Overlay = ({
|
|||||||
let xAlignment = overlay.angle < 0 ? '0%' : '-100%'
|
let xAlignment = overlay.angle < 0 ? '0%' : '-100%'
|
||||||
let yAlignment = overlay.angle < -90 || overlay.angle >= 90 ? '0%' : '-100%'
|
let yAlignment = overlay.angle < -90 || overlay.angle >= 90 ? '0%' : '-100%'
|
||||||
|
|
||||||
const _node1 = getNodeFromPath<UnboxedNode<CallExpression>>(
|
const _node1 = getNodeFromPath<CallExpression>(
|
||||||
kclManager.ast,
|
kclManager.ast,
|
||||||
overlay.pathToNode,
|
overlay.pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -382,7 +381,7 @@ export async function deleteSegment({
|
|||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
sketchDetails: SketchDetails | null
|
sketchDetails: SketchDetails | null
|
||||||
}) {
|
}) {
|
||||||
let modifiedAst: UnboxedNode<Program> | Error = kclManager.ast
|
let modifiedAst: Program | Error = kclManager.ast
|
||||||
const dependentRanges = findUsesOfTagInPipe(modifiedAst, pathToNode)
|
const dependentRanges = findUsesOfTagInPipe(modifiedAst, pathToNode)
|
||||||
|
|
||||||
const shouldContinueSegDelete = dependentRanges.length
|
const shouldContinueSegDelete = dependentRanges.length
|
||||||
|
@ -92,7 +92,6 @@ import { err, reportRejection, trap } from 'lib/trap'
|
|||||||
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
||||||
import { Point3d } from 'wasm-lib/kcl/bindings/Point3d'
|
import { Point3d } from 'wasm-lib/kcl/bindings/Point3d'
|
||||||
import { SegmentInputs } from 'lang/std/stdTypes'
|
import { SegmentInputs } from 'lang/std/stdTypes'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
type DraftSegment = 'line' | 'tangentialArcTo'
|
type DraftSegment = 'line' | 'tangentialArcTo'
|
||||||
|
|
||||||
@ -370,14 +369,14 @@ export class SceneEntities {
|
|||||||
selectionRanges,
|
selectionRanges,
|
||||||
}: {
|
}: {
|
||||||
sketchPathToNode: PathToNode
|
sketchPathToNode: PathToNode
|
||||||
maybeModdedAst: UnboxedNode<Program>
|
maybeModdedAst: Program
|
||||||
draftExpressionsIndices?: { start: number; end: number }
|
draftExpressionsIndices?: { start: number; end: number }
|
||||||
forward: [number, number, number]
|
forward: [number, number, number]
|
||||||
up: [number, number, number]
|
up: [number, number, number]
|
||||||
position?: [number, number, number]
|
position?: [number, number, number]
|
||||||
selectionRanges?: Selections
|
selectionRanges?: Selections
|
||||||
}): Promise<{
|
}): Promise<{
|
||||||
truncatedAst: UnboxedNode<Program>
|
truncatedAst: Program
|
||||||
programMemoryOverride: ProgramMemory
|
programMemoryOverride: ProgramMemory
|
||||||
sketch: Sketch
|
sketch: Sketch
|
||||||
variableDeclarationName: string
|
variableDeclarationName: string
|
||||||
@ -562,7 +561,7 @@ export class SceneEntities {
|
|||||||
}
|
}
|
||||||
updateAstAndRejigSketch = async (
|
updateAstAndRejigSketch = async (
|
||||||
sketchPathToNode: PathToNode,
|
sketchPathToNode: PathToNode,
|
||||||
modifiedAst: UnboxedNode<Program> | Error,
|
modifiedAst: Program | Error,
|
||||||
forward: [number, number, number],
|
forward: [number, number, number],
|
||||||
up: [number, number, number],
|
up: [number, number, number],
|
||||||
origin: [number, number, number]
|
origin: [number, number, number]
|
||||||
@ -1178,7 +1177,7 @@ export class SceneEntities {
|
|||||||
}
|
}
|
||||||
prepareTruncatedMemoryAndAst = (
|
prepareTruncatedMemoryAndAst = (
|
||||||
sketchPathToNode: PathToNode,
|
sketchPathToNode: PathToNode,
|
||||||
ast?: UnboxedNode<Program>,
|
ast?: Program,
|
||||||
draftSegment?: DraftSegment
|
draftSegment?: DraftSegment
|
||||||
) =>
|
) =>
|
||||||
prepareTruncatedMemoryAndAst(
|
prepareTruncatedMemoryAndAst(
|
||||||
@ -1199,7 +1198,7 @@ export class SceneEntities {
|
|||||||
sketchPathToNode: PathToNode
|
sketchPathToNode: PathToNode
|
||||||
intersects: Intersection<Object3D<Object3DEventMap>>[]
|
intersects: Intersection<Object3D<Object3DEventMap>>[]
|
||||||
draftInfo?: {
|
draftInfo?: {
|
||||||
truncatedAst: UnboxedNode<Program>
|
truncatedAst: Program
|
||||||
programMemoryOverride: ProgramMemory
|
programMemoryOverride: ProgramMemory
|
||||||
variableDeclarationName: string
|
variableDeclarationName: string
|
||||||
}
|
}
|
||||||
@ -1235,7 +1234,7 @@ export class SceneEntities {
|
|||||||
const dragTo: [number, number] = [intersection2d.x, intersection2d.y]
|
const dragTo: [number, number] = [intersection2d.x, intersection2d.y]
|
||||||
let modifiedAst = draftInfo ? draftInfo.truncatedAst : { ...kclManager.ast }
|
let modifiedAst = draftInfo ? draftInfo.truncatedAst : { ...kclManager.ast }
|
||||||
|
|
||||||
const _node = getNodeFromPath<UnboxedNode<CallExpression>>(
|
const _node = getNodeFromPath<CallExpression>(
|
||||||
modifiedAst,
|
modifiedAst,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -1247,7 +1246,7 @@ export class SceneEntities {
|
|||||||
|
|
||||||
let modded:
|
let modded:
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
}
|
}
|
||||||
| Error
|
| Error
|
||||||
@ -1542,7 +1541,7 @@ export class SceneEntities {
|
|||||||
if (parent?.userData?.pathToNode) {
|
if (parent?.userData?.pathToNode) {
|
||||||
const updatedAst = parse(recast(kclManager.ast))
|
const updatedAst = parse(recast(kclManager.ast))
|
||||||
if (trap(updatedAst)) return
|
if (trap(updatedAst)) return
|
||||||
const _node = getNodeFromPath<UnboxedNode<CallExpression>>(
|
const _node = getNodeFromPath<CallExpression>(
|
||||||
updatedAst,
|
updatedAst,
|
||||||
parent.userData.pathToNode,
|
parent.userData.pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -1677,12 +1676,12 @@ export type DefaultPlaneStr = 'XY' | 'XZ' | 'YZ' | '-XY' | '-XZ' | '-YZ'
|
|||||||
|
|
||||||
function prepareTruncatedMemoryAndAst(
|
function prepareTruncatedMemoryAndAst(
|
||||||
sketchPathToNode: PathToNode,
|
sketchPathToNode: PathToNode,
|
||||||
ast: UnboxedNode<Program>,
|
ast: Program,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
draftSegment?: DraftSegment
|
draftSegment?: DraftSegment
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
truncatedAst: UnboxedNode<Program>
|
truncatedAst: Program
|
||||||
programMemoryOverride: ProgramMemory
|
programMemoryOverride: ProgramMemory
|
||||||
variableDeclarationName: string
|
variableDeclarationName: string
|
||||||
}
|
}
|
||||||
@ -1690,7 +1689,7 @@ function prepareTruncatedMemoryAndAst(
|
|||||||
const bodyIndex = Number(sketchPathToNode?.[1]?.[0]) || 0
|
const bodyIndex = Number(sketchPathToNode?.[1]?.[0]) || 0
|
||||||
const _ast = structuredClone(ast)
|
const _ast = structuredClone(ast)
|
||||||
|
|
||||||
const _node = getNodeFromPath<UnboxedNode<VariableDeclaration>>(
|
const _node = getNodeFromPath<VariableDeclaration>(
|
||||||
_ast,
|
_ast,
|
||||||
sketchPathToNode || [],
|
sketchPathToNode || [],
|
||||||
'VariableDeclaration'
|
'VariableDeclaration'
|
||||||
@ -1740,15 +1739,15 @@ function prepareTruncatedMemoryAndAst(
|
|||||||
).body.slice(-1)[0].start = lastPipeItem.start
|
).body.slice(-1)[0].start = lastPipeItem.start
|
||||||
|
|
||||||
_ast.end = lastPipeItem.end
|
_ast.end = lastPipeItem.end
|
||||||
const varDec = _ast.body[bodyIndex] as UnboxedNode<VariableDeclaration>
|
const varDec = _ast.body[bodyIndex] as VariableDeclaration
|
||||||
varDec.end = lastPipeItem.end
|
varDec.end = lastPipeItem.end
|
||||||
const declarator = varDec.declarations[0]
|
const declarator = varDec.declarations[0]
|
||||||
declarator.end = lastPipeItem.end
|
declarator.end = lastPipeItem.end
|
||||||
const init = declarator.init as UnboxedNode<PipeExpression>
|
const init = declarator.init as PipeExpression
|
||||||
init.end = lastPipeItem.end
|
init.end = lastPipeItem.end
|
||||||
init.body.slice(-1)[0].end = lastPipeItem.end
|
init.body.slice(-1)[0].end = lastPipeItem.end
|
||||||
}
|
}
|
||||||
const truncatedAst: UnboxedNode<Program> = {
|
const truncatedAst: Program = {
|
||||||
..._ast,
|
..._ast,
|
||||||
body: [structuredClone(_ast.body[bodyIndex])],
|
body: [structuredClone(_ast.body[bodyIndex])],
|
||||||
}
|
}
|
||||||
|
@ -488,6 +488,12 @@ export const FileTreeInner = ({
|
|||||||
// Refresh the file tree when there are changes.
|
// Refresh the file tree when there are changes.
|
||||||
useFileSystemWatcher(
|
useFileSystemWatcher(
|
||||||
async (eventType, path) => {
|
async (eventType, path) => {
|
||||||
|
// Our other watcher races with this watcher on the current file changes,
|
||||||
|
// so we need to stop this one from reacting at all, otherwise Bad Things
|
||||||
|
// Happen™.
|
||||||
|
const isCurrentFile = loaderData.file?.path === path
|
||||||
|
const hasChanged = eventType === 'change'
|
||||||
|
if (isCurrentFile && hasChanged) return
|
||||||
fileSend({ type: 'Refresh' })
|
fileSend({ type: 'Refresh' })
|
||||||
},
|
},
|
||||||
[loaderData?.project?.path, fileContext.selectedDirectory.path].filter(
|
[loaderData?.project?.path, fileContext.selectedDirectory.path].filter(
|
||||||
|
@ -69,7 +69,7 @@ import { exportFromEngine } from 'lib/exportFromEngine'
|
|||||||
import { Models } from '@kittycad/lib/dist/types/src'
|
import { Models } from '@kittycad/lib/dist/types/src'
|
||||||
import toast from 'react-hot-toast'
|
import toast from 'react-hot-toast'
|
||||||
import { EditorSelection, Transaction } from '@codemirror/state'
|
import { EditorSelection, Transaction } from '@codemirror/state'
|
||||||
import { useNavigate, useSearchParams } from 'react-router-dom'
|
import { useLoaderData, useNavigate, useSearchParams } from 'react-router-dom'
|
||||||
import { letEngineAnimateAndSyncCamAfter } from 'clientSideScene/CameraControls'
|
import { letEngineAnimateAndSyncCamAfter } from 'clientSideScene/CameraControls'
|
||||||
import { getVarNameModal } from 'hooks/useToolbarGuards'
|
import { getVarNameModal } from 'hooks/useToolbarGuards'
|
||||||
import { err, reportRejection, trap } from 'lib/trap'
|
import { err, reportRejection, trap } from 'lib/trap'
|
||||||
@ -84,7 +84,7 @@ import {
|
|||||||
import { submitAndAwaitTextToKcl } from 'lib/textToCad'
|
import { submitAndAwaitTextToKcl } from 'lib/textToCad'
|
||||||
import { useFileContext } from 'hooks/useFileContext'
|
import { useFileContext } from 'hooks/useFileContext'
|
||||||
import { uuidv4 } from 'lib/utils'
|
import { uuidv4 } from 'lib/utils'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
import { IndexLoaderData } from 'lib/types'
|
||||||
|
|
||||||
type MachineContext<T extends AnyStateMachine> = {
|
type MachineContext<T extends AnyStateMachine> = {
|
||||||
state: StateFrom<T>
|
state: StateFrom<T>
|
||||||
@ -117,6 +117,7 @@ export const ModelingMachineProvider = ({
|
|||||||
} = useSettingsAuthContext()
|
} = useSettingsAuthContext()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const { context, send: fileMachineSend } = useFileContext()
|
const { context, send: fileMachineSend } = useFileContext()
|
||||||
|
const { file } = useLoaderData() as IndexLoaderData
|
||||||
const token = auth?.context?.token
|
const token = auth?.context?.token
|
||||||
const streamRef = useRef<HTMLDivElement>(null)
|
const streamRef = useRef<HTMLDivElement>(null)
|
||||||
const persistedContext = useMemo(() => getPersistedContext(), [])
|
const persistedContext = useMemo(() => getPersistedContext(), [])
|
||||||
@ -410,12 +411,15 @@ export const ModelingMachineProvider = ({
|
|||||||
Make: ({ event }) => {
|
Make: ({ event }) => {
|
||||||
if (event.type !== 'Make') return
|
if (event.type !== 'Make') return
|
||||||
// Check if we already have an export intent.
|
// Check if we already have an export intent.
|
||||||
if (engineCommandManager.exportIntent) {
|
if (engineCommandManager.exportInfo) {
|
||||||
toast.error('Already exporting')
|
toast.error('Already exporting')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Set the export intent.
|
// Set the export intent.
|
||||||
engineCommandManager.exportIntent = ExportIntent.Make
|
engineCommandManager.exportInfo = {
|
||||||
|
intent: ExportIntent.Make,
|
||||||
|
name: file?.name || '',
|
||||||
|
}
|
||||||
|
|
||||||
// Set the current machine.
|
// Set the current machine.
|
||||||
machineManager.currentMachine = event.data.machine
|
machineManager.currentMachine = event.data.machine
|
||||||
@ -444,12 +448,16 @@ export const ModelingMachineProvider = ({
|
|||||||
},
|
},
|
||||||
'Engine export': ({ event }) => {
|
'Engine export': ({ event }) => {
|
||||||
if (event.type !== 'Export') return
|
if (event.type !== 'Export') return
|
||||||
if (engineCommandManager.exportIntent) {
|
if (engineCommandManager.exportInfo) {
|
||||||
toast.error('Already exporting')
|
toast.error('Already exporting')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Set the export intent.
|
// Set the export intent.
|
||||||
engineCommandManager.exportIntent = ExportIntent.Save
|
engineCommandManager.exportInfo = {
|
||||||
|
intent: ExportIntent.Save,
|
||||||
|
// This never gets used its only for make.
|
||||||
|
name: '',
|
||||||
|
}
|
||||||
|
|
||||||
const format = {
|
const format = {
|
||||||
...event.data,
|
...event.data,
|
||||||
@ -940,7 +948,7 @@ export const ModelingMachineProvider = ({
|
|||||||
})
|
})
|
||||||
let parsed = parse(recast(kclManager.ast))
|
let parsed = parse(recast(kclManager.ast))
|
||||||
if (trap(parsed)) return Promise.reject(parsed)
|
if (trap(parsed)) return Promise.reject(parsed)
|
||||||
parsed = parsed as UnboxedNode<Program>
|
parsed = parsed as Program
|
||||||
|
|
||||||
const { modifiedAst: _modifiedAst, pathToReplacedNode } =
|
const { modifiedAst: _modifiedAst, pathToReplacedNode } =
|
||||||
moveValueIntoNewVariablePath(
|
moveValueIntoNewVariablePath(
|
||||||
@ -951,7 +959,7 @@ export const ModelingMachineProvider = ({
|
|||||||
)
|
)
|
||||||
parsed = parse(recast(_modifiedAst))
|
parsed = parse(recast(_modifiedAst))
|
||||||
if (trap(parsed)) return Promise.reject(parsed)
|
if (trap(parsed)) return Promise.reject(parsed)
|
||||||
parsed = parsed as UnboxedNode<Program>
|
parsed = parsed as Program
|
||||||
if (!pathToReplacedNode)
|
if (!pathToReplacedNode)
|
||||||
return Promise.reject(new Error('No path to replaced node'))
|
return Promise.reject(new Error('No path to replaced node'))
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ import {
|
|||||||
import { TransformInfo } from 'lang/std/stdTypes'
|
import { TransformInfo } from 'lang/std/stdTypes'
|
||||||
import { kclManager } from 'lib/singletons'
|
import { kclManager } from 'lib/singletons'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
export function setEqualLengthInfo({
|
export function setEqualLengthInfo({
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
@ -87,7 +86,7 @@ export function applyConstraintEqualLength({
|
|||||||
selectionRanges: Selections
|
selectionRanges: Selections
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
|
@ -13,7 +13,6 @@ import {
|
|||||||
import { TransformInfo } from 'lang/std/stdTypes'
|
import { TransformInfo } from 'lang/std/stdTypes'
|
||||||
import { kclManager } from 'lib/singletons'
|
import { kclManager } from 'lib/singletons'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
export function horzVertInfo(
|
export function horzVertInfo(
|
||||||
selectionRanges: Selections,
|
selectionRanges: Selections,
|
||||||
@ -56,11 +55,11 @@ export function horzVertInfo(
|
|||||||
export function applyConstraintHorzVert(
|
export function applyConstraintHorzVert(
|
||||||
selectionRanges: Selections,
|
selectionRanges: Selections,
|
||||||
horOrVert: 'vertical' | 'horizontal',
|
horOrVert: 'vertical' | 'horizontal',
|
||||||
ast: UnboxedNode<Program>,
|
ast: Program,
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
|
@ -19,7 +19,6 @@ import { createVariableDeclaration } from '../../lang/modifyAst'
|
|||||||
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
||||||
import { kclManager } from 'lib/singletons'
|
import { kclManager } from 'lib/singletons'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
const getModalInfo = createInfoModal(GetInfoModal)
|
const getModalInfo = createInfoModal(GetInfoModal)
|
||||||
|
|
||||||
@ -137,7 +136,7 @@ export async function applyConstraintIntersect({
|
|||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections
|
||||||
}): Promise<{
|
}): Promise<{
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}> {
|
}> {
|
||||||
const info = intersectInfo({
|
const info = intersectInfo({
|
||||||
|
@ -13,7 +13,6 @@ import {
|
|||||||
import { TransformInfo } from 'lang/std/stdTypes'
|
import { TransformInfo } from 'lang/std/stdTypes'
|
||||||
import { kclManager } from 'lib/singletons'
|
import { kclManager } from 'lib/singletons'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
export function removeConstrainingValuesInfo({
|
export function removeConstrainingValuesInfo({
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
@ -78,7 +77,7 @@ export function applyRemoveConstrainingValues({
|
|||||||
pathToNodes?: Array<PathToNode>
|
pathToNodes?: Array<PathToNode>
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
|
@ -23,7 +23,6 @@ import {
|
|||||||
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
||||||
import { kclManager } from 'lib/singletons'
|
import { kclManager } from 'lib/singletons'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
const getModalInfo = createSetAngleLengthModal(SetAngleLengthModal)
|
const getModalInfo = createSetAngleLengthModal(SetAngleLengthModal)
|
||||||
|
|
||||||
@ -162,7 +161,7 @@ export function applyConstraintAxisAlign({
|
|||||||
constraint: 'snapToYAxis' | 'snapToXAxis'
|
constraint: 'snapToYAxis' | 'snapToXAxis'
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
|
@ -18,7 +18,6 @@ import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
|||||||
import { kclManager } from 'lib/singletons'
|
import { kclManager } from 'lib/singletons'
|
||||||
import { Selections } from 'lib/selections'
|
import { Selections } from 'lib/selections'
|
||||||
import { cleanErrs, err } from 'lib/trap'
|
import { cleanErrs, err } from 'lib/trap'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
const getModalInfo = createInfoModal(GetInfoModal)
|
const getModalInfo = createInfoModal(GetInfoModal)
|
||||||
|
|
||||||
@ -186,7 +185,7 @@ export function applyConstraintHorzVertAlign({
|
|||||||
constraint: 'setHorzDistance' | 'setVertDistance'
|
constraint: 'setHorzDistance' | 'setVertDistance'
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
|
@ -21,10 +21,9 @@ import {
|
|||||||
import { getNodeFromPath } from './queryAst'
|
import { getNodeFromPath } from './queryAst'
|
||||||
import { codeManager, editorManager, sceneInfra } from 'lib/singletons'
|
import { codeManager, editorManager, sceneInfra } from 'lib/singletons'
|
||||||
import { Diagnostic } from '@codemirror/lint'
|
import { Diagnostic } from '@codemirror/lint'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
interface ExecuteArgs {
|
interface ExecuteArgs {
|
||||||
ast?: UnboxedNode<Program>
|
ast?: Program
|
||||||
zoomToFit?: boolean
|
zoomToFit?: boolean
|
||||||
executionId?: number
|
executionId?: number
|
||||||
zoomOnRangeAndType?: {
|
zoomOnRangeAndType?: {
|
||||||
@ -34,13 +33,13 @@ interface ExecuteArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class KclManager {
|
export class KclManager {
|
||||||
private _ast: UnboxedNode<Program> = {
|
private _ast: Program = {
|
||||||
body: [],
|
body: [],
|
||||||
start: 0,
|
start: 0,
|
||||||
end: 0,
|
end: 0,
|
||||||
nonCodeMeta: {
|
nonCodeMeta: {
|
||||||
nonCodeNodes: {},
|
nonCodeNodes: {},
|
||||||
startNodes: [],
|
start: [],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
private _execState: ExecState = emptyExecState()
|
private _execState: ExecState = emptyExecState()
|
||||||
@ -56,7 +55,7 @@ export class KclManager {
|
|||||||
engineCommandManager: EngineCommandManager
|
engineCommandManager: EngineCommandManager
|
||||||
|
|
||||||
private _isExecutingCallback: (arg: boolean) => void = () => {}
|
private _isExecutingCallback: (arg: boolean) => void = () => {}
|
||||||
private _astCallBack: (arg: UnboxedNode<Program>) => void = () => {}
|
private _astCallBack: (arg: Program) => void = () => {}
|
||||||
private _programMemoryCallBack: (arg: ProgramMemory) => void = () => {}
|
private _programMemoryCallBack: (arg: ProgramMemory) => void = () => {}
|
||||||
private _logsCallBack: (arg: string[]) => void = () => {}
|
private _logsCallBack: (arg: string[]) => void = () => {}
|
||||||
private _kclErrorsCallBack: (arg: KCLError[]) => void = () => {}
|
private _kclErrorsCallBack: (arg: KCLError[]) => void = () => {}
|
||||||
@ -182,7 +181,7 @@ export class KclManager {
|
|||||||
setWasmInitFailed,
|
setWasmInitFailed,
|
||||||
}: {
|
}: {
|
||||||
setProgramMemory: (arg: ProgramMemory) => void
|
setProgramMemory: (arg: ProgramMemory) => void
|
||||||
setAst: (arg: UnboxedNode<Program>) => void
|
setAst: (arg: Program) => void
|
||||||
setLogs: (arg: string[]) => void
|
setLogs: (arg: string[]) => void
|
||||||
setKclErrors: (arg: KCLError[]) => void
|
setKclErrors: (arg: KCLError[]) => void
|
||||||
setIsExecuting: (arg: boolean) => void
|
setIsExecuting: (arg: boolean) => void
|
||||||
@ -206,12 +205,12 @@ export class KclManager {
|
|||||||
end: 0,
|
end: 0,
|
||||||
nonCodeMeta: {
|
nonCodeMeta: {
|
||||||
nonCodeNodes: {},
|
nonCodeNodes: {},
|
||||||
startNodes: [],
|
start: [],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
safeParse(code: string): UnboxedNode<Program> | null {
|
safeParse(code: string): Program | null {
|
||||||
const ast = parse(code)
|
const ast = parse(code)
|
||||||
this.lints = []
|
this.lints = []
|
||||||
this.kclErrors = []
|
this.kclErrors = []
|
||||||
@ -378,7 +377,7 @@ export class KclManager {
|
|||||||
Array.from(this.engineCommandManager.artifactGraph).forEach(
|
Array.from(this.engineCommandManager.artifactGraph).forEach(
|
||||||
([commandId, artifact]) => {
|
([commandId, artifact]) => {
|
||||||
if (!('codeRef' in artifact)) return
|
if (!('codeRef' in artifact)) return
|
||||||
const _node1 = getNodeFromPath<UnboxedNode<CallExpression>>(
|
const _node1 = getNodeFromPath<CallExpression>(
|
||||||
this.ast,
|
this.ast,
|
||||||
artifact.codeRef.pathToNode,
|
artifact.codeRef.pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -442,7 +441,7 @@ export class KclManager {
|
|||||||
// but should probably have think about which of the function to keep
|
// but should probably have think about which of the function to keep
|
||||||
// This always updates the code state and editor and writes to the file system.
|
// This always updates the code state and editor and writes to the file system.
|
||||||
async updateAst(
|
async updateAst(
|
||||||
ast: UnboxedNode<Program>,
|
ast: Program,
|
||||||
execute: boolean,
|
execute: boolean,
|
||||||
optionalParams?: {
|
optionalParams?: {
|
||||||
focusPath?: Array<PathToNode>
|
focusPath?: Array<PathToNode>
|
||||||
@ -453,7 +452,7 @@ export class KclManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
): Promise<{
|
): Promise<{
|
||||||
newAst: UnboxedNode<Program>
|
newAst: Program
|
||||||
selections?: Selections
|
selections?: Selections
|
||||||
}> {
|
}> {
|
||||||
const newCode = recast(ast)
|
const newCode = recast(ast)
|
||||||
@ -589,7 +588,7 @@ export class KclManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determines if there is no KCL code which means it is executing a blank KCL file
|
// Determines if there is no KCL code which means it is executing a blank KCL file
|
||||||
_isAstEmpty(ast: UnboxedNode<Program>) {
|
_isAstEmpty(ast: Program) {
|
||||||
return ast.start === 0 && ast.end === 0 && ast.body.length === 0
|
return ast.start === 0 && ast.end === 0 && ast.body.length === 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ export default class CodeManager {
|
|||||||
#updateState: (arg: string) => void = () => {}
|
#updateState: (arg: string) => void = () => {}
|
||||||
private _currentFilePath: string | null = null
|
private _currentFilePath: string | null = null
|
||||||
private _hotkeys: { [key: string]: () => void } = {}
|
private _hotkeys: { [key: string]: () => void } = {}
|
||||||
|
private timeoutWriter: ReturnType<typeof setTimeout> | undefined = undefined
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
if (isDesktop()) {
|
if (isDesktop()) {
|
||||||
@ -115,7 +116,11 @@ export default class CodeManager {
|
|||||||
|
|
||||||
async writeToFile() {
|
async writeToFile() {
|
||||||
if (isDesktop()) {
|
if (isDesktop()) {
|
||||||
setTimeout(() => {
|
// Only write our buffer contents to file once per second. Any faster
|
||||||
|
// and file-system watchers which read, will receive empty data during
|
||||||
|
// writes.
|
||||||
|
clearTimeout(this.timeoutWriter)
|
||||||
|
this.timeoutWriter = setTimeout(() => {
|
||||||
// Wait one event loop to give a chance for params to be set
|
// Wait one event loop to give a chance for params to be set
|
||||||
// Save the file to disk
|
// Save the file to disk
|
||||||
this._currentFilePath &&
|
this._currentFilePath &&
|
||||||
@ -126,7 +131,7 @@ export default class CodeManager {
|
|||||||
console.error('error saving file', err)
|
console.error('error saving file', err)
|
||||||
toast.error('Error saving file, please check file permissions')
|
toast.error('Error saving file, please check file permissions')
|
||||||
})
|
})
|
||||||
})
|
}, 1000)
|
||||||
} else {
|
} else {
|
||||||
safeLSSetItem(PERSIST_CODE_KEY, this.code)
|
safeLSSetItem(PERSIST_CODE_KEY, this.code)
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ import { EngineCommandManager } from 'lang/std/engineConnection'
|
|||||||
import { KCLError } from 'lang/errors'
|
import { KCLError } from 'lang/errors'
|
||||||
import { Diagnostic } from '@codemirror/lint'
|
import { Diagnostic } from '@codemirror/lint'
|
||||||
import { IdGenerator } from 'wasm-lib/kcl/bindings/IdGenerator'
|
import { IdGenerator } from 'wasm-lib/kcl/bindings/IdGenerator'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
export type ToolTip =
|
export type ToolTip =
|
||||||
| 'lineTo'
|
| 'lineTo'
|
||||||
@ -53,7 +52,7 @@ export async function executeAst({
|
|||||||
programMemoryOverride,
|
programMemoryOverride,
|
||||||
idGenerator,
|
idGenerator,
|
||||||
}: {
|
}: {
|
||||||
ast: UnboxedNode<Program>
|
ast: Program
|
||||||
engineCommandManager: EngineCommandManager
|
engineCommandManager: EngineCommandManager
|
||||||
useFakeExecutor?: boolean
|
useFakeExecutor?: boolean
|
||||||
programMemoryOverride?: ProgramMemory
|
programMemoryOverride?: ProgramMemory
|
||||||
|
@ -21,7 +21,6 @@ import { enginelessExecutor } from '../lib/testHelpers'
|
|||||||
import { findUsesOfTagInPipe, getNodePathFromSourceRange } from './queryAst'
|
import { findUsesOfTagInPipe, getNodePathFromSourceRange } from './queryAst'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import { SimplifiedArgDetails } from './std/stdTypes'
|
import { SimplifiedArgDetails } from './std/stdTypes'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await initPromise
|
await initPromise
|
||||||
@ -110,7 +109,7 @@ describe('Testing findUniqueName', () => {
|
|||||||
{ type: 'Identifier', name: 'yo07', start: 0, end: 0 },
|
{ type: 'Identifier', name: 'yo07', start: 0, end: 0 },
|
||||||
{ type: 'Identifier', name: 'yo08', start: 0, end: 0 },
|
{ type: 'Identifier', name: 'yo08', start: 0, end: 0 },
|
||||||
{ type: 'Identifier', name: 'yo09', start: 0, end: 0 },
|
{ type: 'Identifier', name: 'yo09', start: 0, end: 0 },
|
||||||
] satisfies UnboxedNode<Identifier>[]),
|
] satisfies Identifier[]),
|
||||||
'yo',
|
'yo',
|
||||||
2
|
2
|
||||||
)
|
)
|
||||||
@ -124,7 +123,7 @@ describe('Testing addSketchTo', () => {
|
|||||||
body: [],
|
body: [],
|
||||||
start: 0,
|
start: 0,
|
||||||
end: 0,
|
end: 0,
|
||||||
nonCodeMeta: { nonCodeNodes: {}, startNodes: [] },
|
nonCodeMeta: { nonCodeNodes: {}, start: [] },
|
||||||
},
|
},
|
||||||
'yz'
|
'yz'
|
||||||
)
|
)
|
||||||
|
@ -42,13 +42,12 @@ import { SimplifiedArgDetails } from './std/stdTypes'
|
|||||||
import { TagDeclarator } from 'wasm-lib/kcl/bindings/TagDeclarator'
|
import { TagDeclarator } from 'wasm-lib/kcl/bindings/TagDeclarator'
|
||||||
import { Models } from '@kittycad/lib'
|
import { Models } from '@kittycad/lib'
|
||||||
import { ExtrudeFacePlane } from 'machines/modelingMachine'
|
import { ExtrudeFacePlane } from 'machines/modelingMachine'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
export function startSketchOnDefault(
|
export function startSketchOnDefault(
|
||||||
node: UnboxedNode<Program>,
|
node: Program,
|
||||||
axis: DefaultPlaneStr,
|
axis: DefaultPlaneStr,
|
||||||
name = ''
|
name = ''
|
||||||
): { modifiedAst: UnboxedNode<Program>; id: string; pathToNode: PathToNode } {
|
): { modifiedAst: Program; id: string; pathToNode: PathToNode } {
|
||||||
const _node = { ...node }
|
const _node = { ...node }
|
||||||
const _name =
|
const _name =
|
||||||
name || findUniqueName(node, KCL_DEFAULT_CONSTANT_PREFIXES.SKETCH)
|
name || findUniqueName(node, KCL_DEFAULT_CONSTANT_PREFIXES.SKETCH)
|
||||||
@ -77,10 +76,10 @@ export function startSketchOnDefault(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function addStartProfileAt(
|
export function addStartProfileAt(
|
||||||
node: UnboxedNode<Program>,
|
node: Program,
|
||||||
pathToNode: PathToNode,
|
pathToNode: PathToNode,
|
||||||
at: [number, number]
|
at: [number, number]
|
||||||
): { modifiedAst: UnboxedNode<Program>; pathToNode: PathToNode } | Error {
|
): { modifiedAst: Program; pathToNode: PathToNode } | Error {
|
||||||
const _node1 = getNodeFromPath<VariableDeclaration>(
|
const _node1 = getNodeFromPath<VariableDeclaration>(
|
||||||
node,
|
node,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
@ -115,7 +114,7 @@ export function addStartProfileAt(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function addSketchTo(
|
export function addSketchTo(
|
||||||
node: UnboxedNode<Program>,
|
node: Program,
|
||||||
axis: 'xy' | 'xz' | 'yz',
|
axis: 'xy' | 'xz' | 'yz',
|
||||||
name = ''
|
name = ''
|
||||||
): { modifiedAst: Program; id: string; pathToNode: PathToNode } {
|
): { modifiedAst: Program; id: string; pathToNode: PathToNode } {
|
||||||
@ -211,7 +210,7 @@ export function mutateArrExp(node: Expr, updateWith: ArrayExpression): boolean {
|
|||||||
|
|
||||||
export function mutateObjExpProp(
|
export function mutateObjExpProp(
|
||||||
node: Expr,
|
node: Expr,
|
||||||
updateWith: UnboxedNode<Literal> | UnboxedNode<ArrayExpression>,
|
updateWith: Literal | ArrayExpression,
|
||||||
key: string
|
key: string
|
||||||
): boolean {
|
): boolean {
|
||||||
if (node.type === 'ObjectExpression') {
|
if (node.type === 'ObjectExpression') {
|
||||||
@ -249,13 +248,13 @@ export function mutateObjExpProp(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function extrudeSketch(
|
export function extrudeSketch(
|
||||||
node: UnboxedNode<Program>,
|
node: Program,
|
||||||
pathToNode: PathToNode,
|
pathToNode: PathToNode,
|
||||||
shouldPipe = false,
|
shouldPipe = false,
|
||||||
distance: Expr = createLiteral(4)
|
distance: Expr = createLiteral(4)
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
pathToExtrudeArg: PathToNode
|
pathToExtrudeArg: PathToNode
|
||||||
}
|
}
|
||||||
@ -344,13 +343,13 @@ export function extrudeSketch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function revolveSketch(
|
export function revolveSketch(
|
||||||
node: UnboxedNode<Program>,
|
node: Program,
|
||||||
pathToNode: PathToNode,
|
pathToNode: PathToNode,
|
||||||
shouldPipe = false,
|
shouldPipe = false,
|
||||||
angle: Expr = createLiteral(4)
|
angle: Expr = createLiteral(4)
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
pathToRevolveArg: PathToNode
|
pathToRevolveArg: PathToNode
|
||||||
}
|
}
|
||||||
@ -440,7 +439,7 @@ export function revolveSketch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function sketchOnExtrudedFace(
|
export function sketchOnExtrudedFace(
|
||||||
node: UnboxedNode<Program>,
|
node: Program,
|
||||||
sketchPathToNode: PathToNode,
|
sketchPathToNode: PathToNode,
|
||||||
extrudePathToNode: PathToNode,
|
extrudePathToNode: PathToNode,
|
||||||
info: ExtrudeFacePlane['faceInfo'] = { type: 'wall' }
|
info: ExtrudeFacePlane['faceInfo'] = { type: 'wall' }
|
||||||
@ -572,7 +571,7 @@ export function splitPathAtPipeExpression(pathToNode: PathToNode): {
|
|||||||
return splitPathAtPipeExpression(pathToNode.slice(0, -1))
|
return splitPathAtPipeExpression(pathToNode.slice(0, -1))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createLiteral(value: string | number): UnboxedNode<Literal> {
|
export function createLiteral(value: string | number): Literal {
|
||||||
return {
|
return {
|
||||||
type: 'Literal',
|
type: 'Literal',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -582,7 +581,7 @@ export function createLiteral(value: string | number): UnboxedNode<Literal> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createTagDeclarator(value: string): UnboxedNode<TagDeclarator> {
|
export function createTagDeclarator(value: string): TagDeclarator {
|
||||||
return {
|
return {
|
||||||
type: 'TagDeclarator',
|
type: 'TagDeclarator',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -592,7 +591,7 @@ export function createTagDeclarator(value: string): UnboxedNode<TagDeclarator> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createIdentifier(name: string): UnboxedNode<Identifier> {
|
export function createIdentifier(name: string): Identifier {
|
||||||
return {
|
return {
|
||||||
type: 'Identifier',
|
type: 'Identifier',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -602,7 +601,7 @@ export function createIdentifier(name: string): UnboxedNode<Identifier> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createPipeSubstitution(): UnboxedNode<PipeSubstitution> {
|
export function createPipeSubstitution(): PipeSubstitution {
|
||||||
return {
|
return {
|
||||||
type: 'PipeSubstitution',
|
type: 'PipeSubstitution',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -613,7 +612,7 @@ export function createPipeSubstitution(): UnboxedNode<PipeSubstitution> {
|
|||||||
export function createCallExpressionStdLib(
|
export function createCallExpressionStdLib(
|
||||||
name: string,
|
name: string,
|
||||||
args: CallExpression['arguments']
|
args: CallExpression['arguments']
|
||||||
): UnboxedNode<CallExpression> {
|
): CallExpression {
|
||||||
return {
|
return {
|
||||||
type: 'CallExpression',
|
type: 'CallExpression',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -633,7 +632,7 @@ export function createCallExpressionStdLib(
|
|||||||
export function createCallExpression(
|
export function createCallExpression(
|
||||||
name: string,
|
name: string,
|
||||||
args: CallExpression['arguments']
|
args: CallExpression['arguments']
|
||||||
): UnboxedNode<CallExpression> {
|
): CallExpression {
|
||||||
return {
|
return {
|
||||||
type: 'CallExpression',
|
type: 'CallExpression',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -652,7 +651,7 @@ export function createCallExpression(
|
|||||||
|
|
||||||
export function createArrayExpression(
|
export function createArrayExpression(
|
||||||
elements: ArrayExpression['elements']
|
elements: ArrayExpression['elements']
|
||||||
): UnboxedNode<ArrayExpression> {
|
): ArrayExpression {
|
||||||
return {
|
return {
|
||||||
type: 'ArrayExpression',
|
type: 'ArrayExpression',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -665,7 +664,7 @@ export function createArrayExpression(
|
|||||||
|
|
||||||
export function createPipeExpression(
|
export function createPipeExpression(
|
||||||
body: PipeExpression['body']
|
body: PipeExpression['body']
|
||||||
): UnboxedNode<PipeExpression> {
|
): PipeExpression {
|
||||||
return {
|
return {
|
||||||
type: 'PipeExpression',
|
type: 'PipeExpression',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -681,7 +680,7 @@ export function createVariableDeclaration(
|
|||||||
init: VariableDeclarator['init'],
|
init: VariableDeclarator['init'],
|
||||||
visibility: VariableDeclaration['visibility'] = 'default',
|
visibility: VariableDeclaration['visibility'] = 'default',
|
||||||
kind: VariableDeclaration['kind'] = 'const'
|
kind: VariableDeclaration['kind'] = 'const'
|
||||||
): UnboxedNode<VariableDeclaration> {
|
): VariableDeclaration {
|
||||||
return {
|
return {
|
||||||
type: 'VariableDeclaration',
|
type: 'VariableDeclaration',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -704,7 +703,7 @@ export function createVariableDeclaration(
|
|||||||
|
|
||||||
export function createObjectExpression(properties: {
|
export function createObjectExpression(properties: {
|
||||||
[key: string]: Expr
|
[key: string]: Expr
|
||||||
}): UnboxedNode<ObjectExpression> {
|
}): ObjectExpression {
|
||||||
return {
|
return {
|
||||||
type: 'ObjectExpression',
|
type: 'ObjectExpression',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -725,7 +724,7 @@ export function createObjectExpression(properties: {
|
|||||||
export function createUnaryExpression(
|
export function createUnaryExpression(
|
||||||
argument: UnaryExpression['argument'],
|
argument: UnaryExpression['argument'],
|
||||||
operator: UnaryExpression['operator'] = '-'
|
operator: UnaryExpression['operator'] = '-'
|
||||||
): UnboxedNode<UnaryExpression> {
|
): UnaryExpression {
|
||||||
return {
|
return {
|
||||||
type: 'UnaryExpression',
|
type: 'UnaryExpression',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -740,7 +739,7 @@ export function createBinaryExpression([left, operator, right]: [
|
|||||||
BinaryExpression['left'],
|
BinaryExpression['left'],
|
||||||
BinaryExpression['operator'],
|
BinaryExpression['operator'],
|
||||||
BinaryExpression['right']
|
BinaryExpression['right']
|
||||||
]): UnboxedNode<BinaryExpression> {
|
]): BinaryExpression {
|
||||||
return {
|
return {
|
||||||
type: 'BinaryExpression',
|
type: 'BinaryExpression',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -755,19 +754,19 @@ export function createBinaryExpression([left, operator, right]: [
|
|||||||
export function createBinaryExpressionWithUnary([left, right]: [
|
export function createBinaryExpressionWithUnary([left, right]: [
|
||||||
BinaryExpression['left'],
|
BinaryExpression['left'],
|
||||||
BinaryExpression['right']
|
BinaryExpression['right']
|
||||||
]): UnboxedNode<BinaryExpression> {
|
]): BinaryExpression {
|
||||||
if (right.type === 'UnaryExpression' && right.operator === '-')
|
if (right.type === 'UnaryExpression' && right.operator === '-')
|
||||||
return createBinaryExpression([left, '-', right.argument])
|
return createBinaryExpression([left, '-', right.argument])
|
||||||
return createBinaryExpression([left, '+', right])
|
return createBinaryExpression([left, '+', right])
|
||||||
}
|
}
|
||||||
|
|
||||||
export function giveSketchFnCallTag(
|
export function giveSketchFnCallTag(
|
||||||
ast: UnboxedNode<Program>,
|
ast: Program,
|
||||||
range: Selection['range'],
|
range: Selection['range'],
|
||||||
tag?: string
|
tag?: string
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
tag: string
|
tag: string
|
||||||
isTagExisting: boolean
|
isTagExisting: boolean
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
@ -802,7 +801,7 @@ export function giveSketchFnCallTag(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function moveValueIntoNewVariablePath(
|
export function moveValueIntoNewVariablePath(
|
||||||
ast: UnboxedNode<Program>,
|
ast: Program,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
pathToNode: PathToNode,
|
pathToNode: PathToNode,
|
||||||
variableName: string
|
variableName: string
|
||||||
@ -835,12 +834,12 @@ export function moveValueIntoNewVariablePath(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function moveValueIntoNewVariable(
|
export function moveValueIntoNewVariable(
|
||||||
ast: UnboxedNode<Program>,
|
ast: Program,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
sourceRange: Selection['range'],
|
sourceRange: Selection['range'],
|
||||||
variableName: string
|
variableName: string
|
||||||
): {
|
): {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
pathToReplacedNode?: PathToNode
|
pathToReplacedNode?: PathToNode
|
||||||
} {
|
} {
|
||||||
const meta = isNodeSafeToReplace(ast, sourceRange)
|
const meta = isNodeSafeToReplace(ast, sourceRange)
|
||||||
@ -873,17 +872,17 @@ export function moveValueIntoNewVariable(
|
|||||||
*/
|
*/
|
||||||
export function deleteSegmentFromPipeExpression(
|
export function deleteSegmentFromPipeExpression(
|
||||||
dependentRanges: SourceRange[],
|
dependentRanges: SourceRange[],
|
||||||
modifiedAst: UnboxedNode<Program>,
|
modifiedAst: Program,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
code: string,
|
code: string,
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
): UnboxedNode<Program> | Error {
|
): Program | Error {
|
||||||
let _modifiedAst = structuredClone(modifiedAst)
|
let _modifiedAst = structuredClone(modifiedAst)
|
||||||
|
|
||||||
dependentRanges.forEach((range) => {
|
dependentRanges.forEach((range) => {
|
||||||
const path = getNodePathFromSourceRange(_modifiedAst, range)
|
const path = getNodePathFromSourceRange(_modifiedAst, range)
|
||||||
|
|
||||||
const callExp = getNodeFromPath<UnboxedNode<CallExpression>>(
|
const callExp = getNodeFromPath<CallExpression>(
|
||||||
_modifiedAst,
|
_modifiedAst,
|
||||||
path,
|
path,
|
||||||
'CallExpression',
|
'CallExpression',
|
||||||
@ -929,11 +928,11 @@ export function deleteSegmentFromPipeExpression(
|
|||||||
export function removeSingleConstraintInfo(
|
export function removeSingleConstraintInfo(
|
||||||
pathToCallExp: PathToNode,
|
pathToCallExp: PathToNode,
|
||||||
argDetails: SimplifiedArgDetails,
|
argDetails: SimplifiedArgDetails,
|
||||||
ast: UnboxedNode<Program>,
|
ast: Program,
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}
|
}
|
||||||
| false {
|
| false {
|
||||||
@ -955,12 +954,12 @@ export function removeSingleConstraintInfo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteFromSelection(
|
export async function deleteFromSelection(
|
||||||
ast: UnboxedNode<Program>,
|
ast: Program,
|
||||||
selection: Selection,
|
selection: Selection,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
getFaceDetails: (id: string) => Promise<Models['FaceIsPlanar_type']> = () =>
|
getFaceDetails: (id: string) => Promise<Models['FaceIsPlanar_type']> = () =>
|
||||||
({} as any)
|
({} as any)
|
||||||
): Promise<UnboxedNode<Program> | Error> {
|
): Promise<Program | Error> {
|
||||||
const astClone = structuredClone(ast)
|
const astClone = structuredClone(ast)
|
||||||
const range = selection.range
|
const range = selection.range
|
||||||
const path = getNodePathFromSourceRange(ast, range)
|
const path = getNodePathFromSourceRange(ast, range)
|
||||||
@ -1135,5 +1134,5 @@ export async function deleteFromSelection(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const nonCodeMetaEmpty = () => {
|
const nonCodeMetaEmpty = () => {
|
||||||
return { nonCodeNodes: {}, startNodes: [], start: 0, end: 0 }
|
return { nonCodeNodes: {}, start: [] }
|
||||||
}
|
}
|
||||||
|
@ -36,12 +36,11 @@ import {
|
|||||||
getSweepFromSuspectedPath,
|
getSweepFromSuspectedPath,
|
||||||
} from 'lang/std/artifactGraph'
|
} from 'lang/std/artifactGraph'
|
||||||
import { kclManager, engineCommandManager, editorManager } from 'lib/singletons'
|
import { kclManager, engineCommandManager, editorManager } from 'lib/singletons'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
// Apply Fillet To Selection
|
// Apply Fillet To Selection
|
||||||
|
|
||||||
export function applyFilletToSelection(
|
export function applyFilletToSelection(
|
||||||
ast: UnboxedNode<Program>,
|
ast: Program,
|
||||||
selection: Selections,
|
selection: Selections,
|
||||||
radius: KclCommandValue
|
radius: KclCommandValue
|
||||||
): void | Error {
|
): void | Error {
|
||||||
@ -56,12 +55,10 @@ export function applyFilletToSelection(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function modifyAstCloneWithFilletAndTag(
|
export function modifyAstCloneWithFilletAndTag(
|
||||||
ast: UnboxedNode<Program>,
|
ast: Program,
|
||||||
selection: Selections,
|
selection: Selections,
|
||||||
radius: KclCommandValue
|
radius: KclCommandValue
|
||||||
):
|
): { modifiedAst: Program; pathToFilletNode: Array<PathToNode> } | Error {
|
||||||
| { modifiedAst: UnboxedNode<Program>; pathToFilletNode: Array<PathToNode> }
|
|
||||||
| Error {
|
|
||||||
let clonedAst = structuredClone(ast)
|
let clonedAst = structuredClone(ast)
|
||||||
const clonedAstForGetExtrude = structuredClone(ast)
|
const clonedAstForGetExtrude = structuredClone(ast)
|
||||||
|
|
||||||
@ -249,7 +246,7 @@ export function getPathToExtrudeForSegmentSelection(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function updateAstAndFocus(
|
async function updateAstAndFocus(
|
||||||
modifiedAst: UnboxedNode<Program>,
|
modifiedAst: Program,
|
||||||
pathToFilletNode: Array<PathToNode>
|
pathToFilletNode: Array<PathToNode>
|
||||||
) {
|
) {
|
||||||
const updatedAst = await kclManager.updateAst(modifiedAst, true, {
|
const updatedAst = await kclManager.updateAst(modifiedAst, true, {
|
||||||
@ -261,7 +258,7 @@ async function updateAstAndFocus(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mutateAstWithTagForSketchSegment(
|
function mutateAstWithTagForSketchSegment(
|
||||||
astClone: UnboxedNode<Program>,
|
astClone: Program,
|
||||||
pathToSegmentNode: PathToNode
|
pathToSegmentNode: PathToNode
|
||||||
): { modifiedAst: Program; tag: string } | Error {
|
): { modifiedAst: Program; tag: string } | Error {
|
||||||
const segmentNode = getNodeFromPath<CallExpression>(
|
const segmentNode = getNodeFromPath<CallExpression>(
|
||||||
@ -295,7 +292,7 @@ function mutateAstWithTagForSketchSegment(
|
|||||||
function getEdgeTagCall(
|
function getEdgeTagCall(
|
||||||
tag: string,
|
tag: string,
|
||||||
selectionType: string
|
selectionType: string
|
||||||
): UnboxedNode<Identifier | CallExpression> {
|
): Identifier | CallExpression {
|
||||||
let tagCall: Expr = createIdentifier(tag)
|
let tagCall: Expr = createIdentifier(tag)
|
||||||
|
|
||||||
// Modify the tag based on selectionType
|
// Modify the tag based on selectionType
|
||||||
@ -429,7 +426,7 @@ export const hasValidFilletSelection = ({
|
|||||||
code,
|
code,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections
|
||||||
ast: UnboxedNode<Program>
|
ast: Program
|
||||||
code: string
|
code: string
|
||||||
}) => {
|
}) => {
|
||||||
// check if there is anything filletable in the scene
|
// check if there is anything filletable in the scene
|
||||||
@ -457,7 +454,7 @@ export const hasValidFilletSelection = ({
|
|||||||
for (const selection of selectionRanges.codeBasedSelections) {
|
for (const selection of selectionRanges.codeBasedSelections) {
|
||||||
// check if all selections are in sketchLineHelperMap
|
// check if all selections are in sketchLineHelperMap
|
||||||
const path = getNodePathFromSourceRange(ast, selection.range)
|
const path = getNodePathFromSourceRange(ast, selection.range)
|
||||||
const segmentNode = getNodeFromPath<UnboxedNode<CallExpression>>(
|
const segmentNode = getNodeFromPath<CallExpression>(
|
||||||
ast,
|
ast,
|
||||||
path,
|
path,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -537,7 +534,7 @@ export const isTagUsedInFillet = ({
|
|||||||
ast,
|
ast,
|
||||||
callExp,
|
callExp,
|
||||||
}: {
|
}: {
|
||||||
ast: UnboxedNode<Program>
|
ast: Program
|
||||||
callExp: CallExpression
|
callExp: CallExpression
|
||||||
}): Array<EdgeTypes> => {
|
}): Array<EdgeTypes> => {
|
||||||
const tag = getTagFromCallExpression(callExp)
|
const tag = getTagFromCallExpression(callExp)
|
||||||
|
@ -29,7 +29,6 @@ import {
|
|||||||
} from './std/sketchcombos'
|
} from './std/sketchcombos'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import { ImportStatement } from 'wasm-lib/kcl/bindings/ImportStatement'
|
import { ImportStatement } from 'wasm-lib/kcl/bindings/ImportStatement'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a node from a given path within a Program node structure, optionally stopping at a specified node type.
|
* Retrieves a node from a given path within a Program node structure, optionally stopping at a specified node type.
|
||||||
@ -122,13 +121,12 @@ export function getNodeFromPathCurry(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function moreNodePathFromSourceRange(
|
function moreNodePathFromSourceRange(
|
||||||
node: UnboxedNode<
|
node:
|
||||||
| Expr
|
| Expr
|
||||||
| ImportStatement
|
| ImportStatement
|
||||||
| ExpressionStatement
|
| ExpressionStatement
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
| ReturnStatement
|
| ReturnStatement,
|
||||||
>,
|
|
||||||
sourceRange: Selection['range'],
|
sourceRange: Selection['range'],
|
||||||
previousPath: PathToNode = [['body', '']]
|
previousPath: PathToNode = [['body', '']]
|
||||||
): PathToNode {
|
): PathToNode {
|
||||||
@ -346,16 +344,15 @@ export function getNodePathFromSourceRange(
|
|||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
type KCLNode = UnboxedNode<
|
type KCLNode =
|
||||||
| Expr
|
| Expr
|
||||||
| ExpressionStatement
|
| ExpressionStatement
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
| VariableDeclarator
|
| VariableDeclarator
|
||||||
| ReturnStatement
|
| ReturnStatement
|
||||||
>
|
|
||||||
|
|
||||||
export function traverse(
|
export function traverse(
|
||||||
node: KCLNode | UnboxedNode<Program>,
|
node: KCLNode | Program,
|
||||||
option: {
|
option: {
|
||||||
enter?: (node: KCLNode, pathToNode: PathToNode) => void
|
enter?: (node: KCLNode, pathToNode: PathToNode) => void
|
||||||
leave?: (node: KCLNode) => void
|
leave?: (node: KCLNode) => void
|
||||||
@ -515,9 +512,9 @@ export function findAllPreviousVariables(
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReplacerFn = (
|
type ReplacerFn = (
|
||||||
_ast: UnboxedNode<Program>,
|
_ast: Program,
|
||||||
varName: string
|
varName: string
|
||||||
) => { modifiedAst: UnboxedNode<Program>; pathToReplaced: PathToNode } | Error
|
) => { modifiedAst: Program; pathToReplaced: PathToNode } | Error
|
||||||
|
|
||||||
export function isNodeSafeToReplacePath(
|
export function isNodeSafeToReplacePath(
|
||||||
ast: Program,
|
ast: Program,
|
||||||
@ -586,12 +583,12 @@ export function isNodeSafeToReplacePath(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isNodeSafeToReplace(
|
export function isNodeSafeToReplace(
|
||||||
ast: UnboxedNode<Program>,
|
ast: Program,
|
||||||
sourceRange: [number, number]
|
sourceRange: [number, number]
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
isSafe: boolean
|
isSafe: boolean
|
||||||
value: UnboxedNode<Expr>
|
value: Expr
|
||||||
replacer: ReplacerFn
|
replacer: ReplacerFn
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
@ -840,7 +837,7 @@ export function findUsesOfTagInPipe(
|
|||||||
? String(thirdParam.value)
|
? String(thirdParam.value)
|
||||||
: thirdParam.name
|
: thirdParam.name
|
||||||
|
|
||||||
const varDec = getNodeFromPath<UnboxedNode<VariableDeclaration>>(
|
const varDec = getNodeFromPath<VariableDeclaration>(
|
||||||
ast,
|
ast,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'VariableDeclaration'
|
'VariableDeclaration'
|
||||||
|
@ -50,6 +50,11 @@ export enum ExportIntent {
|
|||||||
Make = 'make',
|
Make = 'make',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ExportInfo {
|
||||||
|
intent: ExportIntent
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
|
||||||
type ClientMetrics = Models['ClientMetrics_type']
|
type ClientMetrics = Models['ClientMetrics_type']
|
||||||
|
|
||||||
interface WebRTCClientMetrics extends ClientMetrics {
|
interface WebRTCClientMetrics extends ClientMetrics {
|
||||||
@ -1354,7 +1359,7 @@ export class EngineCommandManager extends EventTarget {
|
|||||||
* export in progress. Otherwise it is an enum value of the intent.
|
* export in progress. Otherwise it is an enum value of the intent.
|
||||||
* Another export cannot be started if one is already in progress.
|
* Another export cannot be started if one is already in progress.
|
||||||
*/
|
*/
|
||||||
private _exportIntent: ExportIntent | null = null
|
private _exportInfo: ExportInfo | null = null
|
||||||
_commandLogCallBack: (command: CommandLog[]) => void = () => {}
|
_commandLogCallBack: (command: CommandLog[]) => void = () => {}
|
||||||
|
|
||||||
subscriptions: {
|
subscriptions: {
|
||||||
@ -1410,12 +1415,12 @@ export class EngineCommandManager extends EventTarget {
|
|||||||
(() => {}) as any
|
(() => {}) as any
|
||||||
kclManager: null | KclManager = null
|
kclManager: null | KclManager = null
|
||||||
|
|
||||||
set exportIntent(intent: ExportIntent | null) {
|
set exportInfo(info: ExportInfo | null) {
|
||||||
this._exportIntent = intent
|
this._exportInfo = info
|
||||||
}
|
}
|
||||||
|
|
||||||
get exportIntent() {
|
get exportInfo() {
|
||||||
return this._exportIntent
|
return this._exportInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
start({
|
start({
|
||||||
@ -1607,7 +1612,7 @@ export class EngineCommandManager extends EventTarget {
|
|||||||
// because in all other cases we send JSON strings. But in the case of
|
// because in all other cases we send JSON strings. But in the case of
|
||||||
// export we send a binary blob.
|
// export we send a binary blob.
|
||||||
// Pass this to our export function.
|
// Pass this to our export function.
|
||||||
if (this.exportIntent === null || this.pendingExport === undefined) {
|
if (this.exportInfo === null || this.pendingExport === undefined) {
|
||||||
toast.error(
|
toast.error(
|
||||||
'Export intent was not set, but export data was received'
|
'Export intent was not set, but export data was received'
|
||||||
)
|
)
|
||||||
@ -1617,7 +1622,7 @@ export class EngineCommandManager extends EventTarget {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (this.exportIntent) {
|
switch (this.exportInfo.intent) {
|
||||||
case ExportIntent.Save: {
|
case ExportIntent.Save: {
|
||||||
exportSave(event.data, this.pendingExport.toastId).then(() => {
|
exportSave(event.data, this.pendingExport.toastId).then(() => {
|
||||||
this.pendingExport?.resolve(null)
|
this.pendingExport?.resolve(null)
|
||||||
@ -1625,21 +1630,22 @@ export class EngineCommandManager extends EventTarget {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
case ExportIntent.Make: {
|
case ExportIntent.Make: {
|
||||||
exportMake(event.data, this.pendingExport.toastId).then(
|
exportMake(
|
||||||
(result) => {
|
event.data,
|
||||||
if (result) {
|
this.exportInfo.name,
|
||||||
this.pendingExport?.resolve(null)
|
this.pendingExport.toastId
|
||||||
} else {
|
).then((result) => {
|
||||||
this.pendingExport?.reject('Failed to make export')
|
if (result) {
|
||||||
}
|
this.pendingExport?.resolve(null)
|
||||||
},
|
} else {
|
||||||
this.pendingExport?.reject
|
this.pendingExport?.reject('Failed to make export')
|
||||||
)
|
}
|
||||||
|
}, this.pendingExport?.reject)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Set the export intent back to null.
|
// Set the export intent back to null.
|
||||||
this.exportIntent = null
|
this.exportInfo = null
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1953,15 +1959,15 @@ export class EngineCommandManager extends EventTarget {
|
|||||||
return Promise.resolve(null)
|
return Promise.resolve(null)
|
||||||
} else if (cmd.type === 'export') {
|
} else if (cmd.type === 'export') {
|
||||||
const promise = new Promise<null>((resolve, reject) => {
|
const promise = new Promise<null>((resolve, reject) => {
|
||||||
if (this.exportIntent === null) {
|
if (this.exportInfo === null) {
|
||||||
if (this.exportIntent === null) {
|
if (this.exportInfo === null) {
|
||||||
toast.error('Export intent was not set, but export is being sent')
|
toast.error('Export intent was not set, but export is being sent')
|
||||||
console.error('Export intent was not set, but export is being sent')
|
console.error('Export intent was not set, but export is being sent')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const toastId = toast.loading(
|
const toastId = toast.loading(
|
||||||
this.exportIntent === ExportIntent.Save
|
this.exportInfo.intent === ExportIntent.Save
|
||||||
? EXPORT_TOAST_MESSAGES.START
|
? EXPORT_TOAST_MESSAGES.START
|
||||||
: MAKE_TOAST_MESSAGES.START
|
: MAKE_TOAST_MESSAGES.START
|
||||||
)
|
)
|
||||||
@ -1975,7 +1981,7 @@ export class EngineCommandManager extends EventTarget {
|
|||||||
resolve(passThrough)
|
resolve(passThrough)
|
||||||
},
|
},
|
||||||
reject: (reason: string) => {
|
reject: (reason: string) => {
|
||||||
this.exportIntent = null
|
this.exportInfo = null
|
||||||
reject(reason)
|
reject(reason)
|
||||||
},
|
},
|
||||||
commandId: command.cmd_id,
|
commandId: command.cmd_id,
|
||||||
|
@ -17,7 +17,6 @@ import {
|
|||||||
import { getNodeFromPath, getNodePathFromSourceRange } from '../queryAst'
|
import { getNodeFromPath, getNodePathFromSourceRange } from '../queryAst'
|
||||||
import { enginelessExecutor } from '../../lib/testHelpers'
|
import { enginelessExecutor } from '../../lib/testHelpers'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
const eachQuad: [number, [number, number]][] = [
|
const eachQuad: [number, [number, number]][] = [
|
||||||
[-315, [1, 1]],
|
[-315, [1, 1]],
|
||||||
@ -688,7 +687,7 @@ describe('testing getConstraintInfo', () => {
|
|||||||
]
|
]
|
||||||
if (err(ast)) return ast
|
if (err(ast)) return ast
|
||||||
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
||||||
const callExp = getNodeFromPath<UnboxedNode<CallExpression>>(
|
const callExp = getNodeFromPath<CallExpression>(
|
||||||
ast,
|
ast,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -842,7 +841,7 @@ describe('testing getConstraintInfo', () => {
|
|||||||
]
|
]
|
||||||
if (err(ast)) return ast
|
if (err(ast)) return ast
|
||||||
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
||||||
const callExp = getNodeFromPath<UnboxedNode<CallExpression>>(
|
const callExp = getNodeFromPath<CallExpression>(
|
||||||
ast,
|
ast,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -1198,7 +1197,7 @@ describe('testing getConstraintInfo', () => {
|
|||||||
]
|
]
|
||||||
if (err(ast)) return ast
|
if (err(ast)) return ast
|
||||||
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
||||||
const callExp = getNodeFromPath<UnboxedNode<CallExpression>>(
|
const callExp = getNodeFromPath<CallExpression>(
|
||||||
ast,
|
ast,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
|
@ -55,7 +55,6 @@ import { err } from 'lib/trap'
|
|||||||
import { perpendicularDistance } from 'sketch-helpers'
|
import { perpendicularDistance } from 'sketch-helpers'
|
||||||
import { TagDeclarator } from 'wasm-lib/kcl/bindings/TagDeclarator'
|
import { TagDeclarator } from 'wasm-lib/kcl/bindings/TagDeclarator'
|
||||||
import { EdgeCutInfo } from 'machines/modelingMachine'
|
import { EdgeCutInfo } from 'machines/modelingMachine'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
const STRAIGHT_SEGMENT_ERR = new Error(
|
const STRAIGHT_SEGMENT_ERR = new Error(
|
||||||
'Invalid input, expected "straight-segment"'
|
'Invalid input, expected "straight-segment"'
|
||||||
@ -1786,8 +1785,7 @@ export const angledLineThatIntersects: SketchLineHelper = {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (intersectTag !== -1) {
|
if (intersectTag !== -1) {
|
||||||
const tag = firstArg.properties[intersectTag]
|
const tag = firstArg.properties[intersectTag]?.value as Identifier
|
||||||
?.value as UnboxedNode<Identifier>
|
|
||||||
const pathToTagProp: PathToNode = [
|
const pathToTagProp: PathToNode = [
|
||||||
...pathToObjectExp,
|
...pathToObjectExp,
|
||||||
[intersectTag, 'index'],
|
[intersectTag, 'index'],
|
||||||
@ -1827,9 +1825,7 @@ export const updateStartProfileAtArgs: SketchLineHelper['updateArgs'] = ({
|
|||||||
body: [],
|
body: [],
|
||||||
|
|
||||||
nonCodeMeta: {
|
nonCodeMeta: {
|
||||||
start: 0,
|
start: [],
|
||||||
end: 0,
|
|
||||||
startNodes: [],
|
|
||||||
nonCodeNodes: [],
|
nonCodeNodes: [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1869,7 +1865,7 @@ export const sketchLineHelperMap: { [key: string]: SketchLineHelper } = {
|
|||||||
} as const
|
} as const
|
||||||
|
|
||||||
export function changeSketchArguments(
|
export function changeSketchArguments(
|
||||||
node: UnboxedNode<Program>,
|
node: Program,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
sourceRangeOrPath:
|
sourceRangeOrPath:
|
||||||
| {
|
| {
|
||||||
@ -1881,7 +1877,7 @@ export function changeSketchArguments(
|
|||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
},
|
},
|
||||||
input: SegmentInputs
|
input: SegmentInputs
|
||||||
): { modifiedAst: UnboxedNode<Program>; pathToNode: PathToNode } | Error {
|
): { modifiedAst: Program; pathToNode: PathToNode } | Error {
|
||||||
const _node = { ...node }
|
const _node = { ...node }
|
||||||
const thePath =
|
const thePath =
|
||||||
sourceRangeOrPath.type === 'sourceRange'
|
sourceRangeOrPath.type === 'sourceRange'
|
||||||
@ -1910,7 +1906,7 @@ export function changeSketchArguments(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getConstraintInfo(
|
export function getConstraintInfo(
|
||||||
callExpression: UnboxedNode<CallExpression>,
|
callExpression: CallExpression,
|
||||||
code: string,
|
code: string,
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
): ConstrainInfo[] {
|
): ConstrainInfo[] {
|
||||||
@ -1948,7 +1944,7 @@ export function compareVec2Epsilon2(
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface CreateLineFnCallArgs {
|
interface CreateLineFnCallArgs {
|
||||||
node: UnboxedNode<Program>
|
node: Program
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
input: SegmentInputs
|
input: SegmentInputs
|
||||||
fnName: ToolTip
|
fnName: ToolTip
|
||||||
@ -1965,7 +1961,7 @@ export function addNewSketchLn({
|
|||||||
spliceBetween = false,
|
spliceBetween = false,
|
||||||
}: CreateLineFnCallArgs):
|
}: CreateLineFnCallArgs):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
@ -1975,12 +1971,8 @@ export function addNewSketchLn({
|
|||||||
return new Error('not a sketch line helper')
|
return new Error('not a sketch line helper')
|
||||||
}
|
}
|
||||||
|
|
||||||
getNodeFromPath<UnboxedNode<VariableDeclarator>>(
|
getNodeFromPath<VariableDeclarator>(node, pathToNode, 'VariableDeclarator')
|
||||||
node,
|
getNodeFromPath<PipeExpression | CallExpression>(
|
||||||
pathToNode,
|
|
||||||
'VariableDeclarator'
|
|
||||||
)
|
|
||||||
getNodeFromPath<UnboxedNode<PipeExpression | CallExpression>>(
|
|
||||||
node,
|
node,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'PipeExpression'
|
'PipeExpression'
|
||||||
@ -1999,13 +1991,13 @@ export function addCallExpressionsToPipe({
|
|||||||
pathToNode,
|
pathToNode,
|
||||||
expressions,
|
expressions,
|
||||||
}: {
|
}: {
|
||||||
node: UnboxedNode<Program>
|
node: Program
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
expressions: UnboxedNode<CallExpression>[]
|
expressions: CallExpression[]
|
||||||
}) {
|
}) {
|
||||||
const _node = { ...node }
|
const _node = { ...node }
|
||||||
const pipeExpression = getNodeFromPath<UnboxedNode<PipeExpression>>(
|
const pipeExpression = getNodeFromPath<PipeExpression>(
|
||||||
_node,
|
_node,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'PipeExpression'
|
'PipeExpression'
|
||||||
@ -2054,7 +2046,7 @@ export function replaceSketchLine({
|
|||||||
replaceExistingCallback,
|
replaceExistingCallback,
|
||||||
referencedSegment,
|
referencedSegment,
|
||||||
}: {
|
}: {
|
||||||
node: UnboxedNode<Program>
|
node: Program
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
fnName: ToolTip
|
fnName: ToolTip
|
||||||
@ -2063,7 +2055,7 @@ export function replaceSketchLine({
|
|||||||
referencedSegment?: Path
|
referencedSegment?: Path
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
valueUsedInTransform?: number
|
valueUsedInTransform?: number
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
}
|
}
|
||||||
@ -2115,7 +2107,7 @@ function addTagToChamfer(
|
|||||||
edgeCutMeta: EdgeCutInfo | null
|
edgeCutMeta: EdgeCutInfo | null
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
tag: string
|
tag: string
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
@ -2242,7 +2234,7 @@ export function addTagForSketchOnFace(
|
|||||||
edgeCutMeta: EdgeCutInfo | null
|
edgeCutMeta: EdgeCutInfo | null
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
tag: string
|
tag: string
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
@ -2280,14 +2272,12 @@ function isAngleLiteral(lineArugement: Expr): boolean {
|
|||||||
: false
|
: false
|
||||||
}
|
}
|
||||||
|
|
||||||
type addTagFn = (
|
type addTagFn = (a: AddTagInfo) => { modifiedAst: Program; tag: string } | Error
|
||||||
a: AddTagInfo
|
|
||||||
) => { modifiedAst: UnboxedNode<Program>; tag: string } | Error
|
|
||||||
|
|
||||||
function addTag(tagIndex = 2): addTagFn {
|
function addTag(tagIndex = 2): addTagFn {
|
||||||
return ({ node, pathToNode }) => {
|
return ({ node, pathToNode }) => {
|
||||||
const _node = { ...node }
|
const _node = { ...node }
|
||||||
const callExpr = getNodeFromPath<UnboxedNode<CallExpression>>(
|
const callExpr = getNodeFromPath<CallExpression>(
|
||||||
_node,
|
_node,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
|
@ -49,7 +49,6 @@ import {
|
|||||||
getSketchSegmentFromSourceRange,
|
getSketchSegmentFromSourceRange,
|
||||||
} from './sketchConstraints'
|
} from './sketchConstraints'
|
||||||
import { getAngle, roundOff, normaliseAngle } from '../../lib/utils'
|
import { getAngle, roundOff, normaliseAngle } from '../../lib/utils'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
export type LineInputsType =
|
export type LineInputsType =
|
||||||
| 'xAbsolute'
|
| 'xAbsolute'
|
||||||
@ -326,7 +325,7 @@ const setHorzVertDistanceCreateNode =
|
|||||||
if (isUndef(refNum) || err(literalArg)) return REF_NUM_ERR
|
if (isUndef(refNum) || err(literalArg)) return REF_NUM_ERR
|
||||||
|
|
||||||
const valueUsedInTransform = roundOff(literalArg - refNum, 2)
|
const valueUsedInTransform = roundOff(literalArg - refNum, 2)
|
||||||
let finalValue: UnboxedNode<Expr> = createBinaryExpressionWithUnary([
|
let finalValue: Expr = createBinaryExpressionWithUnary([
|
||||||
createSegEnd(referenceSegName, !index),
|
createSegEnd(referenceSegName, !index),
|
||||||
forceValueUsedInTransform || createLiteral(valueUsedInTransform),
|
forceValueUsedInTransform || createLiteral(valueUsedInTransform),
|
||||||
])
|
])
|
||||||
@ -1542,7 +1541,7 @@ export function transformSecondarySketchLinesTagFirst({
|
|||||||
forceSegName,
|
forceSegName,
|
||||||
forceValueUsedInTransform,
|
forceValueUsedInTransform,
|
||||||
}: {
|
}: {
|
||||||
ast: UnboxedNode<Program>
|
ast: Program
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections
|
||||||
transformInfos: TransformInfo[]
|
transformInfos: TransformInfo[]
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
@ -1550,7 +1549,7 @@ export function transformSecondarySketchLinesTagFirst({
|
|||||||
forceValueUsedInTransform?: BinaryPart
|
forceValueUsedInTransform?: BinaryPart
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
valueUsedInTransform?: number
|
valueUsedInTransform?: number
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
tagInfo: {
|
tagInfo: {
|
||||||
@ -1621,7 +1620,7 @@ export function transformAstSketchLines({
|
|||||||
forceValueUsedInTransform,
|
forceValueUsedInTransform,
|
||||||
referencedSegmentRange,
|
referencedSegmentRange,
|
||||||
}: {
|
}: {
|
||||||
ast: UnboxedNode<Program>
|
ast: Program
|
||||||
selectionRanges: Selections | PathToNode[]
|
selectionRanges: Selections | PathToNode[]
|
||||||
transformInfos: TransformInfo[]
|
transformInfos: TransformInfo[]
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
@ -1630,7 +1629,7 @@ export function transformAstSketchLines({
|
|||||||
referencedSegmentRange?: Selection['range']
|
referencedSegmentRange?: Selection['range']
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
valueUsedInTransform?: number
|
valueUsedInTransform?: number
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}
|
}
|
||||||
@ -1648,7 +1647,7 @@ export function transformAstSketchLines({
|
|||||||
|
|
||||||
const getNode = getNodeFromPathCurry(node, _pathToNode)
|
const getNode = getNodeFromPathCurry(node, _pathToNode)
|
||||||
|
|
||||||
const callExp = getNode<UnboxedNode<CallExpression>>('CallExpression')
|
const callExp = getNode<CallExpression>('CallExpression')
|
||||||
if (err(callExp)) return callExp
|
if (err(callExp)) return callExp
|
||||||
const varDec = getNode<VariableDeclarator>('VariableDeclarator')
|
const varDec = getNode<VariableDeclarator>('VariableDeclarator')
|
||||||
if (err(varDec)) return varDec
|
if (err(varDec)) return varDec
|
||||||
@ -1807,16 +1806,13 @@ function createSegAngle(referenceSegName: string): BinaryPart {
|
|||||||
return createCallExpression('segAng', [createIdentifier(referenceSegName)])
|
return createCallExpression('segAng', [createIdentifier(referenceSegName)])
|
||||||
}
|
}
|
||||||
|
|
||||||
function createSegEnd(
|
function createSegEnd(referenceSegName: string, isX: boolean): CallExpression {
|
||||||
referenceSegName: string,
|
|
||||||
isX: boolean
|
|
||||||
): UnboxedNode<CallExpression> {
|
|
||||||
return createCallExpression(isX ? 'segEndX' : 'segEndY', [
|
return createCallExpression(isX ? 'segEndX' : 'segEndY', [
|
||||||
createIdentifier(referenceSegName),
|
createIdentifier(referenceSegName),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
function createLastSeg(isX: boolean): UnboxedNode<CallExpression> {
|
function createLastSeg(isX: boolean): CallExpression {
|
||||||
return createCallExpression(isX ? 'lastSegX' : 'lastSegY', [
|
return createCallExpression(isX ? 'lastSegX' : 'lastSegY', [
|
||||||
createPipeSubstitution(),
|
createPipeSubstitution(),
|
||||||
])
|
])
|
||||||
@ -1834,7 +1830,7 @@ export function getConstraintLevelFromSourceRange(
|
|||||||
ast: Program | Error
|
ast: Program | Error
|
||||||
): Error | { range: [number, number]; level: ConstraintLevel } {
|
): Error | { range: [number, number]; level: ConstraintLevel } {
|
||||||
if (err(ast)) return ast
|
if (err(ast)) return ast
|
||||||
const nodeMeta = getNodeFromPath<UnboxedNode<CallExpression>>(
|
const nodeMeta = getNodeFromPath<CallExpression>(
|
||||||
ast,
|
ast,
|
||||||
getNodePathFromSourceRange(ast, cursorRange),
|
getNodePathFromSourceRange(ast, cursorRange),
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
|
@ -11,17 +11,16 @@ import {
|
|||||||
BinaryPart,
|
BinaryPart,
|
||||||
} from '../wasm'
|
} from '../wasm'
|
||||||
import { LineInputsType } from './sketchcombos'
|
import { LineInputsType } from './sketchcombos'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
export interface ModifyAstBase {
|
export interface ModifyAstBase {
|
||||||
node: UnboxedNode<Program>
|
node: Program
|
||||||
// TODO #896: Remove ProgramMemory from this interface
|
// TODO #896: Remove ProgramMemory from this interface
|
||||||
previousProgramMemory: ProgramMemory
|
previousProgramMemory: ProgramMemory
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AddTagInfo {
|
export interface AddTagInfo {
|
||||||
node: UnboxedNode<Program>
|
node: Program
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +134,7 @@ type _InputArg<T> =
|
|||||||
* Which is why a union type is used that can be type narrowed using the {@link RawArg.type} property
|
* Which is why a union type is used that can be type narrowed using the {@link RawArg.type} property
|
||||||
* {@link RawArg.expr} is common to all of these types
|
* {@link RawArg.expr} is common to all of these types
|
||||||
*/
|
*/
|
||||||
export type InputArg = _InputArg<UnboxedNode<Expr>>
|
export type InputArg = _InputArg<Expr>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link RawArg.expr} is the literal equivalent of whatever current expression is
|
* {@link RawArg.expr} is the literal equivalent of whatever current expression is
|
||||||
@ -143,7 +142,7 @@ export type InputArg = _InputArg<UnboxedNode<Expr>>
|
|||||||
* but of course works for expressions like myVar + someFn() etc too
|
* but of course works for expressions like myVar + someFn() etc too
|
||||||
* This is useful in cases where we want to "un-constrain" inputs to segments
|
* This is useful in cases where we want to "un-constrain" inputs to segments
|
||||||
*/
|
*/
|
||||||
type RawArg = _InputArg<UnboxedNode<Literal>>
|
type RawArg = _InputArg<Literal>
|
||||||
|
|
||||||
export type InputArgs = Array<InputArg>
|
export type InputArgs = Array<InputArg>
|
||||||
|
|
||||||
@ -187,7 +186,7 @@ export type CreateStdLibSketchCallExpr = (args: {
|
|||||||
inputs: InputArgs
|
inputs: InputArgs
|
||||||
rawArgs: RawArgs
|
rawArgs: RawArgs
|
||||||
referenceSegName: string
|
referenceSegName: string
|
||||||
tag?: UnboxedNode<Expr>
|
tag?: Expr
|
||||||
forceValueUsedInTransform?: BinaryPart
|
forceValueUsedInTransform?: BinaryPart
|
||||||
referencedSegment?: Path
|
referencedSegment?: Path
|
||||||
}) => CreatedSketchExprResult | Error
|
}) => CreatedSketchExprResult | Error
|
||||||
@ -216,26 +215,26 @@ export interface ConstrainInfo {
|
|||||||
export interface SketchLineHelper {
|
export interface SketchLineHelper {
|
||||||
add: (a: addCall) =>
|
add: (a: addCall) =>
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
valueUsedInTransform?: number
|
valueUsedInTransform?: number
|
||||||
}
|
}
|
||||||
| Error
|
| Error
|
||||||
updateArgs: (a: updateArgs) =>
|
updateArgs: (a: updateArgs) =>
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
}
|
}
|
||||||
| Error
|
| Error
|
||||||
getTag: (a: CallExpression) => string | Error
|
getTag: (a: CallExpression) => string | Error
|
||||||
addTag: (a: AddTagInfo) =>
|
addTag: (a: AddTagInfo) =>
|
||||||
| {
|
| {
|
||||||
modifiedAst: UnboxedNode<Program>
|
modifiedAst: Program
|
||||||
tag: string
|
tag: string
|
||||||
}
|
}
|
||||||
| Error
|
| Error
|
||||||
getConstraintInfo: (
|
getConstraintInfo: (
|
||||||
callExp: UnboxedNode<CallExpression>,
|
callExp: CallExpression,
|
||||||
code: string,
|
code: string,
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
) => ConstrainInfo[]
|
) => ConstrainInfo[]
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
import { err } from 'lib/trap'
|
|
||||||
import { parse } from './wasm'
|
|
||||||
import { enginelessExecutor } from 'lib/testHelpers'
|
|
||||||
|
|
||||||
it('can execute parsed AST', async () => {
|
|
||||||
const code = `x = 1
|
|
||||||
// A comment.`
|
|
||||||
const ast = parse(code)
|
|
||||||
expect(err(ast)).toEqual(false)
|
|
||||||
const execState = await enginelessExecutor(ast)
|
|
||||||
expect(err(ast)).toEqual(false)
|
|
||||||
expect(execState.memory.get('x')).toEqual(1)
|
|
||||||
})
|
|
@ -42,7 +42,6 @@ import { ExecState as RawExecState } from '../wasm-lib/kcl/bindings/ExecState'
|
|||||||
import { ProgramMemory as RawProgramMemory } from '../wasm-lib/kcl/bindings/ProgramMemory'
|
import { ProgramMemory as RawProgramMemory } from '../wasm-lib/kcl/bindings/ProgramMemory'
|
||||||
import { EnvironmentRef } from '../wasm-lib/kcl/bindings/EnvironmentRef'
|
import { EnvironmentRef } from '../wasm-lib/kcl/bindings/EnvironmentRef'
|
||||||
import { Environment } from '../wasm-lib/kcl/bindings/Environment'
|
import { Environment } from '../wasm-lib/kcl/bindings/Environment'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
export type { Program } from '../wasm-lib/kcl/bindings/Program'
|
export type { Program } from '../wasm-lib/kcl/bindings/Program'
|
||||||
export type { Expr } from '../wasm-lib/kcl/bindings/Expr'
|
export type { Expr } from '../wasm-lib/kcl/bindings/Expr'
|
||||||
@ -111,6 +110,7 @@ const initialise = async () => {
|
|||||||
const fullUrl = wasmUrl()
|
const fullUrl = wasmUrl()
|
||||||
const input = await fetch(fullUrl)
|
const input = await fetch(fullUrl)
|
||||||
const buffer = await input.arrayBuffer()
|
const buffer = await input.arrayBuffer()
|
||||||
|
|
||||||
return await init(buffer)
|
return await init(buffer)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error initialising WASM', e)
|
console.log('Error initialising WASM', e)
|
||||||
@ -123,11 +123,11 @@ export const initPromise = initialise()
|
|||||||
export const rangeTypeFix = (ranges: number[][]): [number, number][] =>
|
export const rangeTypeFix = (ranges: number[][]): [number, number][] =>
|
||||||
ranges.map(([start, end]) => [start, end])
|
ranges.map(([start, end]) => [start, end])
|
||||||
|
|
||||||
export const parse = (code: string | Error): UnboxedNode<Program> | Error => {
|
export const parse = (code: string | Error): Program | Error => {
|
||||||
if (err(code)) return code
|
if (err(code)) return code
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const program: UnboxedNode<Program> = parse_wasm(code)
|
const program: Program = parse_wasm(code)
|
||||||
return program
|
return program
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
// throw e
|
// throw e
|
||||||
@ -379,7 +379,7 @@ export function sketchFromKclValue(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const executor = async (
|
export const executor = async (
|
||||||
node: UnboxedNode<Program>,
|
node: Program,
|
||||||
programMemory: ProgramMemory | Error = ProgramMemory.empty(),
|
programMemory: ProgramMemory | Error = ProgramMemory.empty(),
|
||||||
idGenerator: IdGenerator = defaultIdGenerator(),
|
idGenerator: IdGenerator = defaultIdGenerator(),
|
||||||
engineCommandManager: EngineCommandManager,
|
engineCommandManager: EngineCommandManager,
|
||||||
@ -403,7 +403,7 @@ export const executor = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const _executor = async (
|
export const _executor = async (
|
||||||
node: UnboxedNode<Program>,
|
node: Program,
|
||||||
programMemory: ProgramMemory | Error = ProgramMemory.empty(),
|
programMemory: ProgramMemory | Error = ProgramMemory.empty(),
|
||||||
idGenerator: IdGenerator = defaultIdGenerator(),
|
idGenerator: IdGenerator = defaultIdGenerator(),
|
||||||
engineCommandManager: EngineCommandManager,
|
engineCommandManager: EngineCommandManager,
|
||||||
@ -494,13 +494,13 @@ export function lexer(str: string): Token[] | Error {
|
|||||||
|
|
||||||
export const modifyAstForSketch = async (
|
export const modifyAstForSketch = async (
|
||||||
engineCommandManager: EngineCommandManager,
|
engineCommandManager: EngineCommandManager,
|
||||||
ast: UnboxedNode<Program>,
|
ast: Program,
|
||||||
variableName: string,
|
variableName: string,
|
||||||
currentPlane: string,
|
currentPlane: string,
|
||||||
engineId: string
|
engineId: string
|
||||||
): Promise<UnboxedNode<Program>> => {
|
): Promise<Program> => {
|
||||||
try {
|
try {
|
||||||
const updatedAst: UnboxedNode<Program> = await modify_ast_for_sketch_wasm(
|
const updatedAst: Program = await modify_ast_for_sketch_wasm(
|
||||||
engineCommandManager,
|
engineCommandManager,
|
||||||
JSON.stringify(ast),
|
JSON.stringify(ast),
|
||||||
variableName,
|
variableName,
|
||||||
|
@ -5,7 +5,6 @@ import { Selection } from './selections'
|
|||||||
import { Identifier, Expr, VariableDeclaration } from 'lang/wasm'
|
import { Identifier, Expr, VariableDeclaration } from 'lang/wasm'
|
||||||
import { commandBarMachine } from 'machines/commandBarMachine'
|
import { commandBarMachine } from 'machines/commandBarMachine'
|
||||||
import { ReactNode } from 'react'
|
import { ReactNode } from 'react'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
type Icon = CustomIconName
|
type Icon = CustomIconName
|
||||||
const PLATFORMS = ['both', 'web', 'desktop'] as const
|
const PLATFORMS = ['both', 'web', 'desktop'] as const
|
||||||
@ -24,8 +23,8 @@ export interface KclExpression {
|
|||||||
}
|
}
|
||||||
export interface KclExpressionWithVariable extends KclExpression {
|
export interface KclExpressionWithVariable extends KclExpression {
|
||||||
variableName: string
|
variableName: string
|
||||||
variableDeclarationAst: UnboxedNode<VariableDeclaration>
|
variableDeclarationAst: VariableDeclaration
|
||||||
variableIdentifierAst: UnboxedNode<Identifier>
|
variableIdentifierAst: Identifier
|
||||||
insertIndex: number
|
insertIndex: number
|
||||||
}
|
}
|
||||||
export type KclCommandValue = KclExpression | KclExpressionWithVariable
|
export type KclCommandValue = KclExpression | KclExpressionWithVariable
|
||||||
|
@ -92,6 +92,7 @@ export const MAKE_TOAST_MESSAGES = {
|
|||||||
NO_MACHINE_API_IP: 'No machine api ip available',
|
NO_MACHINE_API_IP: 'No machine api ip available',
|
||||||
NO_CURRENT_MACHINE: 'No current machine available',
|
NO_CURRENT_MACHINE: 'No current machine available',
|
||||||
NO_MACHINE_ID: 'No machine id available',
|
NO_MACHINE_ID: 'No machine id available',
|
||||||
|
NO_NAME: 'No name provided',
|
||||||
ERROR_STARTING_PRINT: 'Error while starting print',
|
ERROR_STARTING_PRINT: 'Error while starting print',
|
||||||
SUCCESS: 'Started print successfully',
|
SUCCESS: 'Started print successfully',
|
||||||
}
|
}
|
||||||
|
31
src/lib/engineUtils.ts
Normal file
31
src/lib/engineUtils.ts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import EngineUtils from '@engine-utils'
|
||||||
|
|
||||||
|
type KCEngineUtilsEvaluatePath = {
|
||||||
|
(sketch: string, t: number): string
|
||||||
|
}
|
||||||
|
let kcEngineUtilsEvaluatePath: KCEngineUtilsEvaluatePath
|
||||||
|
|
||||||
|
export async function init() {
|
||||||
|
return await new Promise((resolve, reject) => {
|
||||||
|
try {
|
||||||
|
EngineUtils().then((module) => {
|
||||||
|
kcEngineUtilsEvaluatePath = module.cwrap(
|
||||||
|
'kcEngineUtilsEvaluatePath',
|
||||||
|
'string',
|
||||||
|
['string', 'number']
|
||||||
|
)
|
||||||
|
resolve(true)
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
reject(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getTruePathEndPos(sketch: string) {
|
||||||
|
if (!kcEngineUtilsEvaluatePath) {
|
||||||
|
await init()
|
||||||
|
}
|
||||||
|
|
||||||
|
return kcEngineUtilsEvaluatePath(sketch, 1.0)
|
||||||
|
}
|
@ -8,8 +8,15 @@ import { MAKE_TOAST_MESSAGES } from './constants'
|
|||||||
// Make files locally from an export call.
|
// Make files locally from an export call.
|
||||||
export async function exportMake(
|
export async function exportMake(
|
||||||
data: ArrayBuffer,
|
data: ArrayBuffer,
|
||||||
|
name: string,
|
||||||
toastId: string
|
toastId: string
|
||||||
): Promise<Response | null> {
|
): Promise<Response | null> {
|
||||||
|
if (name === '') {
|
||||||
|
console.error(MAKE_TOAST_MESSAGES.NO_NAME)
|
||||||
|
toast.error(MAKE_TOAST_MESSAGES.NO_NAME, { id: toastId })
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
if (machineManager.machineCount() === 0) {
|
if (machineManager.machineCount() === 0) {
|
||||||
console.error(MAKE_TOAST_MESSAGES.NO_MACHINES)
|
console.error(MAKE_TOAST_MESSAGES.NO_MACHINES)
|
||||||
toast.error(MAKE_TOAST_MESSAGES.NO_MACHINES, { id: toastId })
|
toast.error(MAKE_TOAST_MESSAGES.NO_MACHINES, { id: toastId })
|
||||||
@ -39,7 +46,7 @@ export async function exportMake(
|
|||||||
|
|
||||||
const params: components['schemas']['PrintParameters'] = {
|
const params: components['schemas']['PrintParameters'] = {
|
||||||
machine_id: machineId,
|
machine_id: machineId,
|
||||||
job_name: 'Exported Job', // TODO: make this the project name.
|
job_name: name,
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
console.log('params', params)
|
console.log('params', params)
|
||||||
|
@ -36,7 +36,6 @@ import {
|
|||||||
getWallCodeRef,
|
getWallCodeRef,
|
||||||
ArtifactId,
|
ArtifactId,
|
||||||
} from 'lang/std/artifactGraph'
|
} from 'lang/std/artifactGraph'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
export const X_AXIS_UUID = 'ad792545-7fd3-482a-a602-a93924e3055b'
|
export const X_AXIS_UUID = 'ad792545-7fd3-482a-a602-a93924e3055b'
|
||||||
export const Y_AXIS_UUID = '680fd157-266f-4b8a-984f-cdf46b8bdf01'
|
export const Y_AXIS_UUID = '680fd157-266f-4b8a-984f-cdf46b8bdf01'
|
||||||
@ -245,7 +244,7 @@ export function getEventForSegmentSelection(
|
|||||||
const updatedAst = parse(codeManager.code)
|
const updatedAst = parse(codeManager.code)
|
||||||
if (err(updatedAst)) return null
|
if (err(updatedAst)) return null
|
||||||
|
|
||||||
const nodeMeta = getNodeFromPath<UnboxedNode<CallExpression>>(
|
const nodeMeta = getNodeFromPath<CallExpression>(
|
||||||
updatedAst,
|
updatedAst,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -363,7 +362,7 @@ function updateSceneObjectColors(codeBasedSelections: Selection[]) {
|
|||||||
|
|
||||||
Object.values(sceneEntitiesManager.activeSegments).forEach((segmentGroup) => {
|
Object.values(sceneEntitiesManager.activeSegments).forEach((segmentGroup) => {
|
||||||
if (!SEGMENT_BODIES_PLUS_PROFILE_START.includes(segmentGroup?.name)) return
|
if (!SEGMENT_BODIES_PLUS_PROFILE_START.includes(segmentGroup?.name)) return
|
||||||
const nodeMeta = getNodeFromPath<UnboxedNode<CallExpression>>(
|
const nodeMeta = getNodeFromPath<CallExpression>(
|
||||||
updated,
|
updated,
|
||||||
segmentGroup.userData.pathToNode,
|
segmentGroup.userData.pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
|
@ -17,7 +17,6 @@ import { DefaultPlanes } from 'wasm-lib/kcl/bindings/DefaultPlanes'
|
|||||||
import { err, reportRejection } from 'lib/trap'
|
import { err, reportRejection } from 'lib/trap'
|
||||||
import { toSync } from './utils'
|
import { toSync } from './utils'
|
||||||
import { IdGenerator } from 'wasm-lib/kcl/bindings/IdGenerator'
|
import { IdGenerator } from 'wasm-lib/kcl/bindings/IdGenerator'
|
||||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
|
||||||
|
|
||||||
type WebSocketResponse = Models['WebSocketResponse_type']
|
type WebSocketResponse = Models['WebSocketResponse_type']
|
||||||
|
|
||||||
@ -85,7 +84,7 @@ class MockEngineCommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function enginelessExecutor(
|
export async function enginelessExecutor(
|
||||||
ast: UnboxedNode<Program> | Error,
|
ast: Program | Error,
|
||||||
pm: ProgramMemory | Error = ProgramMemory.empty(),
|
pm: ProgramMemory | Error = ProgramMemory.empty(),
|
||||||
idGenerator: IdGenerator = defaultIdGenerator()
|
idGenerator: IdGenerator = defaultIdGenerator()
|
||||||
): Promise<ExecState> {
|
): Promise<ExecState> {
|
||||||
@ -110,7 +109,7 @@ export async function enginelessExecutor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function executor(
|
export async function executor(
|
||||||
ast: UnboxedNode<Program>,
|
ast: Program,
|
||||||
pm: ProgramMemory = ProgramMemory.empty(),
|
pm: ProgramMemory = ProgramMemory.empty(),
|
||||||
idGenerator: IdGenerator = defaultIdGenerator()
|
idGenerator: IdGenerator = defaultIdGenerator()
|
||||||
): Promise<ExecState> {
|
): Promise<ExecState> {
|
||||||
|
12
src/wasm-lib/Cargo.lock
generated
12
src/wasm-lib/Cargo.lock
generated
@ -121,9 +121,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.89"
|
version = "1.0.91"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"
|
checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
]
|
]
|
||||||
@ -1684,9 +1684,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kittycad-modeling-cmds"
|
name = "kittycad-modeling-cmds"
|
||||||
version = "0.2.68"
|
version = "0.2.70"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7e3aedfcc1d8ea9995ec3eb78a6743c585c9380475c48701797f107489b696aa"
|
checksum = "b135696d07a4fab928e5abace4dd05f4976eafab5d73e5747a85dc5a684b936c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
@ -3005,9 +3005,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.128"
|
version = "1.0.132"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
|
checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap 2.6.0",
|
"indexmap 2.6.0",
|
||||||
"itoa",
|
"itoa",
|
||||||
|
@ -72,7 +72,7 @@ members = [
|
|||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
http = "1"
|
http = "1"
|
||||||
kittycad = { version = "0.3.23", default-features = false, features = ["js", "requests"] }
|
kittycad = { version = "0.3.23", default-features = false, features = ["js", "requests"] }
|
||||||
kittycad-modeling-cmds = { version = "0.2.68", features = ["websocket"] }
|
kittycad-modeling-cmds = { version = "0.2.70", features = ["websocket"] }
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "executor"
|
name = "executor"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
use kcl_lib::ast::types::{
|
use kcl_lib::ast::types::{
|
||||||
BodyItem, Expr, Identifier, ItemVisibility, Literal, LiteralValue, Program, UnboxedNode, VariableDeclaration,
|
BodyItem, Expr, Identifier, ItemVisibility, Literal, LiteralValue, NonCodeMeta, Program, VariableDeclaration,
|
||||||
VariableDeclarator, VariableKind,
|
VariableDeclarator, VariableKind,
|
||||||
};
|
};
|
||||||
use kcl_macros::parse;
|
use kcl_macros::parse;
|
||||||
@ -9,46 +9,36 @@ use pretty_assertions::assert_eq;
|
|||||||
#[test]
|
#[test]
|
||||||
fn basic() {
|
fn basic() {
|
||||||
let actual = parse!("const y = 4");
|
let actual = parse!("const y = 4");
|
||||||
let expected = UnboxedNode {
|
let expected = Program {
|
||||||
inner: Program {
|
|
||||||
body: vec![BodyItem::VariableDeclaration(UnboxedNode::new(
|
|
||||||
VariableDeclaration {
|
|
||||||
declarations: vec![UnboxedNode::new(
|
|
||||||
VariableDeclarator {
|
|
||||||
id: UnboxedNode::new(
|
|
||||||
Identifier {
|
|
||||||
name: "y".to_owned(),
|
|
||||||
digest: None,
|
|
||||||
},
|
|
||||||
6,
|
|
||||||
7,
|
|
||||||
),
|
|
||||||
init: Expr::Literal(UnboxedNode::new(
|
|
||||||
Literal {
|
|
||||||
value: LiteralValue::IInteger(4),
|
|
||||||
raw: "4".to_owned(),
|
|
||||||
digest: None,
|
|
||||||
},
|
|
||||||
10,
|
|
||||||
11,
|
|
||||||
)),
|
|
||||||
digest: None,
|
|
||||||
},
|
|
||||||
6,
|
|
||||||
11,
|
|
||||||
)],
|
|
||||||
visibility: ItemVisibility::Default,
|
|
||||||
kind: VariableKind::Const,
|
|
||||||
digest: None,
|
|
||||||
},
|
|
||||||
0,
|
|
||||||
11,
|
|
||||||
))],
|
|
||||||
non_code_meta: Default::default(),
|
|
||||||
digest: None,
|
|
||||||
},
|
|
||||||
start: 0,
|
start: 0,
|
||||||
end: 11,
|
end: 11,
|
||||||
|
body: vec![BodyItem::VariableDeclaration(Box::new(VariableDeclaration {
|
||||||
|
start: 0,
|
||||||
|
end: 11,
|
||||||
|
declarations: vec![VariableDeclarator {
|
||||||
|
start: 6,
|
||||||
|
end: 11,
|
||||||
|
id: Identifier {
|
||||||
|
start: 6,
|
||||||
|
end: 7,
|
||||||
|
name: "y".to_owned(),
|
||||||
|
digest: None,
|
||||||
|
},
|
||||||
|
init: Expr::Literal(Box::new(Literal {
|
||||||
|
start: 10,
|
||||||
|
end: 11,
|
||||||
|
value: LiteralValue::IInteger(4),
|
||||||
|
raw: "4".to_owned(),
|
||||||
|
digest: None,
|
||||||
|
})),
|
||||||
|
digest: None,
|
||||||
|
}],
|
||||||
|
visibility: ItemVisibility::Default,
|
||||||
|
kind: VariableKind::Const,
|
||||||
|
digest: None,
|
||||||
|
}))],
|
||||||
|
non_code_meta: NonCodeMeta::default(),
|
||||||
|
digest: None,
|
||||||
};
|
};
|
||||||
assert_eq!(expected, actual);
|
assert_eq!(expected, actual);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ tokio-tungstenite = { version = "0.24.0", features = ["rustls-tls-native-roots"]
|
|||||||
tower-lsp = { version = "0.20.0", features = ["proposed"] }
|
tower-lsp = { version = "0.20.0", features = ["proposed"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["engine"]
|
default = ["engine"] # add wasm-engine-utils here when we're ready
|
||||||
cli = ["dep:clap"]
|
cli = ["dep:clap"]
|
||||||
# For the lsp server, when run with stdout for rpc we want to disable println.
|
# For the lsp server, when run with stdout for rpc we want to disable println.
|
||||||
# This is used for editor extensions that use the lsp server.
|
# This is used for editor extensions that use the lsp server.
|
||||||
@ -77,6 +77,10 @@ engine = []
|
|||||||
pyo3 = ["dep:pyo3"]
|
pyo3 = ["dep:pyo3"]
|
||||||
# Helper functions also used in benchmarks.
|
# Helper functions also used in benchmarks.
|
||||||
lsp-test-util = []
|
lsp-test-util = []
|
||||||
|
#if enabled, kcl will link directly against a wasm build of the engine utils lib to save latency
|
||||||
|
wasm-engine-utils = []
|
||||||
|
#if enabled, kcl will link directly against a native build of the engine utils lib to save latency (not yet functional)
|
||||||
|
native-engine-utils = []
|
||||||
|
|
||||||
tabled = ["dep:tabled"]
|
tabled = ["dep:tabled"]
|
||||||
|
|
||||||
|
@ -16,8 +16,6 @@ use crate::{
|
|||||||
executor::{Point2d, SourceRange},
|
executor::{Point2d, SourceRange},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::types::UnboxedNode;
|
|
||||||
|
|
||||||
type Point3d = kcmc::shared::Point3d<f64>;
|
type Point3d = kcmc::shared::Point3d<f64>;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -37,7 +35,7 @@ const EPSILON: f64 = 0.015625; // or 2^-6
|
|||||||
/// a move or a new line.
|
/// a move or a new line.
|
||||||
pub async fn modify_ast_for_sketch(
|
pub async fn modify_ast_for_sketch(
|
||||||
engine: &Arc<Box<dyn EngineManager>>,
|
engine: &Arc<Box<dyn EngineManager>>,
|
||||||
program: &mut UnboxedNode<Program>,
|
program: &mut Program,
|
||||||
// The name of the sketch.
|
// The name of the sketch.
|
||||||
sketch_name: &str,
|
sketch_name: &str,
|
||||||
// The type of plane the sketch is on. `XY` or `XZ`, etc
|
// The type of plane the sketch is on. `XY` or `XZ`, etc
|
||||||
@ -197,7 +195,7 @@ fn create_start_sketch_on(
|
|||||||
end: [f64; 2],
|
end: [f64; 2],
|
||||||
plane: crate::executor::PlaneType,
|
plane: crate::executor::PlaneType,
|
||||||
additional_lines: Vec<[f64; 2]>,
|
additional_lines: Vec<[f64; 2]>,
|
||||||
) -> Result<UnboxedNode<VariableDeclarator>, KclError> {
|
) -> Result<VariableDeclarator, KclError> {
|
||||||
let start_sketch_on = CallExpression::new("startSketchOn", vec![Literal::new(plane.to_string().into()).into()])?;
|
let start_sketch_on = CallExpression::new("startSketchOn", vec![Literal::new(plane.to_string().into()).into()])?;
|
||||||
let start_profile_at = CallExpression::new(
|
let start_profile_at = CallExpression::new(
|
||||||
"startProfileAt",
|
"startProfileAt",
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,9 @@
|
|||||||
|
use crate::executor::Metadata;
|
||||||
use crate::executor::SourceRange;
|
use crate::executor::SourceRange;
|
||||||
|
|
||||||
|
use super::impl_value_meta;
|
||||||
use super::ConstraintLevel;
|
use super::ConstraintLevel;
|
||||||
use super::Hover;
|
use super::Hover;
|
||||||
use super::Node;
|
|
||||||
use super::NodeList;
|
|
||||||
use super::UnboxedNode;
|
|
||||||
use super::{Digest, Expr};
|
use super::{Digest, Expr};
|
||||||
use databake::*;
|
use databake::*;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
@ -20,10 +19,12 @@ type IfBlock = crate::ast::types::Program;
|
|||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub struct IfExpression {
|
pub struct IfExpression {
|
||||||
|
pub start: usize,
|
||||||
|
pub end: usize,
|
||||||
pub cond: Box<Expr>,
|
pub cond: Box<Expr>,
|
||||||
pub then_val: Node<IfBlock>,
|
pub then_val: Box<IfBlock>,
|
||||||
pub else_ifs: NodeList<ElseIf>,
|
pub else_ifs: Vec<ElseIf>,
|
||||||
pub final_else: Node<IfBlock>,
|
pub final_else: Box<IfBlock>,
|
||||||
|
|
||||||
pub digest: Option<Digest>,
|
pub digest: Option<Digest>,
|
||||||
}
|
}
|
||||||
@ -33,21 +34,57 @@ pub struct IfExpression {
|
|||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub struct ElseIf {
|
pub struct ElseIf {
|
||||||
|
pub start: usize,
|
||||||
|
pub end: usize,
|
||||||
pub cond: Expr,
|
pub cond: Expr,
|
||||||
pub then_val: Node<IfBlock>,
|
pub then_val: Box<IfBlock>,
|
||||||
|
|
||||||
pub digest: Option<Digest>,
|
pub digest: Option<Digest>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Source code metadata
|
// Source code metadata
|
||||||
|
|
||||||
impl UnboxedNode<IfExpression> {
|
impl_value_meta!(IfExpression);
|
||||||
|
impl_value_meta!(ElseIf);
|
||||||
|
|
||||||
|
impl IfExpression {
|
||||||
fn source_ranges(&self) -> Vec<SourceRange> {
|
fn source_ranges(&self) -> Vec<SourceRange> {
|
||||||
vec![SourceRange::from(self)]
|
vec![SourceRange::from(self)]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnboxedNode<ElseIf> {
|
impl From<IfExpression> for Metadata {
|
||||||
|
fn from(value: IfExpression) -> Self {
|
||||||
|
Self {
|
||||||
|
source_range: value.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<ElseIf> for Metadata {
|
||||||
|
fn from(value: ElseIf) -> Self {
|
||||||
|
Self {
|
||||||
|
source_range: value.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl From<&IfExpression> for Metadata {
|
||||||
|
fn from(value: &IfExpression) -> Self {
|
||||||
|
Self {
|
||||||
|
source_range: value.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&ElseIf> for Metadata {
|
||||||
|
fn from(value: &ElseIf) -> Self {
|
||||||
|
Self {
|
||||||
|
source_range: value.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ElseIf {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn source_ranges(&self) -> Vec<SourceRange> {
|
fn source_ranges(&self) -> Vec<SourceRange> {
|
||||||
vec![SourceRange([self.start, self.end])]
|
vec![SourceRange([self.start, self.end])]
|
||||||
@ -56,15 +93,6 @@ impl UnboxedNode<ElseIf> {
|
|||||||
|
|
||||||
// IDE support and refactors
|
// IDE support and refactors
|
||||||
|
|
||||||
impl UnboxedNode<IfExpression> {
|
|
||||||
/// Get the constraint level.
|
|
||||||
pub fn get_constraint_level(&self) -> ConstraintLevel {
|
|
||||||
ConstraintLevel::Full {
|
|
||||||
source_ranges: self.source_ranges(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl IfExpression {
|
impl IfExpression {
|
||||||
pub fn get_hover_value_for_position(&self, pos: usize, code: &str) -> Option<Hover> {
|
pub fn get_hover_value_for_position(&self, pos: usize, code: &str) -> Option<Hover> {
|
||||||
self.cond
|
self.cond
|
||||||
@ -87,7 +115,12 @@ impl IfExpression {
|
|||||||
}
|
}
|
||||||
self.final_else.rename_identifiers(old_name, new_name);
|
self.final_else.rename_identifiers(old_name, new_name);
|
||||||
}
|
}
|
||||||
|
/// Get the constraint level.
|
||||||
|
pub fn get_constraint_level(&self) -> ConstraintLevel {
|
||||||
|
ConstraintLevel::Full {
|
||||||
|
source_ranges: self.source_ranges(),
|
||||||
|
}
|
||||||
|
}
|
||||||
pub fn replace_value(&mut self, source_range: SourceRange, new_value: Expr) {
|
pub fn replace_value(&mut self, source_range: SourceRange, new_value: Expr) {
|
||||||
self.cond.replace_value(source_range, new_value.clone());
|
self.cond.replace_value(source_range, new_value.clone());
|
||||||
for else_if in &mut self.else_ifs {
|
for else_if in &mut self.else_ifs {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::{
|
use super::{
|
||||||
human_friendly_type, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart,
|
human_friendly_type, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart,
|
||||||
CallExpression, Expr, IfExpression, LiteralIdentifier, LiteralValue, MemberExpression, MemberObject,
|
CallExpression, Expr, IfExpression, LiteralIdentifier, LiteralValue, MemberExpression, MemberObject,
|
||||||
ObjectExpression, TagDeclarator, UnaryExpression, UnaryOperator, UnboxedNode,
|
ObjectExpression, TagDeclarator, UnaryExpression, UnaryOperator,
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
errors::{KclError, KclErrorDetails},
|
errors::{KclError, KclErrorDetails},
|
||||||
@ -32,7 +32,7 @@ impl BinaryPart {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnboxedNode<MemberExpression> {
|
impl MemberExpression {
|
||||||
pub fn get_result_array(&self, exec_state: &mut ExecState, index: usize) -> Result<KclValue, KclError> {
|
pub fn get_result_array(&self, exec_state: &mut ExecState, index: usize) -> Result<KclValue, KclError> {
|
||||||
let array = match &self.object {
|
let array = match &self.object {
|
||||||
MemberObject::MemberExpression(member_expr) => member_expr.get_result(exec_state)?,
|
MemberObject::MemberExpression(member_expr) => member_expr.get_result(exec_state)?,
|
||||||
@ -137,7 +137,7 @@ impl UnboxedNode<MemberExpression> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnboxedNode<BinaryExpression> {
|
impl BinaryExpression {
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||||
let left_json_value = self.left.get_result(exec_state, ctx).await?.get_json_value()?;
|
let left_json_value = self.left.get_result(exec_state, ctx).await?.get_json_value()?;
|
||||||
@ -186,7 +186,7 @@ impl UnboxedNode<BinaryExpression> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnboxedNode<UnaryExpression> {
|
impl UnaryExpression {
|
||||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||||
if self.operator == UnaryOperator::Not {
|
if self.operator == UnaryOperator::Not {
|
||||||
let value = self.argument.get_result(exec_state, ctx).await?.get_json_value()?;
|
let value = self.argument.get_result(exec_state, ctx).await?.get_json_value()?;
|
||||||
@ -297,7 +297,7 @@ async fn inner_execute_pipe_body(
|
|||||||
Ok(final_output)
|
Ok(final_output)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnboxedNode<CallExpression> {
|
impl CallExpression {
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||||
let fn_name = &self.callee.name;
|
let fn_name = &self.callee.name;
|
||||||
@ -502,7 +502,7 @@ impl UnboxedNode<CallExpression> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnboxedNode<TagDeclarator> {
|
impl TagDeclarator {
|
||||||
pub async fn execute(&self, exec_state: &mut ExecState) -> Result<KclValue, KclError> {
|
pub async fn execute(&self, exec_state: &mut ExecState) -> Result<KclValue, KclError> {
|
||||||
let memory_item = KclValue::TagIdentifier(Box::new(TagIdentifier {
|
let memory_item = KclValue::TagIdentifier(Box::new(TagIdentifier {
|
||||||
value: self.name.clone(),
|
value: self.name.clone(),
|
||||||
@ -518,7 +518,7 @@ impl UnboxedNode<TagDeclarator> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnboxedNode<ArrayExpression> {
|
impl ArrayExpression {
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||||
let mut results = Vec::with_capacity(self.elements.len());
|
let mut results = Vec::with_capacity(self.elements.len());
|
||||||
@ -543,21 +543,21 @@ impl UnboxedNode<ArrayExpression> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnboxedNode<ArrayRangeExpression> {
|
impl ArrayRangeExpression {
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||||
let metadata = Metadata::from(&self.start_element);
|
let metadata = Metadata::from(&*self.start_element);
|
||||||
let start = ctx
|
let start = ctx
|
||||||
.execute_expr(&self.start_element, exec_state, &metadata, StatementKind::Expression)
|
.execute_expr(&self.start_element, exec_state, &metadata, StatementKind::Expression)
|
||||||
.await?
|
.await?
|
||||||
.get_json_value()?;
|
.get_json_value()?;
|
||||||
let start = parse_json_number_as_u64(&start, (&self.start_element).into())?;
|
let start = parse_json_number_as_i64(&start, (&*self.start_element).into())?;
|
||||||
let metadata = Metadata::from(&self.end_element);
|
let metadata = Metadata::from(&*self.end_element);
|
||||||
let end = ctx
|
let end = ctx
|
||||||
.execute_expr(&self.end_element, exec_state, &metadata, StatementKind::Expression)
|
.execute_expr(&self.end_element, exec_state, &metadata, StatementKind::Expression)
|
||||||
.await?
|
.await?
|
||||||
.get_json_value()?;
|
.get_json_value()?;
|
||||||
let end = parse_json_number_as_u64(&end, (&self.end_element).into())?;
|
let end = parse_json_number_as_i64(&end, (&*self.end_element).into())?;
|
||||||
|
|
||||||
if end < start {
|
if end < start {
|
||||||
return Err(KclError::Semantic(KclErrorDetails {
|
return Err(KclError::Semantic(KclErrorDetails {
|
||||||
@ -581,7 +581,7 @@ impl UnboxedNode<ArrayRangeExpression> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnboxedNode<ObjectExpression> {
|
impl ObjectExpression {
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||||
let mut object = serde_json::Map::new();
|
let mut object = serde_json::Map::new();
|
||||||
@ -603,9 +603,9 @@ impl UnboxedNode<ObjectExpression> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_json_number_as_u64(j: &serde_json::Value, source_range: SourceRange) -> Result<u64, KclError> {
|
fn parse_json_number_as_i64(j: &serde_json::Value, source_range: SourceRange) -> Result<i64, KclError> {
|
||||||
if let serde_json::Value::Number(n) = &j {
|
if let serde_json::Value::Number(n) = &j {
|
||||||
n.as_u64().ok_or_else(|| {
|
n.as_i64().ok_or_else(|| {
|
||||||
KclError::Syntax(KclErrorDetails {
|
KclError::Syntax(KclErrorDetails {
|
||||||
source_ranges: vec![source_range],
|
source_ranges: vec![source_range],
|
||||||
message: format!("Invalid integer: {}", j),
|
message: format!("Invalid integer: {}", j),
|
||||||
@ -655,7 +655,7 @@ pub fn json_as_bool(j: &serde_json::Value) -> Option<bool> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnboxedNode<IfExpression> {
|
impl IfExpression {
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||||
// Check the `if` branch.
|
// Check the `if` branch.
|
||||||
@ -717,7 +717,7 @@ impl Property {
|
|||||||
let property_src: SourceRange = value.clone().into();
|
let property_src: SourceRange = value.clone().into();
|
||||||
match value {
|
match value {
|
||||||
LiteralIdentifier::Identifier(identifier) => {
|
LiteralIdentifier::Identifier(identifier) => {
|
||||||
let name = &identifier.name;
|
let name = identifier.name;
|
||||||
if !computed {
|
if !computed {
|
||||||
// Treat the property as a literal
|
// Treat the property as a literal
|
||||||
Ok(Property::String(name.to_string()))
|
Ok(Property::String(name.to_string()))
|
||||||
|
@ -5,8 +5,6 @@ use serde_json::Value as JValue;
|
|||||||
|
|
||||||
use crate::ast::types::{Expr, Literal};
|
use crate::ast::types::{Expr, Literal};
|
||||||
|
|
||||||
use super::UnboxedNode;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||||
#[databake(path = kcl_lib::ast::types)]
|
#[databake(path = kcl_lib::ast::types)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
@ -35,9 +33,9 @@ impl LiteralValue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<UnboxedNode<Literal>> for Expr {
|
impl From<Literal> for Expr {
|
||||||
fn from(literal: UnboxedNode<Literal>) -> Self {
|
fn from(literal: Literal) -> Self {
|
||||||
Expr::Literal(literal)
|
Expr::Literal(Box::new(literal))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
57
src/wasm-lib/kcl/src/engine/engine_utils.rs
Normal file
57
src/wasm-lib/kcl/src/engine/engine_utils.rs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
//! Functions for calling into the engine-utils library (a set of C++ utilities containing various logic for client-side CAD processing)
|
||||||
|
//! Note that this binary may not be available to all builds of kcl, so fallbacks that call the engine API should be implemented
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
errors::{KclError, KclErrorDetails},
|
||||||
|
std::Args,
|
||||||
|
};
|
||||||
|
use anyhow::Result;
|
||||||
|
use std::ffi::{CString, CStr};
|
||||||
|
use kittycad_modeling_cmds::{length_unit::LengthUnit, shared::Point3d};
|
||||||
|
|
||||||
|
mod cpp {
|
||||||
|
use std::os::raw::c_char;
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
pub fn kcEngineUtilsEvaluatePath(sketch: *const c_char, t: f64) -> *const c_char;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pub fn is_available() -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn get_true_path_end_pos(sketch: String, args: &Args) -> Result<Point3d<LengthUnit>, KclError> {
|
||||||
|
let c_string = CString::new(sketch).map_err(|e| {
|
||||||
|
KclError::Internal(KclErrorDetails {
|
||||||
|
message: format!("{:?}", e),
|
||||||
|
source_ranges: vec![args.source_range],
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
let arg = c_string.into_raw();
|
||||||
|
let result_string: String;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
let result = cpp::kcEngineUtilsEvaluatePath(arg, 1.0);
|
||||||
|
let result_cstr = CStr::from_ptr(result);
|
||||||
|
let str_slice: &str = result_cstr.to_str().map_err(|e| {
|
||||||
|
KclError::Internal(KclErrorDetails {
|
||||||
|
message: format!("{:?}", e),
|
||||||
|
source_ranges: vec![args.source_range],
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
let str_buf: String = str_slice.to_owned();
|
||||||
|
result_string = str_buf.clone();
|
||||||
|
let _ = CString::from_raw(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
let point: Point3d<f64> = serde_json::from_str(&result_string).map_err(|e| {
|
||||||
|
KclError::Type(KclErrorDetails {
|
||||||
|
message: format!("Failed to path position from json: {}", e),
|
||||||
|
source_ranges: vec![args.source_range],
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
Ok(Point3d::<f64>::from(point).map(LengthUnit))
|
||||||
|
}
|
35
src/wasm-lib/kcl/src/engine/engine_utils_api.rs
Normal file
35
src/wasm-lib/kcl/src/engine/engine_utils_api.rs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
//! Functions for calling into the engine-utils library (a set of C++ utilities containing various logic for client-side CAD processing)
|
||||||
|
//! Note that this binary may not be available to all builds of kcl, so fallbacks that call the engine API should be implemented
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
errors::{KclError, KclErrorDetails},
|
||||||
|
std::Args,
|
||||||
|
};
|
||||||
|
use crate::engine::kcmc::{each_cmd as mcmd, ModelingCmd};
|
||||||
|
use anyhow::Result;
|
||||||
|
use kittycad_modeling_cmds::{length_unit::LengthUnit, ok_response::OkModelingCmdResponse, shared::Point3d, websocket::OkWebSocketResponseData};
|
||||||
|
|
||||||
|
pub fn is_available() -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn get_true_path_end_pos(sketch: String, args: &Args) -> Result<Point3d<LengthUnit>, KclError> {
|
||||||
|
let id = uuid::Uuid::new_v4();
|
||||||
|
|
||||||
|
let resp = args.send_modeling_cmd(id, ModelingCmd::from(mcmd::EngineUtilEvaluatePath {
|
||||||
|
path_json: sketch,
|
||||||
|
t: 1.0,
|
||||||
|
})).await?;
|
||||||
|
|
||||||
|
let OkWebSocketResponseData::Modeling {
|
||||||
|
modeling_response: OkModelingCmdResponse::EngineUtilEvaluatePath(point),
|
||||||
|
} = &resp
|
||||||
|
else {
|
||||||
|
return Err(KclError::Engine(KclErrorDetails {
|
||||||
|
message: format!("mcmd::EngineUtilEvaluatePath response was not as expected: {:?}", resp),
|
||||||
|
source_ranges: vec![args.source_range],
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(point.pos)
|
||||||
|
}
|
56
src/wasm-lib/kcl/src/engine/engine_utils_wasm.rs
Normal file
56
src/wasm-lib/kcl/src/engine/engine_utils_wasm.rs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
//! Functions for calling into the engine-utils library (a set of C++ utilities containing various logic for client-side CAD processing)
|
||||||
|
//! Note that this binary may not be available to all builds of kcl, so fallbacks that call the engine API should be implemented
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
errors::{KclError, KclErrorDetails},
|
||||||
|
std::Args,
|
||||||
|
};
|
||||||
|
use anyhow::Result;
|
||||||
|
use kittycad_modeling_cmds::{length_unit::LengthUnit, shared::Point3d};
|
||||||
|
mod cpp {
|
||||||
|
use wasm_bindgen::prelude::wasm_bindgen;
|
||||||
|
|
||||||
|
#[wasm_bindgen(module = "/../../lib/engineUtils.ts")]
|
||||||
|
extern "C" {
|
||||||
|
#[wasm_bindgen(js_name = getTruePathEndPos, catch)]
|
||||||
|
pub fn get_true_path_end_pos(sketch: String) -> Result<js_sys::Promise, js_sys::Error>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_available() -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn call_cpp<F>(args: &Args, f: F) -> Result<String, KclError>
|
||||||
|
where
|
||||||
|
F: FnOnce() -> Result<js_sys::Promise, js_sys::Error>,
|
||||||
|
{
|
||||||
|
let promise = f().map_err(|e| {
|
||||||
|
KclError::Internal(KclErrorDetails {
|
||||||
|
message: format!("{:?}", e),
|
||||||
|
source_ranges: vec![args.source_range],
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let result = crate::wasm::JsFuture::from(promise).await.map_err(|e| {
|
||||||
|
KclError::Internal(KclErrorDetails {
|
||||||
|
message: format!("{:?}", e),
|
||||||
|
source_ranges: vec![args.source_range],
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
Ok(result.as_string().unwrap_or_default())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn get_true_path_end_pos(sketch: String, args: &Args) -> Result<Point3d<LengthUnit>, KclError> {
|
||||||
|
let result_str = call_cpp(args, || cpp::get_true_path_end_pos(sketch.into())).await?;
|
||||||
|
|
||||||
|
let point: Point3d<f64> = serde_json::from_str(&result_str).map_err(|e| {
|
||||||
|
KclError::Type(KclErrorDetails {
|
||||||
|
message: format!("Failed to path position from json: {}", e),
|
||||||
|
source_ranges: vec![args.source_range],
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
Ok(Point3d::<f64>::from(point).map(LengthUnit))
|
||||||
|
}
|
@ -8,6 +8,17 @@ pub mod conn_mock;
|
|||||||
#[cfg(feature = "engine")]
|
#[cfg(feature = "engine")]
|
||||||
pub mod conn_wasm;
|
pub mod conn_wasm;
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
#[cfg(feature = "native-engine-utils")]
|
||||||
|
pub mod engine_utils;
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
#[cfg(feature = "wasm-engine-utils")]
|
||||||
|
pub mod engine_utils_wasm;
|
||||||
|
|
||||||
|
#[cfg(feature = "engine")]
|
||||||
|
#[cfg(any(not(target_arch = "wasm32"), all(not(feature = "native-engine-utils"), not(feature = "wasm-engine-utils"))))]
|
||||||
|
pub mod engine_utils_api;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
|
@ -26,8 +26,8 @@ type Point3D = kcmc::shared::Point3d<f64>;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::types::{
|
ast::types::{
|
||||||
human_friendly_type, BodyItem, Expr, FunctionExpression, ItemVisibility, KclNone, NodeRef, Program,
|
human_friendly_type, BodyItem, Expr, ExpressionStatement, FunctionExpression, ImportStatement, ItemVisibility,
|
||||||
TagDeclarator, TagNode, UnboxedNode,
|
KclNone, Program, ReturnStatement, TagDeclarator,
|
||||||
},
|
},
|
||||||
engine::{EngineManager, ExecutionKind},
|
engine::{EngineManager, ExecutionKind},
|
||||||
errors::{KclError, KclErrorDetails},
|
errors::{KclError, KclErrorDetails},
|
||||||
@ -339,7 +339,7 @@ impl IdGenerator {
|
|||||||
pub enum KclValue {
|
pub enum KclValue {
|
||||||
UserVal(UserVal),
|
UserVal(UserVal),
|
||||||
TagIdentifier(Box<TagIdentifier>),
|
TagIdentifier(Box<TagIdentifier>),
|
||||||
TagDeclarator(crate::ast::types::Node<TagDeclarator>),
|
TagDeclarator(Box<TagDeclarator>),
|
||||||
Plane(Box<Plane>),
|
Plane(Box<Plane>),
|
||||||
Face(Box<Face>),
|
Face(Box<Face>),
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ pub enum KclValue {
|
|||||||
Function {
|
Function {
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
func: Option<MemoryFunction>,
|
func: Option<MemoryFunction>,
|
||||||
expression: crate::ast::types::Node<FunctionExpression>,
|
expression: Box<FunctionExpression>,
|
||||||
memory: Box<ProgramMemory>,
|
memory: Box<ProgramMemory>,
|
||||||
#[serde(rename = "__meta")]
|
#[serde(rename = "__meta")]
|
||||||
meta: Vec<Metadata>,
|
meta: Vec<Metadata>,
|
||||||
@ -890,7 +890,7 @@ pub type MemoryFunction =
|
|||||||
fn(
|
fn(
|
||||||
s: Vec<KclValue>,
|
s: Vec<KclValue>,
|
||||||
memory: ProgramMemory,
|
memory: ProgramMemory,
|
||||||
expression: crate::ast::types::Node<FunctionExpression>,
|
expression: Box<FunctionExpression>,
|
||||||
metadata: Vec<Metadata>,
|
metadata: Vec<Metadata>,
|
||||||
exec_state: &ExecState,
|
exec_state: &ExecState,
|
||||||
ctx: ExecutorContext,
|
ctx: ExecutorContext,
|
||||||
@ -900,7 +900,7 @@ impl From<KclValue> for Vec<SourceRange> {
|
|||||||
fn from(item: KclValue) -> Self {
|
fn from(item: KclValue) -> Self {
|
||||||
match item {
|
match item {
|
||||||
KclValue::UserVal(u) => u.meta.iter().map(|m| m.source_range).collect(),
|
KclValue::UserVal(u) => u.meta.iter().map(|m| m.source_range).collect(),
|
||||||
KclValue::TagDeclarator(t) => vec![(&t).into()],
|
KclValue::TagDeclarator(t) => t.into(),
|
||||||
KclValue::TagIdentifier(t) => t.meta.iter().map(|m| m.source_range).collect(),
|
KclValue::TagIdentifier(t) => t.meta.iter().map(|m| m.source_range).collect(),
|
||||||
KclValue::Solid(e) => e.meta.iter().map(|m| m.source_range).collect(),
|
KclValue::Solid(e) => e.meta.iter().map(|m| m.source_range).collect(),
|
||||||
KclValue::Solids { value } => value
|
KclValue::Solids { value } => value
|
||||||
@ -1043,9 +1043,9 @@ impl KclValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get a tag declarator from a memory item.
|
/// Get a tag declarator from a memory item.
|
||||||
pub fn get_tag_declarator(&self) -> Result<TagNode, KclError> {
|
pub fn get_tag_declarator(&self) -> Result<TagDeclarator, KclError> {
|
||||||
match self {
|
match self {
|
||||||
KclValue::TagDeclarator(t) => Ok((**t).clone()),
|
KclValue::TagDeclarator(t) => Ok(*t.clone()),
|
||||||
_ => Err(KclError::Semantic(KclErrorDetails {
|
_ => Err(KclError::Semantic(KclErrorDetails {
|
||||||
message: format!("Not a tag declarator: {:?}", self),
|
message: format!("Not a tag declarator: {:?}", self),
|
||||||
source_ranges: self.clone().into(),
|
source_ranges: self.clone().into(),
|
||||||
@ -1054,9 +1054,9 @@ impl KclValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get an optional tag from a memory item.
|
/// Get an optional tag from a memory item.
|
||||||
pub fn get_tag_declarator_opt(&self) -> Result<Option<TagNode>, KclError> {
|
pub fn get_tag_declarator_opt(&self) -> Result<Option<TagDeclarator>, KclError> {
|
||||||
match self {
|
match self {
|
||||||
KclValue::TagDeclarator(t) => Ok(Some((**t).clone())),
|
KclValue::TagDeclarator(t) => Ok(Some(*t.clone())),
|
||||||
_ => Err(KclError::Semantic(KclErrorDetails {
|
_ => Err(KclError::Semantic(KclErrorDetails {
|
||||||
message: format!("Not a tag declarator: {:?}", self),
|
message: format!("Not a tag declarator: {:?}", self),
|
||||||
source_ranges: self.clone().into(),
|
source_ranges: self.clone().into(),
|
||||||
@ -1200,7 +1200,7 @@ pub struct GetTangentialInfoFromPathsResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Sketch {
|
impl Sketch {
|
||||||
pub(crate) fn add_tag(&mut self, tag: NodeRef<'_, TagDeclarator>, current_path: &Path) {
|
pub(crate) fn add_tag(&mut self, tag: &TagDeclarator, current_path: &Path) {
|
||||||
let mut tag_identifier: TagIdentifier = tag.into();
|
let mut tag_identifier: TagIdentifier = tag.into();
|
||||||
let base = current_path.get_base();
|
let base = current_path.get_base();
|
||||||
tag_identifier.info = Some(TagEngineInfo {
|
tag_identifier.info = Some(TagEngineInfo {
|
||||||
@ -1326,7 +1326,7 @@ pub enum EdgeCut {
|
|||||||
/// The engine id of the edge to fillet.
|
/// The engine id of the edge to fillet.
|
||||||
#[serde(rename = "edgeId")]
|
#[serde(rename = "edgeId")]
|
||||||
edge_id: uuid::Uuid,
|
edge_id: uuid::Uuid,
|
||||||
tag: Box<Option<TagNode>>,
|
tag: Box<Option<TagDeclarator>>,
|
||||||
},
|
},
|
||||||
/// A chamfer.
|
/// A chamfer.
|
||||||
Chamfer {
|
Chamfer {
|
||||||
@ -1336,7 +1336,7 @@ pub enum EdgeCut {
|
|||||||
/// The engine id of the edge to chamfer.
|
/// The engine id of the edge to chamfer.
|
||||||
#[serde(rename = "edgeId")]
|
#[serde(rename = "edgeId")]
|
||||||
edge_id: uuid::Uuid,
|
edge_id: uuid::Uuid,
|
||||||
tag: Box<Option<TagNode>>,
|
tag: Box<Option<TagDeclarator>>,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1355,7 +1355,7 @@ impl EdgeCut {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tag(&self) -> Option<TagNode> {
|
pub fn tag(&self) -> Option<TagDeclarator> {
|
||||||
match self {
|
match self {
|
||||||
EdgeCut::Fillet { tag, .. } => *tag.clone(),
|
EdgeCut::Fillet { tag, .. } => *tag.clone(),
|
||||||
EdgeCut::Chamfer { tag, .. } => *tag.clone(),
|
EdgeCut::Chamfer { tag, .. } => *tag.clone(),
|
||||||
@ -1529,10 +1529,26 @@ impl From<SourceRange> for Metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> From<NodeRef<'_, T>> for Metadata {
|
impl From<&ImportStatement> for Metadata {
|
||||||
fn from(node: NodeRef<'_, T>) -> Self {
|
fn from(stmt: &ImportStatement) -> Self {
|
||||||
Self {
|
Self {
|
||||||
source_range: SourceRange::new(node.start, node.end),
|
source_range: SourceRange::new(stmt.start, stmt.end),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&ExpressionStatement> for Metadata {
|
||||||
|
fn from(exp_statement: &ExpressionStatement) -> Self {
|
||||||
|
Self {
|
||||||
|
source_range: SourceRange::new(exp_statement.start, exp_statement.end),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&ReturnStatement> for Metadata {
|
||||||
|
fn from(return_statement: &ReturnStatement) -> Self {
|
||||||
|
Self {
|
||||||
|
source_range: SourceRange::new(return_statement.start, return_statement.end),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1557,7 +1573,7 @@ pub struct BasePath {
|
|||||||
#[ts(type = "[number, number]")]
|
#[ts(type = "[number, number]")]
|
||||||
pub to: [f64; 2],
|
pub to: [f64; 2],
|
||||||
/// The tag of the path.
|
/// The tag of the path.
|
||||||
pub tag: Option<TagNode>,
|
pub tag: Option<TagDeclarator>,
|
||||||
/// Metadata.
|
/// Metadata.
|
||||||
#[serde(rename = "__geoMeta")]
|
#[serde(rename = "__geoMeta")]
|
||||||
pub geo_meta: GeoMeta,
|
pub geo_meta: GeoMeta,
|
||||||
@ -1585,6 +1601,19 @@ pub enum Path {
|
|||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
base: BasePath,
|
base: BasePath,
|
||||||
},
|
},
|
||||||
|
/// An arc (only used for engine-utils arg serialization for now)
|
||||||
|
Arc {
|
||||||
|
#[serde(flatten)]
|
||||||
|
base: BasePath,
|
||||||
|
/// angle range
|
||||||
|
#[ts(type = "[number, number]")]
|
||||||
|
angle_range: [f64; 2],
|
||||||
|
/// center
|
||||||
|
#[ts(type = "[number, number]")]
|
||||||
|
center: [f64; 2],
|
||||||
|
/// the arc's radius
|
||||||
|
radius: f64,
|
||||||
|
},
|
||||||
/// A arc that is tangential to the last path segment that goes to a point
|
/// A arc that is tangential to the last path segment that goes to a point
|
||||||
TangentialArcTo {
|
TangentialArcTo {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
@ -1604,6 +1633,10 @@ pub enum Path {
|
|||||||
center: [f64; 2],
|
center: [f64; 2],
|
||||||
/// arc's direction
|
/// arc's direction
|
||||||
ccw: bool,
|
ccw: bool,
|
||||||
|
/// the arc's radius
|
||||||
|
radius: f64,
|
||||||
|
/// the arc's angle offset
|
||||||
|
offset: f64,
|
||||||
},
|
},
|
||||||
// TODO: consolidate segment enums, remove Circle. https://github.com/KittyCAD/modeling-app/issues/3940
|
// TODO: consolidate segment enums, remove Circle. https://github.com/KittyCAD/modeling-app/issues/3940
|
||||||
/// a complete arc
|
/// a complete arc
|
||||||
@ -1652,10 +1685,11 @@ impl Path {
|
|||||||
Path::TangentialArcTo { base, .. } => base.geo_meta.id,
|
Path::TangentialArcTo { base, .. } => base.geo_meta.id,
|
||||||
Path::TangentialArc { base, .. } => base.geo_meta.id,
|
Path::TangentialArc { base, .. } => base.geo_meta.id,
|
||||||
Path::Circle { base, .. } => base.geo_meta.id,
|
Path::Circle { base, .. } => base.geo_meta.id,
|
||||||
|
Path::Arc { base, .. } => base.geo_meta.id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_tag(&self) -> Option<TagNode> {
|
pub fn get_tag(&self) -> Option<TagDeclarator> {
|
||||||
match self {
|
match self {
|
||||||
Path::ToPoint { base } => base.tag.clone(),
|
Path::ToPoint { base } => base.tag.clone(),
|
||||||
Path::Horizontal { base, .. } => base.tag.clone(),
|
Path::Horizontal { base, .. } => base.tag.clone(),
|
||||||
@ -1664,6 +1698,7 @@ impl Path {
|
|||||||
Path::TangentialArcTo { base, .. } => base.tag.clone(),
|
Path::TangentialArcTo { base, .. } => base.tag.clone(),
|
||||||
Path::TangentialArc { base, .. } => base.tag.clone(),
|
Path::TangentialArc { base, .. } => base.tag.clone(),
|
||||||
Path::Circle { base, .. } => base.tag.clone(),
|
Path::Circle { base, .. } => base.tag.clone(),
|
||||||
|
Path::Arc { base, .. } => base.tag.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1676,6 +1711,7 @@ impl Path {
|
|||||||
Path::TangentialArcTo { base, .. } => base,
|
Path::TangentialArcTo { base, .. } => base,
|
||||||
Path::TangentialArc { base, .. } => base,
|
Path::TangentialArc { base, .. } => base,
|
||||||
Path::Circle { base, .. } => base,
|
Path::Circle { base, .. } => base,
|
||||||
|
Path::Arc { base, .. } => base,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1688,6 +1724,7 @@ impl Path {
|
|||||||
Path::TangentialArcTo { base, .. } => Some(base),
|
Path::TangentialArcTo { base, .. } => Some(base),
|
||||||
Path::TangentialArc { base, .. } => Some(base),
|
Path::TangentialArc { base, .. } => Some(base),
|
||||||
Path::Circle { base, .. } => Some(base),
|
Path::Circle { base, .. } => Some(base),
|
||||||
|
Path::Arc { base, .. } => Some(base),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1712,7 +1749,7 @@ pub struct ChamferSurface {
|
|||||||
/// The id for the chamfer surface.
|
/// The id for the chamfer surface.
|
||||||
pub face_id: uuid::Uuid,
|
pub face_id: uuid::Uuid,
|
||||||
/// The tag.
|
/// The tag.
|
||||||
pub tag: Option<UnboxedNode<TagDeclarator>>,
|
pub tag: Option<TagDeclarator>,
|
||||||
/// Metadata.
|
/// Metadata.
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub geo_meta: GeoMeta,
|
pub geo_meta: GeoMeta,
|
||||||
@ -1726,7 +1763,7 @@ pub struct FilletSurface {
|
|||||||
/// The id for the fillet surface.
|
/// The id for the fillet surface.
|
||||||
pub face_id: uuid::Uuid,
|
pub face_id: uuid::Uuid,
|
||||||
/// The tag.
|
/// The tag.
|
||||||
pub tag: Option<UnboxedNode<TagDeclarator>>,
|
pub tag: Option<TagDeclarator>,
|
||||||
/// Metadata.
|
/// Metadata.
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub geo_meta: GeoMeta,
|
pub geo_meta: GeoMeta,
|
||||||
@ -1740,7 +1777,7 @@ pub struct ExtrudePlane {
|
|||||||
/// The face id for the extrude plane.
|
/// The face id for the extrude plane.
|
||||||
pub face_id: uuid::Uuid,
|
pub face_id: uuid::Uuid,
|
||||||
/// The tag.
|
/// The tag.
|
||||||
pub tag: Option<UnboxedNode<TagDeclarator>>,
|
pub tag: Option<TagDeclarator>,
|
||||||
/// Metadata.
|
/// Metadata.
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub geo_meta: GeoMeta,
|
pub geo_meta: GeoMeta,
|
||||||
@ -1754,7 +1791,7 @@ pub struct ExtrudeArc {
|
|||||||
/// The face id for the extrude plane.
|
/// The face id for the extrude plane.
|
||||||
pub face_id: uuid::Uuid,
|
pub face_id: uuid::Uuid,
|
||||||
/// The tag.
|
/// The tag.
|
||||||
pub tag: Option<UnboxedNode<TagDeclarator>>,
|
pub tag: Option<TagDeclarator>,
|
||||||
/// Metadata.
|
/// Metadata.
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub geo_meta: GeoMeta,
|
pub geo_meta: GeoMeta,
|
||||||
@ -1770,7 +1807,7 @@ impl ExtrudeSurface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_tag(&self) -> Option<UnboxedNode<TagDeclarator>> {
|
pub fn get_tag(&self) -> Option<TagDeclarator> {
|
||||||
match self {
|
match self {
|
||||||
ExtrudeSurface::ExtrudePlane(ep) => ep.tag.clone(),
|
ExtrudeSurface::ExtrudePlane(ep) => ep.tag.clone(),
|
||||||
ExtrudeSurface::ExtrudeArc(ea) => ea.tag.clone(),
|
ExtrudeSurface::ExtrudeArc(ea) => ea.tag.clone(),
|
||||||
@ -1981,7 +2018,7 @@ impl ExecutorContext {
|
|||||||
/// Kurt uses this for partial execution.
|
/// Kurt uses this for partial execution.
|
||||||
pub async fn run(
|
pub async fn run(
|
||||||
&self,
|
&self,
|
||||||
program: NodeRef<'_, crate::ast::types::Program>,
|
program: &crate::ast::types::Program,
|
||||||
memory: Option<ProgramMemory>,
|
memory: Option<ProgramMemory>,
|
||||||
id_generator: IdGenerator,
|
id_generator: IdGenerator,
|
||||||
project_directory: Option<String>,
|
project_directory: Option<String>,
|
||||||
@ -1995,7 +2032,7 @@ impl ExecutorContext {
|
|||||||
/// Kurt uses this for partial execution.
|
/// Kurt uses this for partial execution.
|
||||||
pub async fn run_with_session_data(
|
pub async fn run_with_session_data(
|
||||||
&self,
|
&self,
|
||||||
program: NodeRef<'_, crate::ast::types::Program>,
|
program: &crate::ast::types::Program,
|
||||||
memory: Option<ProgramMemory>,
|
memory: Option<ProgramMemory>,
|
||||||
id_generator: IdGenerator,
|
id_generator: IdGenerator,
|
||||||
project_directory: Option<String>,
|
project_directory: Option<String>,
|
||||||
@ -2037,9 +2074,9 @@ impl ExecutorContext {
|
|||||||
|
|
||||||
/// Execute an AST's program.
|
/// Execute an AST's program.
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
pub(crate) async fn inner_execute<'a>(
|
pub(crate) async fn inner_execute(
|
||||||
&'a self,
|
&self,
|
||||||
program: NodeRef<'a, crate::ast::types::Program>,
|
program: &crate::ast::types::Program,
|
||||||
exec_state: &mut ExecState,
|
exec_state: &mut ExecState,
|
||||||
body_type: BodyType,
|
body_type: BodyType,
|
||||||
) -> Result<Option<KclValue>, KclError> {
|
) -> Result<Option<KclValue>, KclError> {
|
||||||
@ -2275,7 +2312,7 @@ impl ExecutorContext {
|
|||||||
/// Execute the program, then get a PNG screenshot.
|
/// Execute the program, then get a PNG screenshot.
|
||||||
pub async fn execute_and_prepare_snapshot(
|
pub async fn execute_and_prepare_snapshot(
|
||||||
&self,
|
&self,
|
||||||
program: NodeRef<'_, Program>,
|
program: &Program,
|
||||||
id_generator: IdGenerator,
|
id_generator: IdGenerator,
|
||||||
project_directory: Option<String>,
|
project_directory: Option<String>,
|
||||||
) -> Result<TakeSnapshot> {
|
) -> Result<TakeSnapshot> {
|
||||||
@ -2320,7 +2357,7 @@ impl ExecutorContext {
|
|||||||
/// assign it to a parameter of the function, in the given block of function memory.
|
/// assign it to a parameter of the function, in the given block of function memory.
|
||||||
/// Returns Err if too few/too many arguments were given for the function.
|
/// Returns Err if too few/too many arguments were given for the function.
|
||||||
fn assign_args_to_params(
|
fn assign_args_to_params(
|
||||||
function_expression: NodeRef<'_, FunctionExpression>,
|
function_expression: &FunctionExpression,
|
||||||
args: Vec<KclValue>,
|
args: Vec<KclValue>,
|
||||||
mut fn_memory: ProgramMemory,
|
mut fn_memory: ProgramMemory,
|
||||||
) -> Result<ProgramMemory, KclError> {
|
) -> Result<ProgramMemory, KclError> {
|
||||||
@ -2372,7 +2409,7 @@ fn assign_args_to_params(
|
|||||||
pub(crate) async fn call_user_defined_function(
|
pub(crate) async fn call_user_defined_function(
|
||||||
args: Vec<KclValue>,
|
args: Vec<KclValue>,
|
||||||
memory: &ProgramMemory,
|
memory: &ProgramMemory,
|
||||||
function_expression: NodeRef<'_, FunctionExpression>,
|
function_expression: &FunctionExpression,
|
||||||
exec_state: &mut ExecState,
|
exec_state: &mut ExecState,
|
||||||
ctx: &ExecutorContext,
|
ctx: &ExecutorContext,
|
||||||
) -> Result<Option<KclValue>, KclError> {
|
) -> Result<Option<KclValue>, KclError> {
|
||||||
@ -2411,7 +2448,7 @@ mod tests {
|
|||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::ast::types::{Identifier, Parameter, UnboxedNode};
|
use crate::ast::types::{Identifier, Parameter};
|
||||||
|
|
||||||
pub async fn parse_execute(code: &str) -> Result<ProgramMemory> {
|
pub async fn parse_execute(code: &str) -> Result<ProgramMemory> {
|
||||||
let tokens = crate::token::lexer(code)?;
|
let tokens = crate::token::lexer(code)?;
|
||||||
@ -3383,11 +3420,13 @@ let w = f() + f()
|
|||||||
meta: Default::default(),
|
meta: Default::default(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fn ident(s: &'static str) -> UnboxedNode<Identifier> {
|
fn ident(s: &'static str) -> Identifier {
|
||||||
UnboxedNode::no_src(Identifier {
|
Identifier {
|
||||||
|
start: 0,
|
||||||
|
end: 0,
|
||||||
name: s.to_owned(),
|
name: s.to_owned(),
|
||||||
digest: None,
|
digest: None,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
fn opt_param(s: &'static str) -> Parameter {
|
fn opt_param(s: &'static str) -> Parameter {
|
||||||
Parameter {
|
Parameter {
|
||||||
@ -3479,20 +3518,20 @@ let w = f() + f()
|
|||||||
),
|
),
|
||||||
] {
|
] {
|
||||||
// Run each test.
|
// Run each test.
|
||||||
let func_expr = &UnboxedNode::no_src(FunctionExpression {
|
let func_expr = &FunctionExpression {
|
||||||
|
start: 0,
|
||||||
|
end: 0,
|
||||||
params,
|
params,
|
||||||
body: UnboxedNode {
|
body: crate::ast::types::Program {
|
||||||
inner: crate::ast::types::Program {
|
|
||||||
body: Vec::new(),
|
|
||||||
non_code_meta: Default::default(),
|
|
||||||
digest: None,
|
|
||||||
},
|
|
||||||
start: 0,
|
start: 0,
|
||||||
end: 0,
|
end: 0,
|
||||||
|
body: Vec::new(),
|
||||||
|
non_code_meta: Default::default(),
|
||||||
|
digest: None,
|
||||||
},
|
},
|
||||||
return_type: None,
|
return_type: None,
|
||||||
digest: None,
|
digest: None,
|
||||||
});
|
};
|
||||||
let actual = assign_args_to_params(func_expr, args, ProgramMemory::new());
|
let actual = assign_args_to_params(func_expr, args, ProgramMemory::new());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
actual, expected,
|
actual, expected,
|
||||||
|
@ -13,7 +13,7 @@ use crate::{
|
|||||||
pub struct FunctionParam<'a> {
|
pub struct FunctionParam<'a> {
|
||||||
pub inner: Option<&'a MemoryFunction>,
|
pub inner: Option<&'a MemoryFunction>,
|
||||||
pub memory: ProgramMemory,
|
pub memory: ProgramMemory,
|
||||||
pub fn_expr: crate::ast::types::Node<FunctionExpression>,
|
pub fn_expr: Box<FunctionExpression>,
|
||||||
pub meta: Vec<Metadata>,
|
pub meta: Vec<Metadata>,
|
||||||
pub ctx: ExecutorContext,
|
pub ctx: ExecutorContext,
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::types::{CallExpression, NodeRef},
|
ast::types::CallExpression,
|
||||||
docs::StdLibFn,
|
docs::StdLibFn,
|
||||||
executor::SourceRange,
|
executor::SourceRange,
|
||||||
lint::rule::{def_finding, Discovered, Finding},
|
lint::rule::{def_finding, Discovered, Finding},
|
||||||
@ -18,10 +18,7 @@ def_finding!(
|
|||||||
Previously, we have not been failing when too many arguments are passed to a stdlib function. This is a problem because it can lead to unexpected behavior. We will in the future fail when too many arguments are passed to a function. So fix your code now."
|
Previously, we have not been failing when too many arguments are passed to a stdlib function. This is a problem because it can lead to unexpected behavior. We will in the future fail when too many arguments are passed to a function. So fix your code now."
|
||||||
);
|
);
|
||||||
|
|
||||||
fn lint_too_many_args_std_lib_function(
|
fn lint_too_many_args_std_lib_function(f: Box<dyn StdLibFn>, exp: &CallExpression) -> Result<Vec<Discovered>> {
|
||||||
f: Box<dyn StdLibFn>,
|
|
||||||
exp: NodeRef<'_, CallExpression>,
|
|
||||||
) -> Result<Vec<Discovered>> {
|
|
||||||
let mut findings = vec![];
|
let mut findings = vec![];
|
||||||
|
|
||||||
if f.name() == "pow" {
|
if f.name() == "pow" {
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tower_lsp::lsp_types::notification::Notification;
|
use tower_lsp::lsp_types::notification::Notification;
|
||||||
|
|
||||||
use crate::{ast::types::UnboxedNode, settings::types::UnitLength};
|
use crate::settings::types::UnitLength;
|
||||||
|
|
||||||
/// A notification that the AST has changed.
|
/// A notification that the AST has changed.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum AstUpdated {}
|
pub enum AstUpdated {}
|
||||||
|
|
||||||
impl Notification for AstUpdated {
|
impl Notification for AstUpdated {
|
||||||
type Params = UnboxedNode<crate::ast::types::Program>;
|
type Params = crate::ast::types::Program;
|
||||||
const METHOD: &'static str = "kcl/astUpdated";
|
const METHOD: &'static str = "kcl/astUpdated";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ use tower_lsp::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::types::{Expr, NodeRef, UnboxedNode, VariableKind},
|
ast::types::{Expr, VariableKind},
|
||||||
executor::{IdGenerator, SourceRange},
|
executor::{IdGenerator, SourceRange},
|
||||||
lsp::{backend::Backend as _, util::IntoDiagnostic},
|
lsp::{backend::Backend as _, util::IntoDiagnostic},
|
||||||
parser::PIPE_OPERATOR,
|
parser::PIPE_OPERATOR,
|
||||||
@ -99,7 +99,7 @@ pub struct Backend {
|
|||||||
/// Token maps.
|
/// Token maps.
|
||||||
pub token_map: DashMap<String, Vec<crate::token::Token>>,
|
pub token_map: DashMap<String, Vec<crate::token::Token>>,
|
||||||
/// AST maps.
|
/// AST maps.
|
||||||
pub ast_map: DashMap<String, UnboxedNode<crate::ast::types::Program>>,
|
pub ast_map: DashMap<String, crate::ast::types::Program>,
|
||||||
/// Memory maps.
|
/// Memory maps.
|
||||||
pub memory_map: DashMap<String, crate::executor::ProgramMemory>,
|
pub memory_map: DashMap<String, crate::executor::ProgramMemory>,
|
||||||
/// Current code.
|
/// Current code.
|
||||||
@ -571,7 +571,7 @@ impl Backend {
|
|||||||
self.client.publish_diagnostics(params.uri.clone(), items, None).await;
|
self.client.publish_diagnostics(params.uri.clone(), items, None).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn execute(&self, params: &TextDocumentItem, ast: NodeRef<'_, crate::ast::types::Program>) -> Result<()> {
|
async fn execute(&self, params: &TextDocumentItem, ast: &crate::ast::types::Program) -> Result<()> {
|
||||||
// Check if we can execute.
|
// Check if we can execute.
|
||||||
if !self.can_execute().await {
|
if !self.can_execute().await {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
@ -7,7 +7,6 @@ use tower_lsp::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::types::{Program, UnboxedNode},
|
|
||||||
executor::ProgramMemory,
|
executor::ProgramMemory,
|
||||||
lsp::test_util::{copilot_lsp_server, kcl_lsp_server},
|
lsp::test_util::{copilot_lsp_server, kcl_lsp_server},
|
||||||
};
|
};
|
||||||
@ -1071,7 +1070,7 @@ fn myFn = (param1) => {
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
|
|
||||||
// Send semantic tokens request.
|
// Send semantic tokens request.
|
||||||
let semantic_tokens = server
|
let semantic_tokens = server
|
||||||
@ -2397,7 +2396,7 @@ async fn kcl_test_kcl_lsp_full_to_empty_file_updates_ast_and_memory() {
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2417,7 +2416,7 @@ async fn kcl_test_kcl_lsp_full_to_empty_file_updates_ast_and_memory() {
|
|||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let mut default_hashed = UnboxedNode::<Program>::default();
|
let mut default_hashed = crate::ast::types::Program::default();
|
||||||
default_hashed.compute_digest();
|
default_hashed.compute_digest();
|
||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
@ -2454,7 +2453,7 @@ async fn kcl_test_kcl_lsp_code_unchanged_but_has_diagnostics_reexecute() {
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2488,9 +2487,9 @@ async fn kcl_test_kcl_lsp_code_unchanged_but_has_diagnostics_reexecute() {
|
|||||||
// Clear the ast and memory.
|
// Clear the ast and memory.
|
||||||
server
|
server
|
||||||
.ast_map
|
.ast_map
|
||||||
.insert("file:///test.kcl".to_string(), UnboxedNode::<Program>::default());
|
.insert("file:///test.kcl".to_string(), crate::ast::types::Program::default());
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert_eq!(ast, UnboxedNode::<Program>::default());
|
assert_eq!(ast, crate::ast::types::Program::default());
|
||||||
server
|
server
|
||||||
.memory_map
|
.memory_map
|
||||||
.insert("file:///test.kcl".to_string(), ProgramMemory::default());
|
.insert("file:///test.kcl".to_string(), ProgramMemory::default());
|
||||||
@ -2514,7 +2513,7 @@ async fn kcl_test_kcl_lsp_code_unchanged_but_has_diagnostics_reexecute() {
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2550,7 +2549,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_unchanged_but_has_diagnostics_reexecute()
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2605,7 +2604,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_unchanged_but_has_diagnostics_reexecute()
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2641,7 +2640,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_diagnostics_reexe
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2699,7 +2698,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_diagnostics_reexe
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2735,7 +2734,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_memory_reexecute_
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2771,7 +2770,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_memory_reexecute_
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2807,7 +2806,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2842,7 +2841,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2884,7 +2883,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
|||||||
let units = server.executor_ctx().await.clone().unwrap().settings.units;
|
let units = server.executor_ctx().await.clone().unwrap().settings.units;
|
||||||
assert_eq!(units, crate::settings::types::UnitLength::Mm);
|
assert_eq!(units, crate::settings::types::UnitLength::Mm);
|
||||||
|
|
||||||
let mut default_hashed = UnboxedNode::<Program>::default();
|
let mut default_hashed = crate::ast::types::Program::default();
|
||||||
default_hashed.compute_digest();
|
default_hashed.compute_digest();
|
||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
@ -2925,7 +2924,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
// Now it should NOT be the default memory.
|
// Now it should NOT be the default memory.
|
||||||
@ -3065,7 +3064,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
|
|
||||||
// Assure we have one diagnostics.
|
// Assure we have one diagnostics.
|
||||||
let diagnostics = server.diagnostics_map.get("file:///test.kcl").unwrap().clone();
|
let diagnostics = server.diagnostics_map.get("file:///test.kcl").unwrap().clone();
|
||||||
@ -3088,7 +3087,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
|
|
||||||
// Assure we have one diagnostics.
|
// Assure we have one diagnostics.
|
||||||
let diagnostics = server.diagnostics_map.get("file:///test.kcl").unwrap().clone();
|
let diagnostics = server.diagnostics_map.get("file:///test.kcl").unwrap().clone();
|
||||||
@ -3184,7 +3183,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl");
|
let memory = server.memory_map.get("file:///test.kcl");
|
||||||
assert!(memory.is_none());
|
assert!(memory.is_none());
|
||||||
@ -3206,7 +3205,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl");
|
let memory = server.memory_map.get("file:///test.kcl");
|
||||||
assert!(memory.is_none());
|
assert!(memory.is_none());
|
||||||
@ -3249,7 +3248,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl");
|
let memory = server.memory_map.get("file:///test.kcl");
|
||||||
assert!(memory.is_none());
|
assert!(memory.is_none());
|
||||||
@ -3279,7 +3278,7 @@ const NEW_LINT = 1"#
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl");
|
let memory = server.memory_map.get("file:///test.kcl");
|
||||||
assert!(memory.is_none());
|
assert!(memory.is_none());
|
||||||
@ -3395,7 +3394,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
|
|
||||||
// Get the symbols map.
|
// Get the symbols map.
|
||||||
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
||||||
@ -3490,7 +3489,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
|
|
||||||
// Get the symbols map.
|
// Get the symbols map.
|
||||||
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
||||||
@ -3533,7 +3532,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != UnboxedNode::<Program>::default());
|
assert!(ast != crate::ast::types::Program::default());
|
||||||
|
|
||||||
// Get the symbols map.
|
// Get the symbols map.
|
||||||
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
ast::types::{Program, UnboxedNode},
|
ast::types::Program,
|
||||||
errors::{KclError, KclErrorDetails},
|
errors::{KclError, KclErrorDetails},
|
||||||
executor::SourceRange,
|
executor::SourceRange,
|
||||||
token::{Token, TokenType},
|
token::{Token, TokenType},
|
||||||
@ -13,7 +13,7 @@ pub const PIPE_SUBSTITUTION_OPERATOR: &str = "%";
|
|||||||
pub const PIPE_OPERATOR: &str = "|>";
|
pub const PIPE_OPERATOR: &str = "|>";
|
||||||
|
|
||||||
/// Parse the given KCL code into an AST.
|
/// Parse the given KCL code into an AST.
|
||||||
pub fn parse(code: &str) -> Result<UnboxedNode<Program>, KclError> {
|
pub fn parse(code: &str) -> Result<Program, KclError> {
|
||||||
let tokens = crate::token::lexer(code)?;
|
let tokens = crate::token::lexer(code)?;
|
||||||
let parser = Parser::new(tokens);
|
let parser = Parser::new(tokens);
|
||||||
parser.ast()
|
parser.ast()
|
||||||
@ -33,7 +33,7 @@ impl Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Run the parser
|
/// Run the parser
|
||||||
pub fn ast(&self) -> Result<UnboxedNode<Program>, KclError> {
|
pub fn ast(&self) -> Result<Program, KclError> {
|
||||||
if !self.unknown_tokens.is_empty() {
|
if !self.unknown_tokens.is_empty() {
|
||||||
let source_ranges = self.unknown_tokens.iter().map(SourceRange::from).collect();
|
let source_ranges = self.unknown_tokens.iter().map(SourceRange::from).collect();
|
||||||
let token_list = self.unknown_tokens.iter().map(|t| t.value.as_str()).collect::<Vec<_>>();
|
let token_list = self.unknown_tokens.iter().map(|t| t.value.as_str()).collect::<Vec<_>>();
|
||||||
@ -48,7 +48,7 @@ impl Parser {
|
|||||||
// Important, to not call this before the unknown tokens check.
|
// Important, to not call this before the unknown tokens check.
|
||||||
if self.tokens.is_empty() {
|
if self.tokens.is_empty() {
|
||||||
// Empty file should just do nothing.
|
// Empty file should just do nothing.
|
||||||
return Ok(UnboxedNode::<Program>::default());
|
return Ok(Program::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check all the tokens are whitespace or comments.
|
// Check all the tokens are whitespace or comments.
|
||||||
@ -57,7 +57,7 @@ impl Parser {
|
|||||||
.iter()
|
.iter()
|
||||||
.all(|t| t.token_type.is_whitespace() || t.token_type.is_comment())
|
.all(|t| t.token_type.is_whitespace() || t.token_type.is_comment())
|
||||||
{
|
{
|
||||||
return Ok(UnboxedNode::<Program>::default());
|
return Ok(Program::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
parser_impl::run_parser(&mut self.tokens.as_slice())
|
parser_impl::run_parser(&mut self.tokens.as_slice())
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
ast::types::{BinaryExpression, BinaryOperator, BinaryPart, UnboxedNode},
|
ast::types::{BinaryExpression, BinaryOperator, BinaryPart},
|
||||||
errors::{KclError, KclErrorDetails},
|
errors::{KclError, KclErrorDetails},
|
||||||
executor::SourceRange,
|
executor::SourceRange,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Parses a list of tokens (in infix order, i.e. as the user typed them)
|
/// Parses a list of tokens (in infix order, i.e. as the user typed them)
|
||||||
/// into a binary expression tree.
|
/// into a binary expression tree.
|
||||||
pub fn parse(infix_tokens: Vec<BinaryExpressionToken>) -> Result<UnboxedNode<BinaryExpression>, KclError> {
|
pub fn parse(infix_tokens: Vec<BinaryExpressionToken>) -> Result<BinaryExpression, KclError> {
|
||||||
let rpn = postfix(infix_tokens);
|
let rpn = postfix(infix_tokens);
|
||||||
evaluate(rpn)
|
evaluate(rpn)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses a list of tokens (in postfix order) into a binary expression tree.
|
/// Parses a list of tokens (in postfix order) into a binary expression tree.
|
||||||
fn evaluate(rpn: Vec<BinaryExpressionToken>) -> Result<UnboxedNode<BinaryExpression>, KclError> {
|
fn evaluate(rpn: Vec<BinaryExpressionToken>) -> Result<BinaryExpression, KclError> {
|
||||||
let source_ranges = source_range(&rpn);
|
let source_ranges = source_range(&rpn);
|
||||||
let mut operand_stack: Vec<BinaryPart> = Vec::new();
|
let mut operand_stack: Vec<BinaryPart> = Vec::new();
|
||||||
let e = KclError::Internal(KclErrorDetails {
|
let e = KclError::Internal(KclErrorDetails {
|
||||||
@ -28,19 +28,14 @@ fn evaluate(rpn: Vec<BinaryExpressionToken>) -> Result<UnboxedNode<BinaryExpress
|
|||||||
let Some(left) = operand_stack.pop() else {
|
let Some(left) = operand_stack.pop() else {
|
||||||
return Err(e);
|
return Err(e);
|
||||||
};
|
};
|
||||||
let start = left.start();
|
BinaryPart::BinaryExpression(Box::new(BinaryExpression {
|
||||||
let end = right.end();
|
start: left.start(),
|
||||||
|
end: right.end(),
|
||||||
BinaryPart::BinaryExpression(UnboxedNode::boxed(
|
operator,
|
||||||
BinaryExpression {
|
left,
|
||||||
operator,
|
right,
|
||||||
left,
|
digest: None,
|
||||||
right,
|
}))
|
||||||
digest: None,
|
|
||||||
},
|
|
||||||
start,
|
|
||||||
end,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
BinaryExpressionToken::Operand(o) => o,
|
BinaryExpressionToken::Operand(o) => o,
|
||||||
};
|
};
|
||||||
@ -130,15 +125,13 @@ mod tests {
|
|||||||
fn parse_and_evaluate() {
|
fn parse_and_evaluate() {
|
||||||
/// Make a literal
|
/// Make a literal
|
||||||
fn lit(n: u8) -> BinaryPart {
|
fn lit(n: u8) -> BinaryPart {
|
||||||
BinaryPart::Literal(UnboxedNode::new(
|
BinaryPart::Literal(Box::new(Literal {
|
||||||
Literal {
|
start: 0,
|
||||||
value: n.into(),
|
end: 0,
|
||||||
raw: n.to_string(),
|
value: n.into(),
|
||||||
digest: None,
|
raw: n.to_string(),
|
||||||
},
|
digest: None,
|
||||||
0,
|
}))
|
||||||
0,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
let tests: Vec<Vec<BinaryExpressionToken>> = vec![
|
let tests: Vec<Vec<BinaryExpressionToken>> = vec![
|
||||||
// 3 + 4 × 2 ÷ ( 1 − 5 ) ^ 2 ^ 3
|
// 3 + 4 × 2 ÷ ( 1 − 5 ) ^ 2 ^ 3
|
||||||
@ -149,16 +142,14 @@ mod tests {
|
|||||||
BinaryOperator::Mul.into(),
|
BinaryOperator::Mul.into(),
|
||||||
lit(2).into(),
|
lit(2).into(),
|
||||||
BinaryOperator::Div.into(),
|
BinaryOperator::Div.into(),
|
||||||
BinaryPart::BinaryExpression(UnboxedNode::boxed(
|
BinaryPart::BinaryExpression(Box::new(BinaryExpression {
|
||||||
BinaryExpression {
|
start: 0,
|
||||||
operator: BinaryOperator::Sub,
|
end: 0,
|
||||||
left: lit(1),
|
operator: BinaryOperator::Sub,
|
||||||
right: lit(5),
|
left: lit(1),
|
||||||
digest: None,
|
right: lit(5),
|
||||||
},
|
digest: None,
|
||||||
0,
|
}))
|
||||||
0,
|
|
||||||
))
|
|
||||||
.into(),
|
.into(),
|
||||||
BinaryOperator::Pow.into(),
|
BinaryOperator::Pow.into(),
|
||||||
lit(2).into(),
|
lit(2).into(),
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,36 +1,26 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
assertion_line: 3567
|
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"type": "UnboxedNode",
|
"type": "BinaryExpression",
|
||||||
"kind": {
|
|
||||||
"type": "BinaryExpression",
|
|
||||||
"operator": "+",
|
|
||||||
"left": {
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "UnboxedNode",
|
|
||||||
"kind": {
|
|
||||||
"type": "Literal",
|
|
||||||
"value": 1,
|
|
||||||
"raw": "1"
|
|
||||||
},
|
|
||||||
"start": 0,
|
|
||||||
"end": 1
|
|
||||||
},
|
|
||||||
"right": {
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "UnboxedNode",
|
|
||||||
"kind": {
|
|
||||||
"type": "Literal",
|
|
||||||
"value": 2,
|
|
||||||
"raw": "2"
|
|
||||||
},
|
|
||||||
"start": 4,
|
|
||||||
"end": 5
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"end": 5
|
"end": 5,
|
||||||
|
"operator": "+",
|
||||||
|
"left": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"start": 0,
|
||||||
|
"end": 1,
|
||||||
|
"value": 1,
|
||||||
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"start": 4,
|
||||||
|
"end": 5,
|
||||||
|
"value": 2,
|
||||||
|
"raw": "2"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user