@ -12,3 +12,5 @@ once fixed in engine will just start working here with no language changes.
|
||||
you cannot edit it, after v1, the engine will account for this. You also cannot
|
||||
currently move or transform the imported objects at all, once we have assemblies
|
||||
this will work.
|
||||
|
||||
- **Fillets**: Fillets cannot intersect, you will get an error. Only simple fillet cases work currently.
|
||||
|
1204
docs/kcl/std.json
414
docs/kcl/std.md
@ -83,7 +83,7 @@ abs(num: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -103,7 +103,7 @@ acos(num: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -123,9 +123,9 @@ angleToMatchLengthX(segment_name: string, to: number, sketch_group: SketchGroup)
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `segment_name`: `string`
|
||||
* `to`: `number`
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `segment_name`: `string` (REQUIRED)
|
||||
* `to`: `number` (REQUIRED)
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -308,9 +308,9 @@ angleToMatchLengthY(segment_name: string, to: number, sketch_group: SketchGroup)
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `segment_name`: `string`
|
||||
* `to`: `number`
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `segment_name`: `string` (REQUIRED)
|
||||
* `to`: `number` (REQUIRED)
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -493,7 +493,7 @@ angledLine(data: AngledLineData, sketch_group: SketchGroup) -> SketchGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `AngledLineData` - Data to draw an angled line.
|
||||
* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The angle of the line.
|
||||
@ -505,7 +505,7 @@ angledLine(data: AngledLineData, sketch_group: SketchGroup) -> SketchGroup
|
||||
} |
|
||||
[number, number]
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -851,7 +851,7 @@ angledLineOfXLength(data: AngledLineData, sketch_group: SketchGroup) -> SketchGr
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `AngledLineData` - Data to draw an angled line.
|
||||
* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The angle of the line.
|
||||
@ -863,7 +863,7 @@ angledLineOfXLength(data: AngledLineData, sketch_group: SketchGroup) -> SketchGr
|
||||
} |
|
||||
[number, number]
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -1209,7 +1209,7 @@ angledLineOfYLength(data: AngledLineData, sketch_group: SketchGroup) -> SketchGr
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `AngledLineData` - Data to draw an angled line.
|
||||
* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The angle of the line.
|
||||
@ -1221,7 +1221,7 @@ angledLineOfYLength(data: AngledLineData, sketch_group: SketchGroup) -> SketchGr
|
||||
} |
|
||||
[number, number]
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -1567,7 +1567,7 @@ angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch_group: Sketc
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `AngledLineThatIntersectsData` - Data for drawing an angled line that intersects with a given line.
|
||||
* `data`: `AngledLineThatIntersectsData` - Data for drawing an angled line that intersects with a given line. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The angle of the line.
|
||||
@ -1580,7 +1580,7 @@ angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch_group: Sketc
|
||||
tag: string,
|
||||
}
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -1926,7 +1926,7 @@ angledLineToX(data: AngledLineToData, sketch_group: SketchGroup) -> SketchGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `AngledLineToData` - Data to draw an angled line to a point.
|
||||
* `data`: `AngledLineToData` - Data to draw an angled line to a point. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The angle of the line.
|
||||
@ -1938,7 +1938,7 @@ angledLineToX(data: AngledLineToData, sketch_group: SketchGroup) -> SketchGroup
|
||||
} |
|
||||
[number, number]
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -2284,7 +2284,7 @@ angledLineToY(data: AngledLineToData, sketch_group: SketchGroup) -> SketchGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `AngledLineToData` - Data to draw an angled line to a point.
|
||||
* `data`: `AngledLineToData` - Data to draw an angled line to a point. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The angle of the line.
|
||||
@ -2296,7 +2296,7 @@ angledLineToY(data: AngledLineToData, sketch_group: SketchGroup) -> SketchGroup
|
||||
} |
|
||||
[number, number]
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -2642,7 +2642,7 @@ arc(data: ArcData, sketch_group: SketchGroup) -> SketchGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `ArcData` - Data to draw an arc.
|
||||
* `data`: `ArcData` - Data to draw an arc. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The end angle.
|
||||
@ -2654,14 +2654,6 @@ arc(data: ArcData, sketch_group: SketchGroup) -> SketchGroup
|
||||
// The tag.
|
||||
tag: string,
|
||||
} |
|
||||
{
|
||||
// The end angle.
|
||||
angle_end: number,
|
||||
// The start angle.
|
||||
angle_start: number,
|
||||
// The radius.
|
||||
radius: number,
|
||||
} |
|
||||
{
|
||||
// The center.
|
||||
center: [number, number],
|
||||
@ -2671,17 +2663,9 @@ arc(data: ArcData, sketch_group: SketchGroup) -> SketchGroup
|
||||
tag: string,
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
} |
|
||||
{
|
||||
// The center.
|
||||
center: [number, number],
|
||||
// The radius.
|
||||
radius: number,
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
}
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -3027,7 +3011,7 @@ asin(num: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -3047,7 +3031,7 @@ atan(num: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -3067,7 +3051,7 @@ bezierCurve(data: BezierData, sketch_group: SketchGroup) -> SketchGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `BezierData` - Data to draw a bezier curve.
|
||||
* `data`: `BezierData` - Data to draw a bezier curve. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The first control point.
|
||||
@ -3078,17 +3062,9 @@ bezierCurve(data: BezierData, sketch_group: SketchGroup) -> SketchGroup
|
||||
tag: string,
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
} |
|
||||
{
|
||||
// The first control point.
|
||||
control1: [number, number],
|
||||
// The second control point.
|
||||
control2: [number, number],
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
}
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -3434,7 +3410,7 @@ ceil(num: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -3449,169 +3425,67 @@ Sketch a circle on the given plane
|
||||
|
||||
|
||||
```
|
||||
circle(plane: SketchData, center: [number, number], radius: number) -> SketchGroup
|
||||
circle(center: [number, number], radius: number, surface: SketchSurface, tag?: String) -> SketchGroup
|
||||
```
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `plane`: `SketchData` - Data for start sketch on. You can start a sketch on a plane or an extrude group.
|
||||
* `center`: `[number, number]` (REQUIRED)
|
||||
* `radius`: `number` (REQUIRED)
|
||||
* `surface`: `SketchSurface` - A sketch group type. (REQUIRED)
|
||||
```
|
||||
"XY" |
|
||||
"-XY" |
|
||||
"XZ" |
|
||||
"-XZ" |
|
||||
"YZ" |
|
||||
"-YZ" |
|
||||
{
|
||||
plane: {
|
||||
// The id of the plane.
|
||||
id: uuid,
|
||||
// Origin of the plane.
|
||||
origin: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
type: "plane",
|
||||
// Type for a plane.
|
||||
value: "XY" | "XZ" | "YZ" | "Custom",
|
||||
// What should the plane’s X axis be?
|
||||
x_axis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// What should the plane’s Y axis be?
|
||||
y_axis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis (normal).
|
||||
z_axis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
},
|
||||
} |
|
||||
{
|
||||
// The id of the extrusion end cap
|
||||
endCapId: uuid,
|
||||
// The height of the extrude group.
|
||||
height: number,
|
||||
// The id of the extrude group.
|
||||
id: uuid,
|
||||
// The position of the extrude group.
|
||||
position: [number, number, number],
|
||||
// The rotation of the extrude group.
|
||||
rotation: [number, number, number, number],
|
||||
// The sketch group paths.
|
||||
sketchGroupValues: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
} |
|
||||
{
|
||||
// arc's direction
|
||||
ccw: string,
|
||||
// the arc's center
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
// The y coordinate.
|
||||
y: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
// The id of the extrusion start cap
|
||||
startCapId: uuid,
|
||||
// The extrude surfaces.
|
||||
value: [{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The name.
|
||||
name: string,
|
||||
// The position.
|
||||
position: [number, number, number],
|
||||
// The rotation.
|
||||
rotation: [number, number, number, number],
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
type: "extrudePlane",
|
||||
} |
|
||||
{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The name.
|
||||
name: string,
|
||||
// The position.
|
||||
position: [number, number, number],
|
||||
// The rotation.
|
||||
rotation: [number, number, number, number],
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
type: "extrudeArc",
|
||||
}],
|
||||
// The x-axis of the extrude group base plane in the 3D space
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The y-axis of the extrude group base plane in the 3D space
|
||||
// What should the plane’s Y axis be?
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis of the extrude group base plane in the 3D space
|
||||
// The z-axis (normal).
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
} |
|
||||
{
|
||||
// The id of the face.
|
||||
id: uuid,
|
||||
// The original sketch group id of the object we are sketching on.
|
||||
sketchGroupId: uuid,
|
||||
type: "face",
|
||||
// The tag of the face.
|
||||
value: string,
|
||||
// What should the face’s X axis be?
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// What should the face’s Y axis be?
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis (normal).
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
@ -3619,8 +3493,7 @@ circle(plane: SketchData, center: [number, number], radius: number) -> SketchGro
|
||||
},
|
||||
}
|
||||
```
|
||||
* `center`: `[number, number]`
|
||||
* `radius`: `number`
|
||||
* `tag`: `String` (OPTIONAL)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -3798,12 +3671,12 @@ Close the current sketch.
|
||||
|
||||
|
||||
```
|
||||
close(sketch_group: SketchGroup) -> SketchGroup
|
||||
close(sketch_group: SketchGroup, tag?: String) -> SketchGroup
|
||||
```
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -3967,6 +3840,7 @@ close(sketch_group: SketchGroup) -> SketchGroup
|
||||
},
|
||||
}
|
||||
```
|
||||
* `tag`: `String` (OPTIONAL)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -4149,7 +4023,7 @@ cos(num: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -4188,8 +4062,8 @@ extrude(length: number, sketch_group: SketchGroup) -> ExtrudeGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `length`: `number`
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `length`: `number` (REQUIRED)
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -4502,7 +4376,7 @@ fillet(data: FilletData, extrude_group: ExtrudeGroup) -> ExtrudeGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `FilletData` - Data for fillets.
|
||||
* `data`: `FilletData` - Data for fillets. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The radius of the fillet.
|
||||
@ -4512,7 +4386,7 @@ fillet(data: FilletData, extrude_group: ExtrudeGroup) -> ExtrudeGroup
|
||||
string],
|
||||
}
|
||||
```
|
||||
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces.
|
||||
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The id of the extrusion end cap
|
||||
@ -4792,7 +4666,7 @@ floor(num: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -4812,8 +4686,8 @@ getExtrudeWallTransform(surface_name: string, extrude_group: ExtrudeGroup) -> Ex
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `surface_name`: `string`
|
||||
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces.
|
||||
* `surface_name`: `string` (REQUIRED)
|
||||
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The id of the extrusion end cap
|
||||
@ -4969,8 +4843,8 @@ getNextAdjacentEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `tag`: `String`
|
||||
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces.
|
||||
* `tag`: `String` (REQUIRED)
|
||||
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The id of the extrusion end cap
|
||||
@ -5120,8 +4994,8 @@ getOppositeEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `tag`: `String`
|
||||
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces.
|
||||
* `tag`: `String` (REQUIRED)
|
||||
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The id of the extrusion end cap
|
||||
@ -5271,8 +5145,8 @@ getPreviousAdjacentEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `tag`: `String`
|
||||
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces.
|
||||
* `tag`: `String` (REQUIRED)
|
||||
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The id of the extrusion end cap
|
||||
@ -5422,7 +5296,7 @@ hole(hole_sketch_group: SketchGroupSet, sketch_group: SketchGroup) -> SketchGrou
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `hole_sketch_group`: `SketchGroupSet` - A sketch group or a group of sketch groups.
|
||||
* `hole_sketch_group`: `SketchGroupSet` - A sketch group or a group of sketch groups. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -5590,7 +5464,7 @@ hole(hole_sketch_group: SketchGroupSet, sketch_group: SketchGroup) -> SketchGrou
|
||||
type: "sketchGroups",
|
||||
}
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -5932,13 +5806,13 @@ For formats lacking unit data (STL, OBJ, PLY), the default import unit is millim
|
||||
Import paths are relative to the current project directory. This only works in the desktop app not in browser.
|
||||
|
||||
```
|
||||
import(file_path: String, options: ImportFormat) -> ImportedGeometry
|
||||
import(file_path: String, options?: ImportFormat) -> ImportedGeometry
|
||||
```
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `file_path`: `String`
|
||||
* `options`: `ImportFormat` - Import format specifier
|
||||
* `file_path`: `String` (REQUIRED)
|
||||
* `options`: `ImportFormat` - Import format specifier (OPTIONAL)
|
||||
```
|
||||
{
|
||||
type: "fbx",
|
||||
@ -6046,7 +5920,7 @@ lastSegX(sketch_group: SketchGroup) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -6229,7 +6103,7 @@ lastSegY(sketch_group: SketchGroup) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -6412,8 +6286,8 @@ legAngX(hypotenuse: number, leg: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `hypotenuse`: `number`
|
||||
* `leg`: `number`
|
||||
* `hypotenuse`: `number` (REQUIRED)
|
||||
* `leg`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -6433,8 +6307,8 @@ legAngY(hypotenuse: number, leg: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `hypotenuse`: `number`
|
||||
* `leg`: `number`
|
||||
* `hypotenuse`: `number` (REQUIRED)
|
||||
* `leg`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -6454,8 +6328,8 @@ legLen(hypotenuse: number, leg: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `hypotenuse`: `number`
|
||||
* `leg`: `number`
|
||||
* `hypotenuse`: `number` (REQUIRED)
|
||||
* `leg`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -6475,7 +6349,7 @@ line(data: LineData, sketch_group: SketchGroup) -> SketchGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `LineData` - Data to draw a line.
|
||||
* `data`: `LineData` - Data to draw a line. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The tag.
|
||||
@ -6485,7 +6359,7 @@ line(data: LineData, sketch_group: SketchGroup) -> SketchGroup
|
||||
} |
|
||||
[number, number]
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -6831,7 +6705,7 @@ lineTo(data: LineToData, sketch_group: SketchGroup) -> SketchGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `LineToData` - Data to draw a line to a point.
|
||||
* `data`: `LineToData` - Data to draw a line to a point. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The tag.
|
||||
@ -6841,7 +6715,7 @@ lineTo(data: LineToData, sketch_group: SketchGroup) -> SketchGroup
|
||||
} |
|
||||
[number, number]
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -7187,7 +7061,7 @@ ln(num: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -7207,8 +7081,8 @@ log(num: number, base: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `base`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
* `base`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -7228,7 +7102,7 @@ log10(num: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -7248,7 +7122,7 @@ log2(num: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -7268,7 +7142,7 @@ max(args: [number]) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `args`: `[number]`
|
||||
* `args`: `[number]` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -7288,7 +7162,7 @@ min(args: [number]) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `args`: `[number]`
|
||||
* `args`: `[number]` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -7308,7 +7182,7 @@ patternCircular(data: CircularPatternData, geometry: Geometry) -> Geometries
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `CircularPatternData` - Data for a circular pattern.
|
||||
* `data`: `CircularPatternData` - Data for a circular pattern. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The arc angle (in degrees) to place the repetitions. Must be greater than 0.
|
||||
@ -7323,7 +7197,7 @@ patternCircular(data: CircularPatternData, geometry: Geometry) -> Geometries
|
||||
rotateDuplicates: string,
|
||||
}
|
||||
```
|
||||
* `geometry`: `Geometry` - A geometry.
|
||||
* `geometry`: `Geometry` - A geometry. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -7644,7 +7518,7 @@ patternLinear(data: LinearPatternData, geometry: Geometry) -> Geometries
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `LinearPatternData` - Data for a linear pattern.
|
||||
* `data`: `LinearPatternData` - Data for a linear pattern. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The axis of the pattern. This is a 2D vector.
|
||||
@ -7655,7 +7529,7 @@ patternLinear(data: LinearPatternData, geometry: Geometry) -> Geometries
|
||||
repetitions: number,
|
||||
}
|
||||
```
|
||||
* `geometry`: `Geometry` - A geometry.
|
||||
* `geometry`: `Geometry` - A geometry. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -7995,8 +7869,8 @@ pow(num: number, pow: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `pow`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
* `pow`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -8016,8 +7890,8 @@ segAng(segment_name: string, sketch_group: SketchGroup) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `segment_name`: `string`
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `segment_name`: `string` (REQUIRED)
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -8200,8 +8074,8 @@ segEndX(segment_name: string, sketch_group: SketchGroup) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `segment_name`: `string`
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `segment_name`: `string` (REQUIRED)
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -8384,8 +8258,8 @@ segEndY(segment_name: string, sketch_group: SketchGroup) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `segment_name`: `string`
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `segment_name`: `string` (REQUIRED)
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -8568,8 +8442,8 @@ segLen(segment_name: string, sketch_group: SketchGroup) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `segment_name`: `string`
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `segment_name`: `string` (REQUIRED)
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -8752,7 +8626,7 @@ sin(num: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -8772,7 +8646,7 @@ sqrt(num: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -8792,7 +8666,7 @@ startProfileAt(data: LineData, sketch_surface: SketchSurface) -> SketchGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `LineData` - Data to draw a line.
|
||||
* `data`: `LineData` - Data to draw a line. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The tag.
|
||||
@ -8802,7 +8676,7 @@ startProfileAt(data: LineData, sketch_surface: SketchSurface) -> SketchGroup
|
||||
} |
|
||||
[number, number]
|
||||
```
|
||||
* `sketch_surface`: `SketchSurface` - A sketch group type.
|
||||
* `sketch_surface`: `SketchSurface` - A sketch group type. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The id of the plane.
|
||||
@ -9045,7 +8919,7 @@ startSketchAt(data: LineData) -> SketchGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `LineData` - Data to draw a line.
|
||||
* `data`: `LineData` - Data to draw a line. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The tag.
|
||||
@ -9232,12 +9106,12 @@ Start a sketch on a specific plane or face.
|
||||
|
||||
|
||||
```
|
||||
startSketchOn(data: SketchData, tag: SketchOnFaceTag) -> SketchSurface
|
||||
startSketchOn(data: SketchData, tag?: SketchOnFaceTag) -> SketchSurface
|
||||
```
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `SketchData` - Data for start sketch on. You can start a sketch on a plane or an extrude group.
|
||||
* `data`: `SketchData` - Data for start sketch on. You can start a sketch on a plane or an extrude group. (REQUIRED)
|
||||
```
|
||||
"XY" |
|
||||
"-XY" |
|
||||
@ -9402,7 +9276,7 @@ startSketchOn(data: SketchData, tag: SketchOnFaceTag) -> SketchSurface
|
||||
},
|
||||
}
|
||||
```
|
||||
* `tag`: `SketchOnFaceTag` - A tag for sketch on face.
|
||||
* `tag`: `SketchOnFaceTag` - A tag for sketch on face. (OPTIONAL)
|
||||
```
|
||||
"start" | "end" |
|
||||
string
|
||||
@ -9486,7 +9360,7 @@ tan(num: number) -> number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `num`: `number`
|
||||
* `num`: `number` (REQUIRED)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -9506,7 +9380,7 @@ tangentialArc(data: TangentialArcData, sketch_group: SketchGroup) -> SketchGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `TangentialArcData` - Data to draw a tangential arc.
|
||||
* `data`: `TangentialArcData` - Data to draw a tangential arc. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// Offset of the arc, in degrees.
|
||||
@ -9522,7 +9396,7 @@ tangentialArc(data: TangentialArcData, sketch_group: SketchGroup) -> SketchGroup
|
||||
} |
|
||||
[number, number]
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -9863,13 +9737,13 @@ Draw an arc.
|
||||
|
||||
|
||||
```
|
||||
tangentialArcTo(to: [number], sketch_group: SketchGroup, tag: String) -> SketchGroup
|
||||
tangentialArcTo(to: [number], sketch_group: SketchGroup, tag?: String) -> SketchGroup
|
||||
```
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `to`: `[number]`
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `to`: `[number]` (REQUIRED)
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -10033,7 +9907,7 @@ tangentialArcTo(to: [number], sketch_group: SketchGroup, tag: String) -> SketchG
|
||||
},
|
||||
}
|
||||
```
|
||||
* `tag`: `String`
|
||||
* `tag`: `String` (OPTIONAL)
|
||||
|
||||
#### Returns
|
||||
|
||||
@ -10235,7 +10109,7 @@ xLine(data: AxisLineData, sketch_group: SketchGroup) -> SketchGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `AxisLineData` - Data to draw a line on an axis.
|
||||
* `data`: `AxisLineData` - Data to draw a line on an axis. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The length of the line.
|
||||
@ -10245,7 +10119,7 @@ xLine(data: AxisLineData, sketch_group: SketchGroup) -> SketchGroup
|
||||
} |
|
||||
number
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -10591,7 +10465,7 @@ xLineTo(data: AxisLineToData, sketch_group: SketchGroup) -> SketchGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `AxisLineToData` - Data to draw a line to a point on an axis.
|
||||
* `data`: `AxisLineToData` - Data to draw a line to a point on an axis. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The tag.
|
||||
@ -10601,7 +10475,7 @@ xLineTo(data: AxisLineToData, sketch_group: SketchGroup) -> SketchGroup
|
||||
} |
|
||||
number
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -10947,7 +10821,7 @@ yLine(data: AxisLineData, sketch_group: SketchGroup) -> SketchGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `AxisLineData` - Data to draw a line on an axis.
|
||||
* `data`: `AxisLineData` - Data to draw a line on an axis. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The length of the line.
|
||||
@ -10957,7 +10831,7 @@ yLine(data: AxisLineData, sketch_group: SketchGroup) -> SketchGroup
|
||||
} |
|
||||
number
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
@ -11303,7 +11177,7 @@ yLineTo(data: AxisLineToData, sketch_group: SketchGroup) -> SketchGroup
|
||||
|
||||
#### Arguments
|
||||
|
||||
* `data`: `AxisLineToData` - Data to draw a line to a point on an axis.
|
||||
* `data`: `AxisLineToData` - Data to draw a line to a point on an axis. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The tag.
|
||||
@ -11313,7 +11187,7 @@ yLineTo(data: AxisLineToData, sketch_group: SketchGroup) -> SketchGroup
|
||||
} |
|
||||
number
|
||||
```
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths.
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "untitled-app",
|
||||
"version": "0.15.5",
|
||||
"version": "0.15.6",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.10.2",
|
||||
|
164
src-tauri/Cargo.lock
generated
@ -144,9 +144,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-io"
|
||||
version = "2.3.1"
|
||||
version = "2.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65"
|
||||
checksum = "dcccb0f599cfa2f8ace422d3555572f47424da5648a4382a9dd0310ff8210884"
|
||||
dependencies = [
|
||||
"async-lock 3.3.0",
|
||||
"cfg-if",
|
||||
@ -313,6 +313,12 @@ version = "0.21.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51"
|
||||
|
||||
[[package]]
|
||||
name = "base64ct"
|
||||
version = "1.6.0"
|
||||
@ -426,9 +432,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck_derive"
|
||||
version = "1.5.0"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1"
|
||||
checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -1805,7 +1811,7 @@ dependencies = [
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"http",
|
||||
"indexmap 2.0.0",
|
||||
"indexmap 2.2.5",
|
||||
"slab",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
@ -1820,9 +1826,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.0"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
|
||||
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
@ -2021,12 +2027,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.0.0"
|
||||
version = "2.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
|
||||
checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.14.0",
|
||||
"hashbrown 0.14.3",
|
||||
"serde",
|
||||
]
|
||||
|
||||
@ -2371,9 +2377,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.20"
|
||||
version = "0.4.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@ -2788,9 +2794,9 @@ checksum = "44d11de466f4a3006fe8a5e7ec84e93b79c70cb992ae0aa0eb631ad2df8abfe2"
|
||||
|
||||
[[package]]
|
||||
name = "open"
|
||||
version = "4.2.0"
|
||||
version = "5.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a083c0c7e5e4a8ec4176346cf61f67ac674e8bfb059d9226e1c54a96b377c12"
|
||||
checksum = "449f0ff855d85ddbf1edd5b646d65249ead3f5e422aaa86b7d2d0b049b103e32"
|
||||
dependencies = [
|
||||
"is-wsl",
|
||||
"libc",
|
||||
@ -3910,9 +3916,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.112"
|
||||
version = "1.0.114"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d1bd37ce2324cf3bf85e5a25f96eb4baf0d5aa6eba43e7ae8958870c4ec48ed"
|
||||
checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0"
|
||||
dependencies = [
|
||||
"itoa 1.0.6",
|
||||
"ryu",
|
||||
@ -3971,7 +3977,7 @@ dependencies = [
|
||||
"chrono",
|
||||
"hex",
|
||||
"indexmap 1.9.3",
|
||||
"indexmap 2.0.0",
|
||||
"indexmap 2.2.5",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with_macros",
|
||||
@ -4453,9 +4459,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri"
|
||||
version = "2.0.0-beta.8"
|
||||
version = "2.0.0-beta.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2bd3d5ccf5316833c0f71c645c25585bddf997a16bea652bf3eab8114273cff"
|
||||
checksum = "e7ad6ebcb36709f29f161bd017c14c247b110a8563d90531f879df096510d697"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
@ -4482,7 +4488,6 @@ dependencies = [
|
||||
"serde_repr",
|
||||
"serialize-to-javascript",
|
||||
"state",
|
||||
"static_assertions",
|
||||
"swift-rs",
|
||||
"tauri-build",
|
||||
"tauri-macros",
|
||||
@ -4493,6 +4498,7 @@ dependencies = [
|
||||
"tokio",
|
||||
"tray-icon",
|
||||
"url",
|
||||
"urlpattern",
|
||||
"webkit2gtk",
|
||||
"webview2-com",
|
||||
"window-vibrancy",
|
||||
@ -4501,9 +4507,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-build"
|
||||
version = "2.0.0-beta.6"
|
||||
version = "2.0.0-beta.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ca30dbed856449b41abed13a5a46655ea2196075e09e99e22fe8ed0958b6aee"
|
||||
checksum = "746bc44948a2de0535fd66dd11510973f091d84a2d5cb61f2cdef9db85080816"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cargo_toml",
|
||||
@ -4523,11 +4529,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-codegen"
|
||||
version = "2.0.0-beta.6"
|
||||
version = "2.0.0-beta.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf4ed45a0d2a1723ef4ea71d1aa5809c4a8bcaa92de77f6c9a8f4d4f28c5d86a"
|
||||
checksum = "9d54988388d81d51c778cb93854553d6e50d3afa8fb7693ff362f718c06956f2"
|
||||
dependencies = [
|
||||
"base64 0.21.2",
|
||||
"base64 0.22.0",
|
||||
"brotli",
|
||||
"ico",
|
||||
"json-patch",
|
||||
@ -4550,9 +4556,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-macros"
|
||||
version = "2.0.0-beta.6"
|
||||
version = "2.0.0-beta.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0a75661fb86b350141e78ad54ce9c60346149afc5cbf41de2ca60a1ebc252b3"
|
||||
checksum = "2aa739d28ebddc149d781851a22f8d4f0d1e76de7d7348475c5072cb60f56c07"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
@ -4564,9 +4570,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin"
|
||||
version = "2.0.0-beta.6"
|
||||
version = "2.0.0-beta.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e9530f0f0d809e77ff9a93da5ff2483faf8fef2cb8ed125ca7b0172cb92685d4"
|
||||
checksum = "62895dc0fbcf604a20a1559e742b8eb79230e2c98564d0b99c77c953a48fd60d"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"glob",
|
||||
@ -4581,9 +4587,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-dialog"
|
||||
version = "2.0.0-beta.1"
|
||||
version = "2.0.0-beta.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ed2ac81ffb8fd76d854578784491bbf8d8baba274fa9e18c0bbdc4ba00b0013"
|
||||
checksum = "14c7894fb904ed003fd15915b263655672be4e4581298f7fa8916016e50010ed"
|
||||
dependencies = [
|
||||
"glib 0.16.9",
|
||||
"log",
|
||||
@ -4599,9 +4605,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-fs"
|
||||
version = "2.0.0-beta.1"
|
||||
version = "2.0.0-beta.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4a556b50d761ec405087bf67e82b3936ddeaf39d4d602a443e2a0d2df6cdb2a"
|
||||
checksum = "d5d71f69535111078131380bcf2a4c2f190ef4d045a33d787a606e7d4fc6a786"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"glob",
|
||||
@ -4618,13 +4624,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-http"
|
||||
version = "2.0.0-beta.1"
|
||||
version = "2.0.0-beta.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f5c00ebdfdab74d9669460665a1158dacd0cc692bf95a3b7d7e5160ebbd8ad0"
|
||||
checksum = "8ed4a2d9de58cafba4dbafff9330ed56b57176b9e6a153268113ffc66b5f70e7"
|
||||
dependencies = [
|
||||
"data-url",
|
||||
"glob",
|
||||
"http",
|
||||
"regex",
|
||||
"reqwest",
|
||||
"schemars",
|
||||
"serde",
|
||||
@ -4634,13 +4640,14 @@ dependencies = [
|
||||
"tauri-plugin-fs",
|
||||
"thiserror",
|
||||
"url",
|
||||
"urlpattern",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-os"
|
||||
version = "2.0.0-beta.1"
|
||||
version = "2.0.0-beta.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f9bd936030047ce0143dda585f908f4e8433089c4aa95ef182959283483abfb"
|
||||
checksum = "29d3b15199f234b9f9c9df69e75aaf0d3e001ffa71c53d7c91c0aaca02964503"
|
||||
dependencies = [
|
||||
"gethostname",
|
||||
"log",
|
||||
@ -4656,9 +4663,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-shell"
|
||||
version = "2.0.0-beta.1"
|
||||
version = "2.0.0-beta.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb42a100bd4b6adad6f07455f54c5916d32be79d81e5914478ece45a04560cad"
|
||||
checksum = "19e5c2d4187bc552d1be72081588c34187eb29e4c375cdfe99872f8d57b6aead"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"log",
|
||||
@ -4676,9 +4683,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-updater"
|
||||
version = "2.0.0-beta.1"
|
||||
version = "2.0.0-beta.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "587dfbe753c43e5db6c7f82b399c7c9f548c744ce7485d0f41a55ad7bb31d23c"
|
||||
checksum = "6cb1f95a0fa908434f19241137255ad84bc9433b4b5ce6727f26f6b22a74622e"
|
||||
dependencies = [
|
||||
"base64 0.21.2",
|
||||
"dirs-next",
|
||||
@ -4704,9 +4711,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-runtime"
|
||||
version = "2.0.0-beta.6"
|
||||
version = "2.0.0-beta.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0381b4b96e1f4f39a24ca6472c9b016151b103a54b1425233007fdbc26cf20a8"
|
||||
checksum = "b5a16d9e5634401c03477d2c3ff3d5c051efb05ed48fda5a8757e2d3e7859d6d"
|
||||
dependencies = [
|
||||
"gtk",
|
||||
"http",
|
||||
@ -4722,14 +4729,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-runtime-wry"
|
||||
version = "2.0.0-beta.6"
|
||||
version = "2.0.0-beta.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4eef6a8373c9936b33a58c1bdbdd76fe4603d00ebe72304c0777bf0674e455aa"
|
||||
checksum = "71cd401defa237dc112b9e53f40f628c1cac6dfdd56d6ecbba6ad85b5a016d0c"
|
||||
dependencies = [
|
||||
"cocoa",
|
||||
"gtk",
|
||||
"http",
|
||||
"jni",
|
||||
"log",
|
||||
"percent-encoding",
|
||||
"raw-window-handle 0.6.0",
|
||||
"softbuffer",
|
||||
@ -4745,9 +4753,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-utils"
|
||||
version = "2.0.0-beta.6"
|
||||
version = "2.0.0-beta.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92e35e2f9a5ee8539d00dde621f176647747736a388a07c3083a0cc1b96ba6d7"
|
||||
checksum = "1e9ab52971229a67ca96a8cefb7671d32aca844558518bda8e545ee5c8e1a787"
|
||||
dependencies = [
|
||||
"brotli",
|
||||
"cargo_metadata",
|
||||
@ -4764,6 +4772,7 @@ dependencies = [
|
||||
"phf 0.11.2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"schemars",
|
||||
"semver",
|
||||
"serde",
|
||||
@ -4773,6 +4782,7 @@ dependencies = [
|
||||
"thiserror",
|
||||
"toml 0.8.2",
|
||||
"url",
|
||||
"urlpattern",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
@ -4966,7 +4976,7 @@ version = "0.19.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
|
||||
dependencies = [
|
||||
"indexmap 2.0.0",
|
||||
"indexmap 2.2.5",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
@ -4979,7 +4989,7 @@ version = "0.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
|
||||
dependencies = [
|
||||
"indexmap 2.0.0",
|
||||
"indexmap 2.2.5",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
@ -5120,6 +5130,47 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unic-char-property"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221"
|
||||
dependencies = [
|
||||
"unic-char-range",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unic-char-range"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc"
|
||||
|
||||
[[package]]
|
||||
name = "unic-common"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc"
|
||||
|
||||
[[package]]
|
||||
name = "unic-ucd-ident"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e230a37c0381caa9219d67cf063aa3a375ffed5bf541a452db16e744bdab6987"
|
||||
dependencies = [
|
||||
"unic-char-property",
|
||||
"unic-char-range",
|
||||
"unic-ucd-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unic-ucd-version"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4"
|
||||
dependencies = [
|
||||
"unic-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicase"
|
||||
version = "2.7.0"
|
||||
@ -5174,6 +5225,19 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "urlpattern"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9bd5ff03aea02fa45b13a7980151fe45009af1980ba69f651ec367121a31609"
|
||||
dependencies = [
|
||||
"derive_more",
|
||||
"regex",
|
||||
"serde",
|
||||
"unic-ucd-ident",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf-8"
|
||||
version = "0.7.6"
|
||||
|
@ -55,5 +55,5 @@
|
||||
}
|
||||
},
|
||||
"productName": "zoo-modeling-app",
|
||||
"version": "0.15.5"
|
||||
"version": "0.15.6"
|
||||
}
|
||||
|
@ -731,6 +731,7 @@ export class CameraControls {
|
||||
|
||||
async tweenCameraToQuaternion(
|
||||
targetQuaternion: Quaternion,
|
||||
targetPosition = new Vector3(),
|
||||
duration = 500,
|
||||
toOrthographic = true
|
||||
): Promise<void> {
|
||||
@ -750,12 +751,14 @@ export class CameraControls {
|
||||
}
|
||||
await this._tweenCameraToQuaternion(
|
||||
targetQuaternion,
|
||||
targetPosition,
|
||||
remainingDuration,
|
||||
toOrthographic
|
||||
)
|
||||
}
|
||||
_tweenCameraToQuaternion(
|
||||
targetQuaternion: Quaternion,
|
||||
targetPosition: Vector3,
|
||||
duration = 500,
|
||||
toOrthographic = false
|
||||
): Promise<void> {
|
||||
@ -763,10 +766,11 @@ export class CameraControls {
|
||||
const camera = this.camera
|
||||
this._isCamMovingCallback(true, true)
|
||||
const initialQuaternion = camera.quaternion.clone()
|
||||
const initialTarget = this.target.clone()
|
||||
const isVertical = isQuaternionVertical(targetQuaternion)
|
||||
let tweenEnd = isVertical ? 0.99 : 1
|
||||
const controlsTarget = this.target.clone()
|
||||
const initialDistance = controlsTarget.distanceTo(camera.position.clone())
|
||||
const tempVec = new Vector3()
|
||||
const initialDistance = initialTarget.distanceTo(camera.position.clone())
|
||||
|
||||
const cameraAtTime = (animationProgress: number /* 0 - 1 */) => {
|
||||
const currentQ = tempQuaternion.slerpQuaternions(
|
||||
@ -774,6 +778,11 @@ export class CameraControls {
|
||||
targetQuaternion,
|
||||
animationProgress
|
||||
)
|
||||
const currentTarget = tempVec.lerpVectors(
|
||||
initialTarget,
|
||||
targetPosition,
|
||||
animationProgress
|
||||
)
|
||||
if (this.camera instanceof PerspectiveCamera)
|
||||
// changing the camera position back when it's orthographic doesn't do anything
|
||||
// and it messes up animating back to perspective later
|
||||
@ -781,12 +790,11 @@ export class CameraControls {
|
||||
.set(0, 0, 1)
|
||||
.applyQuaternion(currentQ)
|
||||
.multiplyScalar(initialDistance)
|
||||
.add(controlsTarget)
|
||||
.add(currentTarget)
|
||||
|
||||
this.camera.up.set(0, 1, 0).applyQuaternion(currentQ).normalize()
|
||||
this.camera.quaternion.copy(currentQ)
|
||||
this.target.copy(controlsTarget)
|
||||
// this.controls.update()
|
||||
this.target.copy(currentTarget)
|
||||
this.camera.updateProjectionMatrix()
|
||||
this.update()
|
||||
this.onCameraChange()
|
||||
|
@ -1,6 +1,6 @@
|
||||
.button {
|
||||
@apply flex justify-between items-center gap-2 px-2 py-1 text-left border-none rounded-sm;
|
||||
@apply font-mono text-xs font-bold select-none text-chalkboard-90;
|
||||
@apply font-mono !no-underline text-xs font-bold select-none text-chalkboard-90;
|
||||
@apply ui-active:bg-energy-10/50 ui-active:text-inherit;
|
||||
@apply transition-colors ease-out;
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
import { Menu } from '@headlessui/react'
|
||||
import { PropsWithChildren } from 'react'
|
||||
import {
|
||||
faArrowUpRightFromSquare,
|
||||
faEllipsis,
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
import { faArrowUpRightFromSquare } from '@fortawesome/free-solid-svg-icons'
|
||||
import { ActionIcon } from './ActionIcon'
|
||||
import styles from './CodeMenu.module.css'
|
||||
import { useConvertToVariable } from 'hooks/useToolbarGuards'
|
||||
@ -29,7 +26,7 @@ export const CodeMenu = ({ children }: PropsWithChildren) => {
|
||||
>
|
||||
<Menu.Button className="p-0 border-none relative">
|
||||
<ActionIcon
|
||||
icon={faEllipsis}
|
||||
icon="three-dots"
|
||||
className="p-1"
|
||||
size="sm"
|
||||
bgClassName={
|
||||
|
@ -29,6 +29,7 @@ export type CustomIconName =
|
||||
| 'search'
|
||||
| 'settings'
|
||||
| 'sketch'
|
||||
| 'three-dots'
|
||||
| 'vertical'
|
||||
|
||||
export const CustomIcon = ({
|
||||
@ -516,6 +517,22 @@ export const CustomIcon = ({
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
case 'three-dots':
|
||||
return (
|
||||
<svg
|
||||
{...props}
|
||||
viewBox="0 0 20 20"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M6.5 10C6.5 10.8284 5.82843 11.5 5 11.5C4.17157 11.5 3.5 10.8284 3.5 10C3.5 9.17157 4.17157 8.5 5 8.5C5.82843 8.5 6.5 9.17157 6.5 10ZM11.5 10C11.5 10.8284 10.8284 11.5 10 11.5C9.17157 11.5 8.5 10.8284 8.5 10C8.5 9.17157 9.17157 8.5 10 8.5C10.8284 8.5 11.5 9.17157 11.5 10ZM15 11.5C15.8284 11.5 16.5 10.8284 16.5 10C16.5 9.17157 15.8284 8.5 15 8.5C14.1716 8.5 13.5 9.17157 13.5 10C13.5 10.8284 14.1716 11.5 15 11.5Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
case 'vertical':
|
||||
return (
|
||||
<svg
|
||||
|
@ -106,7 +106,7 @@ function ProjectCard({
|
||||
<>
|
||||
<div className="p-1 flex flex-col h-full gap-2">
|
||||
<Link
|
||||
className="flex-1 text-liquid-100 after:content-[''] after:absolute after:inset-0"
|
||||
className="flex-1 !no-underline text-liquid-100 after:content-[''] after:absolute after:inset-0"
|
||||
to={`${paths.FILE}/${encodeURIComponent(project.path)}`}
|
||||
data-testid="project-link"
|
||||
>
|
||||
|
@ -11,6 +11,7 @@ import { sep } from '@tauri-apps/api/path'
|
||||
import { Logo } from './Logo'
|
||||
import { APP_NAME } from 'lib/constants'
|
||||
import { useCommandsContext } from 'hooks/useCommandsContext'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
|
||||
const ProjectSidebarMenu = ({
|
||||
project,
|
||||
@ -21,15 +22,18 @@ const ProjectSidebarMenu = ({
|
||||
project?: IndexLoaderData['project']
|
||||
file?: IndexLoaderData['file']
|
||||
}) => {
|
||||
const { commandBarSend } = useCommandsContext()
|
||||
|
||||
return renderAsLink ? (
|
||||
return (
|
||||
<div className="rounded-sm !no-underline h-9 mr-auto max-h-min min-w-max border-0 py-1 px-2 flex items-center gap-2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-energy-50 dark:hover:bg-chalkboard-90">
|
||||
<Link to={paths.HOME} className="group">
|
||||
<Logo className="w-auto h-5 text-chalkboard-120 dark:text-chalkboard-10 group-hover:text-energy-10" />
|
||||
</Link>
|
||||
{renderAsLink ? (
|
||||
<>
|
||||
<Link
|
||||
to={paths.HOME}
|
||||
className="rounded-sm h-9 mr-auto max-h-min min-w-max border-0 py-1 px-2 flex items-center gap-3 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-energy-50 dark:hover:bg-chalkboard-90"
|
||||
className="!no-underline"
|
||||
data-testid="project-sidebar-link"
|
||||
>
|
||||
<Logo />
|
||||
<span
|
||||
className="hidden text-sm text-chalkboard-110 dark:text-chalkboard-20 whitespace-nowrap lg:block"
|
||||
data-testid="project-sidebar-link-name"
|
||||
@ -37,13 +41,30 @@ const ProjectSidebarMenu = ({
|
||||
{project?.name ? project.name : APP_NAME}
|
||||
</span>
|
||||
</Link>
|
||||
</>
|
||||
) : (
|
||||
<ProjectMenuPopover project={project} file={file} />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function ProjectMenuPopover({
|
||||
project,
|
||||
file,
|
||||
}: {
|
||||
project?: IndexLoaderData['project']
|
||||
file?: IndexLoaderData['file']
|
||||
}) {
|
||||
const { commandBarSend } = useCommandsContext()
|
||||
|
||||
return (
|
||||
<Popover className="relative">
|
||||
<Popover.Button
|
||||
className="rounded-sm h-9 mr-auto max-h-min min-w-max border-0 py-1 px-2 flex items-center gap-3 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-energy-50 dark:hover:bg-chalkboard-90"
|
||||
className="rounded-sm h-9 mr-auto max-h-min min-w-max border-0 py-1 pl-0 pr-2 flex items-center focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-energy-50 dark:hover:bg-chalkboard-90"
|
||||
data-testid="project-sidebar-toggle"
|
||||
>
|
||||
<Logo />
|
||||
<CustomIcon name="three-dots" className="w-5 h-5 rotate-90" />
|
||||
<div className="flex flex-col items-start py-0.5">
|
||||
<span className="hidden text-sm text-chalkboard-110 dark:text-chalkboard-20 whitespace-nowrap lg:block">
|
||||
{isTauri() && file?.name
|
||||
@ -85,7 +106,6 @@ const ProjectSidebarMenu = ({
|
||||
{({ close }) => (
|
||||
<>
|
||||
<div className="flex items-center gap-4 px-4 py-3">
|
||||
<Logo />
|
||||
<div>
|
||||
<p
|
||||
className="m-0 text-chalkboard-100 dark:text-energy-10 text-mono"
|
||||
|
@ -88,11 +88,11 @@ button:disabled {
|
||||
}
|
||||
|
||||
a:not(.action-button) {
|
||||
@apply text-energy-70 hover:text-energy-60;
|
||||
@apply text-energy-70 hover:text-energy-60 underline;
|
||||
}
|
||||
|
||||
.dark a:not(.action-button) {
|
||||
@apply text-chalkboard-20 hover:text-energy-10;
|
||||
@apply text-energy-20 hover:text-energy-10;
|
||||
}
|
||||
|
||||
input {
|
||||
|
@ -27,22 +27,34 @@ export type Toggle = 'On' | 'Off'
|
||||
|
||||
export const SETTINGS_PERSIST_KEY = 'SETTINGS_PERSIST_KEY'
|
||||
|
||||
type SettingsMachineContext = {
|
||||
baseUnit: BaseUnit
|
||||
cameraControls: CameraSystem
|
||||
defaultDirectory: string
|
||||
defaultProjectName: string
|
||||
onboardingStatus: string
|
||||
showDebugPanel: boolean
|
||||
textWrapping: Toggle
|
||||
theme: Themes
|
||||
unitSystem: UnitSystem
|
||||
}
|
||||
|
||||
export const settingsMachine = createMachine(
|
||||
{
|
||||
/** @xstate-layout N4IgpgJg5mDOIC5QGUwBc0EsB2VYDpMIAbMAYlTQAIAVACzAFswBtABgF1FQAHAe1iYsfbNxAAPRAA42+AEwB2KQFYAzGznKAnADZli1QBoQAT2kBGKfm37lOned3nzqgL6vjlLLgJFSFdCoAETAAMwBDAFdiagAFACc+ACswAGNqADlw5nYuJBB+QWFRfMkEABY5fDYa2rra83LjMwQdLWV8BXLyuxlVLU1Ld090bzxCEnJKYLComODMeLS0PniTXLFCoUwRMTK7fC1zNql7NgUjtnKjU0RlBSqpLVUVPVUda60tYZAvHHG-FNAgBVbBCKjIEywNBMDb5LbFPaILqdfRSORsS4qcxXZqIHqyK6qY4XOxsGTKco-P4+Cb+aYAIXCsDAVFBQjhvAE212pWkskUKnUml0+gUNxaqkU+EccnKF1UCnucnMcjcHl+o3+vkmZBofCgUFIMwARpEoFRYuFsGBiJyCtzEXzWrJlGxlKdVFKvfY1XiEBjyvhVOVzBdzu13pYFNStbTAQFqAB5bAmvjheIQf4QtDhNCRWD2hE7EqgfayHTEh7lHQNSxSf1Scz4cpHHFyFVujTKczuDXYPgQOBiGl4TaOktIhAAWg6X3nC4Xp39050sYw2rpYHHRUnztVhPJqmUlIGbEriv9WhrLZ6uibHcqUr7riAA */
|
||||
id: 'Settings',
|
||||
predictableActionArguments: true,
|
||||
context: {
|
||||
baseUnit: 'mm' as BaseUnit,
|
||||
cameraControls: 'KittyCAD' as CameraSystem,
|
||||
baseUnit: 'mm',
|
||||
cameraControls: 'KittyCAD',
|
||||
defaultDirectory: '',
|
||||
defaultProjectName: DEFAULT_PROJECT_NAME,
|
||||
onboardingStatus: '',
|
||||
showDebugPanel: false,
|
||||
textWrapping: 'On' as Toggle,
|
||||
textWrapping: 'On',
|
||||
theme: Themes.System,
|
||||
unitSystem: UnitSystem.Metric,
|
||||
},
|
||||
} as SettingsMachineContext,
|
||||
initial: 'idle',
|
||||
states: {
|
||||
idle: {
|
||||
|
@ -33,9 +33,10 @@ export default function Units() {
|
||||
}
|
||||
>
|
||||
<SettingsSection
|
||||
title="Camera Controls"
|
||||
description="How you want to control the camera in the 3D view. Try them out above and choose the one that feels most comfortable to you."
|
||||
title="Mouse Controls"
|
||||
description="Choose what buttons you want to use on your mouse or trackpad to move around the 3D view. Try them out above and choose the one that feels most comfortable to you."
|
||||
className="my-4 last-of-type:mb-12"
|
||||
headingClassName="text-3xl font-bold"
|
||||
>
|
||||
<select
|
||||
id="camera-controls"
|
||||
@ -70,6 +71,7 @@ export default function Units() {
|
||||
</ul>
|
||||
</SettingsSection>
|
||||
<OnboardingButtons
|
||||
currentSlug={onboardingPaths.CAMERA}
|
||||
dismiss={dismiss}
|
||||
next={next}
|
||||
nextText="Next: Streaming"
|
||||
|
@ -1,5 +1,5 @@
|
||||
import usePlatform from 'hooks/usePlatform'
|
||||
import { OnboardingButtons, useDismiss, useNextClick } from '.'
|
||||
import { OnboardingButtons, kbdClasses, useDismiss, useNextClick } from '.'
|
||||
import { onboardingPaths } from 'routes/Onboarding/paths'
|
||||
import { useStore } from '../../useStore'
|
||||
|
||||
@ -24,11 +24,11 @@ export default function CmdK() {
|
||||
Press{' '}
|
||||
{platformName === 'macos' ? (
|
||||
<>
|
||||
<kbd>⌘</kbd> + <kbd>K</kbd>
|
||||
<kbd className={kbdClasses}>⌘K</kbd>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<kbd>Ctrl</kbd> + <kbd>/</kbd>
|
||||
<kbd className={kbdClasses}>Ctrl + /</kbd>
|
||||
</>
|
||||
)}{' '}
|
||||
to open the command bar. Try changing your theme with it.
|
||||
@ -44,11 +44,11 @@ export default function CmdK() {
|
||||
>
|
||||
XState
|
||||
</a>
|
||||
. Currently you can only control settings, authentication, and file
|
||||
management from the command bar, but we will be powering modeling
|
||||
commands with it soon.
|
||||
. You can control settings, authentication, and file management from
|
||||
the command bar, as well as a growing number of modeling commands.
|
||||
</p>
|
||||
<OnboardingButtons
|
||||
currentSlug={onboardingPaths.COMMAND_K}
|
||||
dismiss={dismiss}
|
||||
next={next}
|
||||
nextText="Next: User Menu"
|
||||
|
@ -13,7 +13,7 @@ export default function CodeEditor() {
|
||||
return (
|
||||
<div className="fixed grid justify-end items-center inset-0 z-50 pointer-events-none">
|
||||
<div
|
||||
className="fixed inset-0 bg-black opacity-50 pointer-events-none"
|
||||
className="fixed inset-0 bg-black opacity-50 dark:opacity-80 pointer-events-none"
|
||||
style={{ clipPath: useBackdropHighlight('code-pane') }}
|
||||
></div>
|
||||
<div
|
||||
@ -23,24 +23,45 @@ export default function CodeEditor() {
|
||||
}
|
||||
>
|
||||
<section className="flex-1">
|
||||
<h2 className="text-2xl font-bold">
|
||||
Editing code with <code>kcl</code>
|
||||
<h2 className="text-3xl font-bold">
|
||||
Editing code with{' '}
|
||||
<span className="text-energy-60 dark:text-energy-20">kcl</span>
|
||||
</h2>
|
||||
<p className="my-4">
|
||||
The left pane is where you write your code. It's a code editor with
|
||||
syntax highlighting and autocompletion. We've decided to take the
|
||||
difficult route of writing our own language—called <code>kcl</code>
|
||||
—for describing geometry, because we don't want to inherit all the
|
||||
other functionality from existing languages. We have a lot of ideas
|
||||
about how <code>kcl</code> will evolve, and we want to hear your
|
||||
thoughts on it.
|
||||
kcl is our language for describing geometry. Building our own
|
||||
language is difficult, but we chose to do it to have a language
|
||||
honed for spatial relationships and geometric computation. It'll
|
||||
always be open-source, and we hope it can grow into a new standard
|
||||
for describing parametric objects.
|
||||
</p>
|
||||
<p className="my-4">
|
||||
We've built a language server for <code>kcl</code> that provides
|
||||
documentation and autocompletion automatically generated from our
|
||||
compiler code. You can try it out by hovering over some of the
|
||||
function names in the pane now. If you like using VSCode, you can
|
||||
try out our{' '}
|
||||
The left pane is where you write your code. It's a code editor with
|
||||
syntax highlighting and autocompletion for kcl. New features arrive
|
||||
in kcl before they're available as point-and-click tools, so it's
|
||||
good to have a link to{' '}
|
||||
<a
|
||||
href="https://github.com/KittyCAD/modeling-app/blob/main/docs/kcl/std.md"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
our kcl docs
|
||||
</a>{' '}
|
||||
handy while you design for now. It's also available in the menu in
|
||||
the corner of the code pane.
|
||||
</p>
|
||||
<p className="my-4">
|
||||
We've built a{' '}
|
||||
<a
|
||||
href="https://github.com/KittyCAD/kcl-lsp"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
language server
|
||||
</a>{' '}
|
||||
for kcl that provides documentation and autocompletion automatically
|
||||
generated from our compiler code. You can try it out by hovering
|
||||
over some of the function names in the pane now. If you like using
|
||||
VSCode, you can try out our{' '}
|
||||
<a
|
||||
href="https://marketplace.visualstudio.com/items?itemName=KittyCAD.kcl-language-server"
|
||||
rel="noreferrer noopener"
|
||||
@ -57,6 +78,7 @@ export default function CodeEditor() {
|
||||
</p>
|
||||
</section>
|
||||
<OnboardingButtons
|
||||
currentSlug={onboardingPaths.EDITOR}
|
||||
dismiss={dismiss}
|
||||
next={next}
|
||||
nextText="Next: Parametric Modeling"
|
||||
|
@ -32,7 +32,7 @@ export default function Export() {
|
||||
>
|
||||
our open-source extension proposal
|
||||
</a>{' '}
|
||||
for the GLTF file format.{' '}
|
||||
for the gLTF file format.{' '}
|
||||
<a
|
||||
href="https://zoo.dev/docs/api/convert-cad-file"
|
||||
rel="noopener noreferrer"
|
||||
@ -43,8 +43,20 @@ export default function Export() {
|
||||
can convert to and from most common CAD file formats, allowing
|
||||
export to almost any CAD software.
|
||||
</p>
|
||||
<p className="my-4">
|
||||
Our teammate David is working on the file format, check out{' '}
|
||||
<a
|
||||
href="https://www.youtube.com/watch?v=8SuW0qkYCZo"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
his talk with the Metaverse Standards Forum
|
||||
</a>
|
||||
!
|
||||
</p>
|
||||
</section>
|
||||
<OnboardingButtons
|
||||
currentSlug={onboardingPaths.EXPORT}
|
||||
next={next}
|
||||
dismiss={dismiss}
|
||||
nextText="Next: Sketching"
|
||||
|
@ -4,6 +4,7 @@ import { bracket } from 'lib/exampleKcl'
|
||||
import { kclManager } from 'lang/KclSingleton'
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
import { APP_NAME } from 'lib/constants'
|
||||
import { onboardingPaths } from './paths'
|
||||
|
||||
export default function FutureWork() {
|
||||
const { send } = useModelingContext()
|
||||
@ -28,16 +29,39 @@ export default function FutureWork() {
|
||||
<p className="my-4">
|
||||
We have curves, cuts, and many more CAD features coming soon. We want
|
||||
your feedback on this user interface, and we want to know what
|
||||
features you want to see next. Please message us in the Discord server
|
||||
and open issues on GitHub.
|
||||
features you want to see next. Please message us in{' '}
|
||||
<a
|
||||
href="https://discord.gg/JQEpHR7Nt2"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
our Discord server
|
||||
</a>
|
||||
and{' '}
|
||||
<a
|
||||
href="https://github.com/KittyCAD/modeling-app/issues/new/choose"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
open issues on GitHub
|
||||
</a>
|
||||
.
|
||||
</p>
|
||||
<p className="my-4">
|
||||
If you make anything with the app we'd love to see it! Thank you for
|
||||
taking time to try out {APP_NAME}, and build the future of hardware
|
||||
design with us.
|
||||
If you make anything with the app we'd love to see it, feel free to{' '}
|
||||
<a
|
||||
href="https://twitter.com/zoodotdev"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
tag us on X
|
||||
</a>
|
||||
! Thank you for taking time to try out {APP_NAME}, and build the
|
||||
future of hardware design with us.
|
||||
</p>
|
||||
<p className="my-4">💚 The Zoo Team</p>
|
||||
<OnboardingButtons
|
||||
currentSlug={onboardingPaths.FUTURE_WORK}
|
||||
className="mt-6"
|
||||
dismiss={dismiss}
|
||||
next={dismiss}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { OnboardingButtons, useDismiss, useNextClick } from '.'
|
||||
import { OnboardingButtons, kbdClasses, useDismiss, useNextClick } from '.'
|
||||
import { onboardingPaths } from 'routes/Onboarding/paths'
|
||||
import { useStore } from '../../useStore'
|
||||
import { useBackdropHighlight } from 'hooks/useBackdropHighlight'
|
||||
@ -23,52 +23,32 @@ export default function InteractiveNumbers() {
|
||||
}
|
||||
>
|
||||
<section className="flex-1 overflow-y-auto mb-6">
|
||||
<h2 className="text-2xl font-bold">Interactive Numbers</h2>
|
||||
<h2 className="text-3xl font-bold">Hybrid editing</h2>
|
||||
|
||||
<p className="my-4">
|
||||
Let's do a little bit of hybrid editing to this part.
|
||||
</p>
|
||||
<p className="my-4">
|
||||
Try changing the value of <code>width</code> on line 3 by holding
|
||||
the <kbd>Alt</kbd> (or <kbd>Option</kbd>) key and dragging the
|
||||
Try changing the value of <code>width</code> on line 2 by holding
|
||||
the <kbd className={kbdClasses}>Alt</kbd> (or{' '}
|
||||
<kbd className={kbdClasses}>Option</kbd>) key and dragging the
|
||||
number left and right. You can hold down different modifier keys to
|
||||
change the value by different increments:
|
||||
</p>
|
||||
<table className="border-collapse text-sm mx-auto my-4">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td className="border border-solid w-1/2 py-1 px-2 border-chalkboard-40 dark:border-chalkboard-70">
|
||||
<kbd>Alt + Shift + Cmd/Win</kbd>
|
||||
</td>
|
||||
<td className="border border-solid w-1/2 py-1 px-2 border-chalkboard-40 dark:border-chalkboard-70 text-right">
|
||||
0.01
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="border border-solid w-1/2 py-1 px-2 border-chalkboard-40 dark:border-chalkboard-70">
|
||||
<kbd>Alt + Cmd/Win</kbd>
|
||||
</td>
|
||||
<td className="border border-solid w-1/2 py-1 px-2 border-chalkboard-40 dark:border-chalkboard-70 text-right">
|
||||
0.1
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="border border-solid w-1/2 py-1 px-2 border-chalkboard-40 dark:border-chalkboard-70">
|
||||
<kbd>Alt</kbd>
|
||||
</td>
|
||||
<td className="border border-solid w-1/2 py-1 px-2 border-chalkboard-40 dark:border-chalkboard-70 text-right">
|
||||
1
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="border border-solid w-1/2 py-1 px-2 border-chalkboard-40 dark:border-chalkboard-70">
|
||||
<kbd>Alt + Shift</kbd>
|
||||
</td>
|
||||
<td className="border border-solid w-1/2 py-1 px-2 border-chalkboard-40 dark:border-chalkboard-70 text-right">
|
||||
10
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<ul className="flex flex-col text-sm my-4 mx-12 divide-y divide-chalkboard-20 dark:divide-chalkboard-70">
|
||||
<li className="flex justify-between m-0 px-0 py-2">
|
||||
<kbd className={kbdClasses}>Alt + Shift + Cmd/Win</kbd>
|
||||
±0.01
|
||||
</li>
|
||||
<li className="flex justify-between m-0 px-0 py-2">
|
||||
<kbd className={kbdClasses}>Alt + Cmd/Win</kbd>
|
||||
±0.1
|
||||
</li>
|
||||
<li className="flex justify-between m-0 px-0 py-2">
|
||||
<kbd className={kbdClasses}>Alt</kbd>±1
|
||||
</li>
|
||||
<li className="flex justify-between m-0 px-0 py-2">
|
||||
<kbd className={kbdClasses}>Alt + Shift</kbd>
|
||||
±10
|
||||
</li>
|
||||
</ul>
|
||||
<p className="my-4">
|
||||
Our code editor is built with{' '}
|
||||
<a
|
||||
@ -90,13 +70,14 @@ export default function InteractiveNumbers() {
|
||||
lets you interact with numbers in your code by dragging them around.
|
||||
</p>
|
||||
<p className="my-4">
|
||||
Editing code should feel as interactive as point-and-click when you
|
||||
want it to be, so that you can work in the way that feels most
|
||||
We believe editing in Modeling App should feel fluid between code
|
||||
and point-and-click, so that you can work in the way that feels most
|
||||
natural to you. We're going to keep extending the text editor, and
|
||||
we'd love to hear your ideas for how to make it better.
|
||||
</p>
|
||||
</section>
|
||||
<OnboardingButtons
|
||||
currentSlug={onboardingPaths.INTERACTIVE_NUMBERS}
|
||||
dismiss={dismiss}
|
||||
next={next}
|
||||
nextText="Next: Command Bar"
|
||||
|
@ -58,7 +58,7 @@ function OnboardingWithNewFile() {
|
||||
<div className="max-w-3xl p-8 rounded bg-chalkboard-10 dark:bg-chalkboard-90">
|
||||
{!isTauri() ? (
|
||||
<>
|
||||
<h1 className="text-2xl font-bold text-warn-80 dark:text-warn-10">
|
||||
<h1 className="text-3xl font-bold text-warn-80 dark:text-warn-10">
|
||||
Replaying onboarding resets your code
|
||||
</h1>
|
||||
<p className="my-4">
|
||||
@ -77,7 +77,7 @@ function OnboardingWithNewFile() {
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<h1 className="flex flex-wrap items-center gap-4 text-2xl font-bold">
|
||||
<h1 className="flex flex-wrap items-center gap-4 text-3xl font-bold">
|
||||
Would you like to create a new project?
|
||||
</h1>
|
||||
<section className="my-12">
|
||||
@ -128,7 +128,7 @@ export default function Introduction() {
|
||||
return isStarterCode ? (
|
||||
<div className="fixed inset-0 z-50 grid place-content-center bg-chalkboard-110/50">
|
||||
<div className="max-w-3xl p-8 rounded bg-chalkboard-10 dark:bg-chalkboard-90">
|
||||
<h1 className="flex flex-wrap items-center gap-4 text-2xl font-bold">
|
||||
<h1 className="flex flex-wrap items-center gap-4 text-3xl font-bold">
|
||||
<img
|
||||
src={`/zma-logomark${getLogoTheme()}.svg`}
|
||||
alt={APP_NAME}
|
||||
@ -156,11 +156,20 @@ export default function Introduction() {
|
||||
>
|
||||
expectations for alpha users here
|
||||
</a>
|
||||
. Please give us feedback on your experience! We are trying to
|
||||
release as early as possible to get feedback from users like you.
|
||||
, and please give us feedback on your experience{' '}
|
||||
<a
|
||||
href="https://discord.com/invite/JQEpHR7Nt2"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
our Discord
|
||||
</a>
|
||||
! We are trying to release as early as possible to get feedback from
|
||||
users like you.
|
||||
</p>
|
||||
</section>
|
||||
<OnboardingButtons
|
||||
currentSlug={onboardingPaths.INDEX}
|
||||
className="mt-6"
|
||||
dismiss={dismiss}
|
||||
next={next}
|
||||
|
@ -25,7 +25,7 @@ export default function ParametricModeling() {
|
||||
return (
|
||||
<div className="fixed grid justify-end items-center inset-0 z-50 pointer-events-none">
|
||||
<div
|
||||
className="fixed inset-0 bg-black opacity-50 pointer-events-none"
|
||||
className="fixed inset-0 bg-black dark:bg-black-80 opacity-50 pointer-events-none"
|
||||
style={{ clipPath: useBackdropHighlight('code-pane') }}
|
||||
></div>
|
||||
<div
|
||||
@ -35,16 +35,21 @@ export default function ParametricModeling() {
|
||||
}
|
||||
>
|
||||
<section className="flex-1 overflow-y-auto mb-6">
|
||||
<h2 className="text-2xl font-bold">
|
||||
Towards true parametric modeling
|
||||
</h2>
|
||||
<h2 className="text-3xl font-bold">Parametric modeling with kcl</h2>
|
||||
<p className="my-4">
|
||||
This example script shows how having access to the code
|
||||
representation of a part can allow us to do things that are tedious
|
||||
or impossible in traditional CAD software. Here we are building a
|
||||
simplified shelf bracket out of aluminum:
|
||||
This example script shows how a code representation of your design
|
||||
makes easy work of tedious tasks in traditional CAD software, such
|
||||
as calculating a safety factor.
|
||||
</p>
|
||||
<figure className="my-4 w-3/4 mx-auto">
|
||||
|
||||
<p className="my-4">
|
||||
We've received this sketch from a designer highlighting an{' '}
|
||||
<em className="text-energy-60 dark:text-energy-20">
|
||||
aluminum bracket
|
||||
</em>{' '}
|
||||
they need for this shelf:
|
||||
</p>
|
||||
<figure className="my-4 w-2/3 mx-auto">
|
||||
<img
|
||||
src={`/onboarding-bracket${getImageTheme()}.png`}
|
||||
alt="Bracket"
|
||||
@ -55,10 +60,12 @@ export default function ParametricModeling() {
|
||||
</figure>
|
||||
<p className="my-4">
|
||||
We are able to easily calculate the thickness of the material based
|
||||
on the width of the bracket to meet a set safety factor on line 6.
|
||||
on the width of the bracket to meet a set safety factor on{' '}
|
||||
<em className="text-energy-60 dark:text-energy-20">line 6</em>.
|
||||
</p>
|
||||
</section>
|
||||
<OnboardingButtons
|
||||
currentSlug={onboardingPaths.PARAMETRIC_MODELING}
|
||||
dismiss={dismiss}
|
||||
next={next}
|
||||
nextText="Next: Interactive Numbers"
|
||||
|
@ -9,6 +9,7 @@ export default function ProjectMenu() {
|
||||
}))
|
||||
const dismiss = useDismiss()
|
||||
const next = useNextClick(onboardingPaths.EXPORT)
|
||||
const tauri = isTauri()
|
||||
|
||||
return (
|
||||
<div className="fixed grid justify-center items-start inset-0 z-50 pointer-events-none">
|
||||
@ -21,13 +22,47 @@ export default function ProjectMenu() {
|
||||
<section className="flex-1">
|
||||
<h2 className="text-2xl font-bold">Project Menu</h2>
|
||||
<p className="my-4">
|
||||
Click on the Zoo logo in the upper left to open the project menu.
|
||||
You can only {isTauri() && 'go home or '}export your model—which
|
||||
we'll talk about next—for now. We'll add more options here soon,
|
||||
especially as we add support for multi-file assemblies.
|
||||
Click on your part's name in the upper left to open the project
|
||||
menu.
|
||||
{tauri && (
|
||||
<> You can click the Zoo logo to quickly navigate home.</>
|
||||
)}
|
||||
</p>
|
||||
{tauri ? (
|
||||
<>
|
||||
<p className="my-4">
|
||||
From here you can manage files in your project and export your
|
||||
current part. Your projects are{' '}
|
||||
<strong>all saved locally</strong> as a folder on your device.
|
||||
You can configure where projects are saved in the settings.
|
||||
</p>
|
||||
<p className="my-4">
|
||||
We are working to support assemblies as separate kcl files
|
||||
importing parts from each other, but for now you can only open
|
||||
and export individual parts.
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p className="my-4">
|
||||
From here you can export your part. You can't manage separate
|
||||
files and separate projects from the browser; you have to{' '}
|
||||
<a
|
||||
href="https://zoo.dev/modeling-app/download"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
download the desktop app
|
||||
</a>{' '}
|
||||
for that. We aren't hosting files for you at this time but are
|
||||
considering supporting it in the future, so we're building
|
||||
Modeling App with a browser-first experience in mind.
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</section>
|
||||
<OnboardingButtons
|
||||
currentSlug={onboardingPaths.PROJECT_MENU}
|
||||
next={next}
|
||||
dismiss={dismiss}
|
||||
nextText="Next: Export"
|
||||
|
@ -39,6 +39,7 @@ export default function Sketching() {
|
||||
always just modifying and generating code in Zoo Modeling App.
|
||||
</p>
|
||||
<OnboardingButtons
|
||||
currentSlug={onboardingPaths.SKETCHING}
|
||||
className="mt-6"
|
||||
next={next}
|
||||
dismiss={dismiss}
|
||||
|
@ -18,18 +18,28 @@ export default function Streaming() {
|
||||
}
|
||||
>
|
||||
<section className="flex-1">
|
||||
<h2 className="text-2xl font-bold">Streaming Video</h2>
|
||||
<h2 className="text-3xl font-bold">Streaming Video</h2>
|
||||
<p className="my-4">
|
||||
The 3D view is not running on your computer. Instead, our
|
||||
infrastructure spins up our Geometry Engine on a remote GPU,
|
||||
Modeling App sends it a series of commands via Websockets and
|
||||
WebRTC, and the Geometry Engine sends back a video stream of the 3D
|
||||
view.
|
||||
Historically, CAD programs run on your computer, so to run
|
||||
performance-heavy apps you have to have a powerful, expensive
|
||||
desktop. But the 3D scene you see here is not running on your
|
||||
computer.
|
||||
</p>
|
||||
<p className="my-4">
|
||||
This means that you could run our Modeling App on a Chromebook, a
|
||||
tablet, or even a phone, as long as you have a good internet
|
||||
connection.
|
||||
Instead, our infrastructure spins up our Geometry Engine on a remote
|
||||
GPU, Modeling App sends it a series of commands{' '}
|
||||
<a
|
||||
href="https://zoo.dev/blog/cad-webrtc"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
via Websockets and WebRTC
|
||||
</a>
|
||||
, and the Geometry Engine sends back a video stream of the 3D view.
|
||||
</p>
|
||||
<p className="my-4">
|
||||
This means that you could run our Modeling App on nearly any device
|
||||
with a good internet connection.
|
||||
</p>
|
||||
<p className="my-4">
|
||||
It also means that whatever tools you build on top of our Geometry
|
||||
@ -38,6 +48,7 @@ export default function Streaming() {
|
||||
</p>
|
||||
</section>
|
||||
<OnboardingButtons
|
||||
currentSlug={onboardingPaths.STREAMING}
|
||||
dismiss={dismiss}
|
||||
next={next}
|
||||
nextText="Next: Code Editor"
|
||||
|
@ -23,8 +23,21 @@ export default function UserMenu() {
|
||||
Click your avatar on the upper right to open the user menu. You can
|
||||
change your settings, sign out, or request a feature.
|
||||
</p>
|
||||
<p className="my-4">
|
||||
We only support global settings at the moment, but we are working to
|
||||
implement{' '}
|
||||
<a
|
||||
href="https://github.com/KittyCAD/modeling-app/issues/1503"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
per-project settings
|
||||
</a>{' '}
|
||||
now.
|
||||
</p>
|
||||
</section>
|
||||
<OnboardingButtons
|
||||
currentSlug={onboardingPaths.USER_MENU}
|
||||
dismiss={dismiss}
|
||||
next={next}
|
||||
nextText="Next: Project Menu"
|
||||
|
@ -21,6 +21,8 @@ import { ActionButton } from 'components/ActionButton'
|
||||
import { onboardingPaths } from 'routes/Onboarding/paths'
|
||||
|
||||
export const ONBOARDING_PROJECT_NAME = 'Tutorial Project $nn'
|
||||
export const kbdClasses =
|
||||
'p-0.5 text-sm rounded-sm bg-chalkboard-10 dark:bg-chalkboard-100 border border-chalkboard-50'
|
||||
|
||||
export const onboardingRoutes = [
|
||||
{
|
||||
@ -106,20 +108,40 @@ export function useDismiss() {
|
||||
}, [send, navigate, filePath])
|
||||
}
|
||||
|
||||
// Get the 1-indexed step number of the current onboarding step
|
||||
export function useStepNumber(
|
||||
slug?: (typeof onboardingPaths)[keyof typeof onboardingPaths]
|
||||
) {
|
||||
return slug
|
||||
? slug === onboardingPaths.INDEX
|
||||
? 1
|
||||
: onboardingRoutes.findIndex(
|
||||
(r) => r.path === makeUrlPathRelative(slug)
|
||||
) + 1
|
||||
: undefined
|
||||
}
|
||||
|
||||
export function OnboardingButtons({
|
||||
next,
|
||||
nextText,
|
||||
dismiss,
|
||||
currentSlug,
|
||||
className,
|
||||
...props
|
||||
}: {
|
||||
next: () => void
|
||||
nextText?: string
|
||||
dismiss: () => void
|
||||
currentSlug?: (typeof onboardingPaths)[keyof typeof onboardingPaths]
|
||||
className?: string
|
||||
} & React.HTMLAttributes<HTMLDivElement>) {
|
||||
const stepNumber = useStepNumber(currentSlug)
|
||||
|
||||
return (
|
||||
<div className={'flex justify-between ' + (className ?? '')} {...props}>
|
||||
<div
|
||||
className={'flex items-center justify-between ' + (className ?? '')}
|
||||
{...props}
|
||||
>
|
||||
<ActionButton
|
||||
Element="button"
|
||||
onClick={dismiss}
|
||||
@ -132,6 +154,11 @@ export function OnboardingButtons({
|
||||
>
|
||||
Dismiss
|
||||
</ActionButton>
|
||||
{stepNumber !== undefined && (
|
||||
<p className="font-mono text-xs text-center m-0">
|
||||
{stepNumber} / {onboardingRoutes.length}
|
||||
</p>
|
||||
)}
|
||||
<ActionButton
|
||||
Element="button"
|
||||
onClick={next}
|
||||
|
@ -12,4 +12,4 @@ export const onboardingPaths = {
|
||||
MOVE: '/move',
|
||||
SKETCHING: '/sketching',
|
||||
FUTURE_WORK: '/future-work',
|
||||
}
|
||||
} as const
|
||||
|
@ -328,6 +328,7 @@ interface SettingsSectionProps extends React.PropsWithChildren {
|
||||
title: string
|
||||
description?: string
|
||||
className?: string
|
||||
headingClassName?: string
|
||||
}
|
||||
|
||||
export function SettingsSection({
|
||||
@ -335,6 +336,7 @@ export function SettingsSection({
|
||||
description,
|
||||
className,
|
||||
children,
|
||||
headingClassName = 'text-2xl font-bold',
|
||||
}: SettingsSectionProps) {
|
||||
return (
|
||||
<section
|
||||
@ -344,7 +346,7 @@ export function SettingsSection({
|
||||
}
|
||||
>
|
||||
<div className="w-80">
|
||||
<h2 className="text-2xl font-bold">{title}</h2>
|
||||
<h2 className={headingClassName}>{title}</h2>
|
||||
<p className="mt-2 text-sm">{description}</p>
|
||||
</div>
|
||||
<div>{children}</div>
|
||||
|
54
src/wasm-lib/Cargo.lock
generated
@ -155,9 +155,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.79"
|
||||
version = "1.0.80"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
|
||||
checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
]
|
||||
@ -574,9 +574,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.1"
|
||||
version = "4.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da"
|
||||
checksum = "b230ab84b0ffdf890d5a10abdbc8b83ae1c4918275daea1ab8801f71536b2651"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@ -584,9 +584,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.1"
|
||||
version = "4.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb"
|
||||
checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@ -937,7 +937,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "derive-docs"
|
||||
version = "0.1.8"
|
||||
version = "0.1.9"
|
||||
dependencies = [
|
||||
"convert_case",
|
||||
"expectorate",
|
||||
@ -954,9 +954,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "derive-docs"
|
||||
version = "0.1.8"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d58c9464a20d3ece3260838ad7c2f504c925a852cfdad13f0ea2e9e4bb8a859"
|
||||
checksum = "b81bc4c6288273218d0bb4f2ee7cda229264f2e8381e53aae250c840946171f9"
|
||||
dependencies = [
|
||||
"convert_case",
|
||||
"once_cell",
|
||||
@ -1782,9 +1782,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "insta"
|
||||
version = "1.34.0"
|
||||
version = "1.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d64600be34b2fcfc267740a243fa7744441bb4947a619ac4e5bb6507f35fbfc"
|
||||
checksum = "0a7c22c4d34ef4788c351e971c52bfdfe7ea2766f8c5466bc175dd46e52ac22e"
|
||||
dependencies = [
|
||||
"console",
|
||||
"lazy_static",
|
||||
@ -1897,7 +1897,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kcl-lib"
|
||||
version = "0.1.42"
|
||||
version = "0.1.44"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"approx 0.5.1",
|
||||
@ -1908,7 +1908,7 @@ dependencies = [
|
||||
"criterion",
|
||||
"dashmap",
|
||||
"databake",
|
||||
"derive-docs 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"derive-docs 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"expectorate",
|
||||
"futures",
|
||||
"gltf-json",
|
||||
@ -1990,7 +1990,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "kittycad-execution-plan"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#03eb9c3763de56d7284c09dba678ddd6120bb523"
|
||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#c554cbeda3f217c1baab8a33ffad50e2ecdc8ab9"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"insta",
|
||||
@ -2010,7 +2010,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "kittycad-execution-plan-macros"
|
||||
version = "0.1.8"
|
||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#03eb9c3763de56d7284c09dba678ddd6120bb523"
|
||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#c554cbeda3f217c1baab8a33ffad50e2ecdc8ab9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2020,7 +2020,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "kittycad-execution-plan-traits"
|
||||
version = "0.1.12"
|
||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#03eb9c3763de56d7284c09dba678ddd6120bb523"
|
||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#c554cbeda3f217c1baab8a33ffad50e2ecdc8ab9"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"thiserror",
|
||||
@ -2030,7 +2030,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "kittycad-modeling-cmds"
|
||||
version = "0.1.28"
|
||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#03eb9c3763de56d7284c09dba678ddd6120bb523"
|
||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#c554cbeda3f217c1baab8a33ffad50e2ecdc8ab9"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
@ -2058,7 +2058,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "kittycad-modeling-cmds-macros"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#03eb9c3763de56d7284c09dba678ddd6120bb523"
|
||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#c554cbeda3f217c1baab8a33ffad50e2ecdc8ab9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2068,7 +2068,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "kittycad-modeling-session"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#03eb9c3763de56d7284c09dba678ddd6120bb523"
|
||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#c554cbeda3f217c1baab8a33ffad50e2ecdc8ab9"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"kittycad",
|
||||
@ -3581,9 +3581,9 @@ checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.196"
|
||||
version = "1.0.197"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32"
|
||||
checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
@ -3599,9 +3599,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.196"
|
||||
version = "1.0.197"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67"
|
||||
checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -4823,9 +4823,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.41"
|
||||
version = "0.4.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97"
|
||||
checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"futures-core",
|
||||
@ -4918,9 +4918,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.68"
|
||||
version = "0.3.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446"
|
||||
checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
|
@ -17,7 +17,7 @@ kittycad = { workspace = true }
|
||||
serde_json = "1.0.114"
|
||||
uuid = { version = "1.7.0", features = ["v4", "js", "serde"] }
|
||||
wasm-bindgen = "0.2.91"
|
||||
wasm-bindgen-futures = "0.4.41"
|
||||
wasm-bindgen-futures = "0.4.42"
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = "1"
|
||||
@ -37,7 +37,7 @@ wasm-bindgen-futures = { version = "0.4.41", features = ["futures-core-03-stream
|
||||
wasm-streams = "0.4.0"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies.web-sys]
|
||||
version = "0.3.68"
|
||||
version = "0.3.69"
|
||||
features = [
|
||||
"console",
|
||||
"HtmlTextAreaElement",
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "derive-docs"
|
||||
description = "A tool for generating documentation from Rust derive macros"
|
||||
version = "0.1.8"
|
||||
version = "0.1.9"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/KittyCAD/modeling-app"
|
||||
@ -17,7 +17,7 @@ once_cell = "1.19.0"
|
||||
proc-macro2 = "1"
|
||||
quote = "1"
|
||||
regex = "1.10"
|
||||
serde = { version = "1.0.193", features = ["derive"] }
|
||||
serde = { version = "1.0.197", features = ["derive"] }
|
||||
serde_tokenstream = "0.2"
|
||||
syn = { version = "2.0.52", features = ["full"] }
|
||||
|
||||
|
@ -197,6 +197,7 @@ fn do_stdlib_inner(
|
||||
let (ty_string, ty_ident) = clean_ty_string(ty.to_string().as_str());
|
||||
|
||||
let ty_string = rust_type_to_openapi_type(&ty_string);
|
||||
let required = !ty_ident.to_string().starts_with("Option <");
|
||||
|
||||
if ty_string != "Args" {
|
||||
let schema = if ty_ident.to_string().starts_with("Vec < ")
|
||||
@ -216,7 +217,7 @@ fn do_stdlib_inner(
|
||||
name: #arg_name.to_string(),
|
||||
type_: #ty_string.to_string(),
|
||||
schema: #schema,
|
||||
required: true,
|
||||
required: #required,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ impl crate::docs::StdLibFn for Show {
|
||||
name: "args".to_string(),
|
||||
type_: "number".to_string(),
|
||||
schema: <Option<f64>>::json_schema(&mut generator),
|
||||
required: true,
|
||||
required: false,
|
||||
}]
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ impl crate::docs::StdLibFn for Import {
|
||||
name: "args".to_string(),
|
||||
type_: "kittycad::types::InputFormat".to_string(),
|
||||
schema: <Option<kittycad::types::InputFormat>>::json_schema(&mut generator),
|
||||
required: true,
|
||||
required: false,
|
||||
}]
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "kcl-lib"
|
||||
description = "KittyCAD Language implementation and tools"
|
||||
version = "0.1.42"
|
||||
version = "0.1.44"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/KittyCAD/modeling-app"
|
||||
@ -11,13 +11,13 @@ keywords = ["kcl", "KittyCAD", "CAD"]
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
anyhow = { version = "1.0.79", features = ["backtrace"] }
|
||||
anyhow = { version = "1.0.80", features = ["backtrace"] }
|
||||
async-recursion = "1.0.5"
|
||||
async-trait = "0.1.77"
|
||||
clap = { version = "4.5.1", features = ["cargo", "derive", "env", "unicode"], optional = true }
|
||||
clap = { version = "4.5.2", features = ["cargo", "derive", "env", "unicode"], optional = true }
|
||||
dashmap = "5.5.3"
|
||||
databake = { version = "0.1.7", features = ["derive"] }
|
||||
derive-docs = { version = "0.1.8" }
|
||||
derive-docs = { version = "0.1.9" }
|
||||
#derive-docs = { path = "../derive-docs" }
|
||||
futures = { version = "0.3.30" }
|
||||
gltf-json = "1.4.0"
|
||||
@ -29,7 +29,7 @@ parse-display = "0.9.0"
|
||||
reqwest = { version = "0.11.24", default-features = false, features = ["stream", "rustls-tls"] }
|
||||
ropey = "1.6.1"
|
||||
schemars = { version = "0.8.16", features = ["impl_json_schema", "url", "uuid1"] }
|
||||
serde = { version = "1.0.193", features = ["derive"] }
|
||||
serde = { version = "1.0.197", features = ["derive"] }
|
||||
serde_json = "1.0.114"
|
||||
thiserror = "1.0.57"
|
||||
ts-rs = { version = "7.1.1", features = ["uuid-impl"] }
|
||||
@ -40,8 +40,8 @@ winnow = "0.5.40"
|
||||
js-sys = { version = "0.3.69" }
|
||||
tower-lsp = { version = "0.20.0", default-features = false, features = ["runtime-agnostic"] }
|
||||
wasm-bindgen = "0.2.91"
|
||||
wasm-bindgen-futures = "0.4.41"
|
||||
web-sys = { version = "0.3.68", features = ["console"] }
|
||||
wasm-bindgen-futures = "0.4.42"
|
||||
web-sys = { version = "0.3.69", features = ["console"] }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
approx = "0.5"
|
||||
@ -65,7 +65,7 @@ debug = true # Flamegraphs of benchmarks require accurate debug symbols
|
||||
[dev-dependencies]
|
||||
criterion = "0.5.1"
|
||||
expectorate = "1.1.0"
|
||||
insta = { version = "1.34.0", features = ["json"] }
|
||||
insta = { version = "1.36.1", features = ["json"] }
|
||||
itertools = "0.12.1"
|
||||
pretty_assertions = "1.4.0"
|
||||
tokio = { version = "1.36.0", features = ["rt-multi-thread", "macros", "time"] }
|
||||
|
@ -1084,11 +1084,17 @@ impl CallExpression {
|
||||
}
|
||||
FunctionKind::Std(func) => {
|
||||
let function_expression = func.function();
|
||||
if fn_args.len() != function_expression.params.len() {
|
||||
let parts = function_expression.clone().into_parts().map_err(|e| {
|
||||
KclError::Semantic(KclErrorDetails {
|
||||
message: format!("Error getting parts of function: {}", e),
|
||||
source_ranges: vec![self.into()],
|
||||
})
|
||||
})?;
|
||||
if fn_args.len() < parts.params_required.len() || fn_args.len() > function_expression.params.len() {
|
||||
return Err(KclError::Semantic(KclErrorDetails {
|
||||
message: format!(
|
||||
"this function expected {} arguments, got {}",
|
||||
function_expression.params.len(),
|
||||
parts.params_required.len(),
|
||||
fn_args.len(),
|
||||
),
|
||||
source_ranges: vec![self.into()],
|
||||
@ -1097,13 +1103,28 @@ impl CallExpression {
|
||||
|
||||
// Add the arguments to the memory.
|
||||
let mut fn_memory = memory.clone();
|
||||
for (index, param) in function_expression.params.iter().enumerate() {
|
||||
for (index, param) in parts.params_required.iter().enumerate() {
|
||||
fn_memory.add(
|
||||
¶m.identifier.name,
|
||||
fn_args.get(index).unwrap().clone(),
|
||||
param.identifier.clone().into(),
|
||||
)?;
|
||||
}
|
||||
// Add the optional arguments to the memory.
|
||||
for (index, param) in parts.params_optional.iter().enumerate() {
|
||||
if let Some(arg) = fn_args.get(index + parts.params_required.len()) {
|
||||
fn_memory.add(¶m.identifier.name, arg.clone(), param.identifier.clone().into())?;
|
||||
} else {
|
||||
fn_memory.add(
|
||||
¶m.identifier.name,
|
||||
MemoryItem::UserVal(UserVal {
|
||||
value: serde_json::value::Value::Null,
|
||||
meta: Default::default(),
|
||||
}),
|
||||
param.identifier.clone().into(),
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
||||
// Call the stdlib function
|
||||
let p = func.function().clone().body;
|
||||
|
@ -132,7 +132,11 @@ pub trait StdLibFn: std::fmt::Debug + Send + Sync {
|
||||
if i > 0 {
|
||||
signature.push_str(", ");
|
||||
}
|
||||
if arg.required {
|
||||
signature.push_str(&format!("{}: {}", arg.name, arg.type_));
|
||||
} else {
|
||||
signature.push_str(&format!("{}?: {}", arg.name, arg.type_));
|
||||
}
|
||||
}
|
||||
signature.push(')');
|
||||
if let Some(return_value) = self.return_value() {
|
||||
|
@ -4,18 +4,18 @@ expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 59,
|
||||
"end": 87,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 58,
|
||||
"end": 86,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 6,
|
||||
"end": 58,
|
||||
"end": 86,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
@ -26,59 +26,27 @@ expression: actual
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression",
|
||||
"start": 17,
|
||||
"end": 58,
|
||||
"end": 86,
|
||||
"body": [
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 17,
|
||||
"end": 40,
|
||||
"end": 36,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 17,
|
||||
"end": 23,
|
||||
"name": "circle"
|
||||
"end": 30,
|
||||
"name": "startSketchOn"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 24,
|
||||
"end": 28,
|
||||
"start": 31,
|
||||
"end": 35,
|
||||
"value": "XY",
|
||||
"raw": "'XY'"
|
||||
},
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 30,
|
||||
"end": 35,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 31,
|
||||
"end": 32,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 33,
|
||||
"end": 34,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 37,
|
||||
"end": 39,
|
||||
"value": 22,
|
||||
"raw": "22"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
@ -87,27 +55,80 @@ expression: actual
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 44,
|
||||
"end": 58,
|
||||
"end": 64,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 44,
|
||||
"end": 51,
|
||||
"end": 50,
|
||||
"name": "circle"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 51,
|
||||
"end": 56,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 52,
|
||||
"end": 53,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 54,
|
||||
"end": 55,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 58,
|
||||
"end": 60,
|
||||
"value": 22,
|
||||
"raw": "22"
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"start": 62,
|
||||
"end": 63
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 72,
|
||||
"end": 86,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 72,
|
||||
"end": 79,
|
||||
"name": "extrude"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 52,
|
||||
"end": 54,
|
||||
"start": 80,
|
||||
"end": 82,
|
||||
"value": 14,
|
||||
"raw": "14"
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"start": 56,
|
||||
"end": 57
|
||||
"start": 84,
|
||||
"end": 85
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
|
@ -420,6 +420,36 @@ impl Args {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_sketch_group_and_optional_tag(&self) -> Result<(Box<SketchGroup>, Option<String>), KclError> {
|
||||
let first_value = self.args.first().ok_or_else(|| {
|
||||
KclError::Type(KclErrorDetails {
|
||||
message: format!("Expected a SketchGroup as the first argument, found `{:?}`", self.args),
|
||||
source_ranges: vec![self.source_range],
|
||||
})
|
||||
})?;
|
||||
|
||||
let sketch_group = if let MemoryItem::SketchGroup(sg) = first_value {
|
||||
sg.clone()
|
||||
} else {
|
||||
return Err(KclError::Type(KclErrorDetails {
|
||||
message: format!("Expected a SketchGroup as the first argument, found `{:?}`", self.args),
|
||||
source_ranges: vec![self.source_range],
|
||||
}));
|
||||
};
|
||||
|
||||
if let Some(second_value) = self.args.get(1) {
|
||||
let tag: String = serde_json::from_value(second_value.get_json_value()?).map_err(|e| {
|
||||
KclError::Type(KclErrorDetails {
|
||||
message: format!("Failed to deserialize String from JSON: {}", e),
|
||||
source_ranges: vec![self.source_range],
|
||||
})
|
||||
})?;
|
||||
Ok((sketch_group, Some(tag)))
|
||||
} else {
|
||||
Ok((sketch_group, None))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_data_and_optional_tag<T: serde::de::DeserializeOwned>(
|
||||
&self,
|
||||
) -> Result<(T, Option<SketchOnFaceTag>), KclError> {
|
||||
@ -881,10 +911,14 @@ mod tests {
|
||||
fn_docs.push_str("#### Arguments\n\n");
|
||||
for arg in internal_fn.args() {
|
||||
let (format, should_be_indented) = arg.get_type_string().unwrap();
|
||||
let optional_string = if arg.required { " (REQUIRED)" } else { " (OPTIONAL)" }.to_string();
|
||||
if let Some(description) = arg.description() {
|
||||
fn_docs.push_str(&format!("* `{}`: `{}` - {}\n", arg.name, arg.type_, description));
|
||||
fn_docs.push_str(&format!(
|
||||
"* `{}`: `{}` - {}{}\n",
|
||||
arg.name, arg.type_, description, optional_string
|
||||
));
|
||||
} else {
|
||||
fn_docs.push_str(&format!("* `{}`: `{}`\n", arg.name, arg.type_));
|
||||
fn_docs.push_str(&format!("* `{}`: `{}`{}\n", arg.name, arg.type_, optional_string));
|
||||
}
|
||||
|
||||
if should_be_indented {
|
||||
|
@ -8,13 +8,13 @@ use crate::{
|
||||
};
|
||||
|
||||
pub const CIRCLE_FN: &str = r#"
|
||||
(plane, center, radius) => {
|
||||
const sg = startSketchOn(plane)
|
||||
|> startProfileAt([center[0] + radius, center[1]], %)
|
||||
(center, radius, surface, tag?) => {
|
||||
const sg = startProfileAt([center[0] + radius, center[1]], surface)
|
||||
|> arc({
|
||||
angle_end: 360,
|
||||
angle_start: 0,
|
||||
radius: radius
|
||||
radius: radius,
|
||||
tag: tag
|
||||
}, %)
|
||||
|> close(%)
|
||||
return sg
|
||||
@ -70,14 +70,6 @@ impl StdLibFn for Circle {
|
||||
let mut args = Vec::new();
|
||||
for parameter in &self.function.params {
|
||||
match parameter.identifier.name.as_str() {
|
||||
"plane" => {
|
||||
args.push(crate::docs::StdLibFnArg {
|
||||
name: parameter.identifier.name.to_owned(),
|
||||
type_: "SketchData".to_string(),
|
||||
schema: <crate::std::sketch::SketchData>::json_schema(&mut generator),
|
||||
required: true,
|
||||
});
|
||||
}
|
||||
"center" => {
|
||||
args.push(crate::docs::StdLibFnArg {
|
||||
name: parameter.identifier.name.to_owned(),
|
||||
@ -94,6 +86,22 @@ impl StdLibFn for Circle {
|
||||
required: true,
|
||||
});
|
||||
}
|
||||
"surface" => {
|
||||
args.push(crate::docs::StdLibFnArg {
|
||||
name: parameter.identifier.name.to_owned(),
|
||||
type_: "SketchSurface".to_string(),
|
||||
schema: <crate::executor::SketchSurface>::json_schema(&mut generator),
|
||||
required: true,
|
||||
});
|
||||
}
|
||||
"tag" => {
|
||||
args.push(crate::docs::StdLibFnArg {
|
||||
name: parameter.identifier.name.to_owned(),
|
||||
type_: "String".to_string(),
|
||||
schema: <String>::json_schema(&mut generator),
|
||||
required: false,
|
||||
});
|
||||
}
|
||||
_ => panic!("Unknown parameter: {:?}", parameter.identifier.name),
|
||||
}
|
||||
}
|
||||
|
@ -1073,9 +1073,9 @@ async fn inner_start_profile_at(
|
||||
|
||||
/// Close the current sketch.
|
||||
pub async fn close(args: Args) -> Result<MemoryItem, KclError> {
|
||||
let sketch_group = args.get_sketch_group()?;
|
||||
let (sketch_group, tag): (Box<SketchGroup>, Option<String>) = args.get_sketch_group_and_optional_tag()?;
|
||||
|
||||
let new_sketch_group = inner_close(sketch_group, args).await?;
|
||||
let new_sketch_group = inner_close(sketch_group, tag, args).await?;
|
||||
|
||||
Ok(MemoryItem::SketchGroup(new_sketch_group))
|
||||
}
|
||||
@ -1084,7 +1084,11 @@ pub async fn close(args: Args) -> Result<MemoryItem, KclError> {
|
||||
#[stdlib {
|
||||
name = "close",
|
||||
}]
|
||||
async fn inner_close(sketch_group: Box<SketchGroup>, args: Args) -> Result<Box<SketchGroup>, KclError> {
|
||||
async fn inner_close(
|
||||
sketch_group: Box<SketchGroup>,
|
||||
tag: Option<String>,
|
||||
args: Args,
|
||||
) -> Result<Box<SketchGroup>, KclError> {
|
||||
let from = sketch_group.get_coords_from_paths()?;
|
||||
let to: Point2d = sketch_group.start.from.into();
|
||||
|
||||
@ -1110,8 +1114,7 @@ async fn inner_close(sketch_group: Box<SketchGroup>, args: Args) -> Result<Box<S
|
||||
base: BasePath {
|
||||
from: from.into(),
|
||||
to: to.into(),
|
||||
// TODO: should we use a different name?
|
||||
name: "".into(),
|
||||
name: tag.unwrap_or_default(),
|
||||
geo_meta: GeoMeta {
|
||||
id,
|
||||
metadata: args.source_range.into(),
|
||||
@ -1127,18 +1130,7 @@ async fn inner_close(sketch_group: Box<SketchGroup>, args: Args) -> Result<Box<S
|
||||
#[ts(export)]
|
||||
#[serde(rename_all = "camelCase", untagged)]
|
||||
pub enum ArcData {
|
||||
/// Angles and radius with a tag.
|
||||
AnglesAndRadiusWithTag {
|
||||
/// The start angle.
|
||||
angle_start: f64,
|
||||
/// The end angle.
|
||||
angle_end: f64,
|
||||
/// The radius.
|
||||
radius: f64,
|
||||
/// The tag.
|
||||
tag: String,
|
||||
},
|
||||
/// Angles and radius.
|
||||
/// Angles and radius with an optional tag.
|
||||
AnglesAndRadius {
|
||||
/// The start angle.
|
||||
angle_start: f64,
|
||||
@ -1146,19 +1138,11 @@ pub enum ArcData {
|
||||
angle_end: f64,
|
||||
/// The radius.
|
||||
radius: f64,
|
||||
},
|
||||
/// Center, to and radius with a tag.
|
||||
CenterToRadiusWithTag {
|
||||
/// The center.
|
||||
center: [f64; 2],
|
||||
/// The to point.
|
||||
to: [f64; 2],
|
||||
/// The radius.
|
||||
radius: f64,
|
||||
/// The tag.
|
||||
tag: String,
|
||||
#[serde(default)]
|
||||
tag: Option<String>,
|
||||
},
|
||||
/// Center, to and radius.
|
||||
/// Center, to and radius with an optional tag.
|
||||
CenterToRadius {
|
||||
/// The center.
|
||||
center: [f64; 2],
|
||||
@ -1166,6 +1150,9 @@ pub enum ArcData {
|
||||
to: [f64; 2],
|
||||
/// The radius.
|
||||
radius: f64,
|
||||
/// The tag.
|
||||
#[serde(default)]
|
||||
tag: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
@ -1185,7 +1172,7 @@ async fn inner_arc(data: ArcData, sketch_group: Box<SketchGroup>, args: Args) ->
|
||||
let from: Point2d = sketch_group.get_coords_from_paths()?;
|
||||
|
||||
let (center, angle_start, angle_end, radius, end) = match &data {
|
||||
ArcData::AnglesAndRadiusWithTag {
|
||||
ArcData::AnglesAndRadius {
|
||||
angle_start,
|
||||
angle_end,
|
||||
radius,
|
||||
@ -1196,21 +1183,7 @@ async fn inner_arc(data: ArcData, sketch_group: Box<SketchGroup>, args: Args) ->
|
||||
let (center, end) = arc_center_and_end(from, a_start, a_end, *radius);
|
||||
(center, a_start, a_end, *radius, end)
|
||||
}
|
||||
ArcData::AnglesAndRadius {
|
||||
angle_start,
|
||||
angle_end,
|
||||
radius,
|
||||
} => {
|
||||
let a_start = Angle::from_degrees(*angle_start);
|
||||
let a_end = Angle::from_degrees(*angle_end);
|
||||
let (center, end) = arc_center_and_end(from, a_start, a_end, *radius);
|
||||
(center, a_start, a_end, *radius, end)
|
||||
}
|
||||
ArcData::CenterToRadiusWithTag { center, to, radius, .. } => {
|
||||
let (angle_start, angle_end) = arc_angles(from, center.into(), to.into(), *radius, args.source_range)?;
|
||||
(center.into(), angle_start, angle_end, *radius, to.into())
|
||||
}
|
||||
ArcData::CenterToRadius { center, to, radius } => {
|
||||
ArcData::CenterToRadius { center, to, radius, .. } => {
|
||||
let (angle_start, angle_end) = arc_angles(from, center.into(), to.into(), *radius, args.source_range)?;
|
||||
(center.into(), angle_start, angle_end, *radius, to.into())
|
||||
}
|
||||
@ -1238,10 +1211,8 @@ async fn inner_arc(data: ArcData, sketch_group: Box<SketchGroup>, args: Args) ->
|
||||
from: from.into(),
|
||||
to: end.into(),
|
||||
name: match data {
|
||||
ArcData::AnglesAndRadiusWithTag { tag, .. } => tag.to_string(),
|
||||
ArcData::AnglesAndRadius { .. } => "".to_string(),
|
||||
ArcData::CenterToRadiusWithTag { tag, .. } => tag.to_string(),
|
||||
ArcData::CenterToRadius { .. } => "".to_string(),
|
||||
ArcData::AnglesAndRadius { tag, .. } => tag.unwrap_or_default().to_string(),
|
||||
ArcData::CenterToRadius { tag, .. } => tag.unwrap_or_default().to_string(),
|
||||
},
|
||||
geo_meta: GeoMeta {
|
||||
id,
|
||||
@ -1453,10 +1424,8 @@ async fn inner_tangential_arc_to(
|
||||
/// Data to draw a bezier curve.
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||
#[ts(export)]
|
||||
#[serde(rename_all = "camelCase", untagged)]
|
||||
pub enum BezierData {
|
||||
/// Points with a tag.
|
||||
PointsWithTag {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct BezierData {
|
||||
/// The to point.
|
||||
to: [f64; 2],
|
||||
/// The first control point.
|
||||
@ -1464,17 +1433,7 @@ pub enum BezierData {
|
||||
/// The second control point.
|
||||
control2: [f64; 2],
|
||||
/// The tag.
|
||||
tag: String,
|
||||
},
|
||||
/// Points.
|
||||
Points {
|
||||
/// The to point.
|
||||
to: [f64; 2],
|
||||
/// The first control point.
|
||||
control1: [f64; 2],
|
||||
/// The second control point.
|
||||
control2: [f64; 2],
|
||||
},
|
||||
tag: Option<String>,
|
||||
}
|
||||
|
||||
/// Draw a bezier curve.
|
||||
@ -1496,16 +1455,9 @@ async fn inner_bezier_curve(
|
||||
) -> Result<Box<SketchGroup>, KclError> {
|
||||
let from = sketch_group.get_coords_from_paths()?;
|
||||
|
||||
let (to, control1, control2) = match &data {
|
||||
BezierData::PointsWithTag {
|
||||
to, control1, control2, ..
|
||||
} => (to, control1, control2),
|
||||
BezierData::Points { to, control1, control2 } => (to, control1, control2),
|
||||
};
|
||||
|
||||
let relative = true;
|
||||
let delta = to;
|
||||
let to = [from.x + to[0], from.y + to[1]];
|
||||
let delta = data.to;
|
||||
let to = [from.x + data.to[0], from.y + data.to[1]];
|
||||
|
||||
let id = uuid::Uuid::new_v4();
|
||||
|
||||
@ -1515,13 +1467,13 @@ async fn inner_bezier_curve(
|
||||
path: sketch_group.id,
|
||||
segment: kittycad::types::PathSegment::Bezier {
|
||||
control1: Point3D {
|
||||
x: control1[0],
|
||||
y: control1[1],
|
||||
x: data.control1[0],
|
||||
y: data.control1[1],
|
||||
z: 0.0,
|
||||
},
|
||||
control2: Point3D {
|
||||
x: control2[0],
|
||||
y: control2[1],
|
||||
x: data.control2[0],
|
||||
y: data.control2[1],
|
||||
z: 0.0,
|
||||
},
|
||||
end: Point3D {
|
||||
@ -1539,11 +1491,7 @@ async fn inner_bezier_curve(
|
||||
base: BasePath {
|
||||
from: from.into(),
|
||||
to,
|
||||
name: if let BezierData::PointsWithTag { tag, .. } = data {
|
||||
tag.to_string()
|
||||
} else {
|
||||
"".to_string()
|
||||
},
|
||||
name: data.tag.unwrap_or_default().to_string(),
|
||||
geo_meta: GeoMeta {
|
||||
id,
|
||||
metadata: args.source_range.into(),
|
||||
|
@ -1 +1,3 @@
|
||||
const cylinder = circle('XY', [0,0], 22) |> extrude(14, %)
|
||||
const cylinder = startSketchOn('XY')
|
||||
|> circle([0,0], 22, %)
|
||||
|> extrude(14, %)
|
||||
|
@ -260,6 +260,29 @@ async fn serial_test_basic_fillet_cube_end() {
|
||||
twenty_twenty::assert_image("tests/executor/outputs/basic_fillet_cube_end.png", &result, 0.999);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_basic_fillet_cube_close_opposite() {
|
||||
let code = r#"const part001 = startSketchOn('XY')
|
||||
|> startProfileAt([0,0], %)
|
||||
|> line({to: [0, 10], tag: "thing"}, %)
|
||||
|> line([10, 0], %)
|
||||
|> line({to: [0, -10], tag: "thing2"}, %)
|
||||
|> close(%, "thing3")
|
||||
|> extrude(10, %)
|
||||
|> fillet({radius: 2, tags: ["thing3", getOppositeEdge("thing3", %)]}, %)
|
||||
|
||||
"#;
|
||||
|
||||
let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm)
|
||||
.await
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
"tests/executor/outputs/basic_fillet_cube_close_opposite.png",
|
||||
&result,
|
||||
0.999,
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_basic_fillet_cube_next_adjacent() {
|
||||
let code = r#"const part001 = startSketchOn('XY')
|
||||
@ -709,8 +732,8 @@ async fn serial_test_holes() {
|
||||
|> line([10, 0], %)
|
||||
|> line([0, -10], %)
|
||||
|> close(%)
|
||||
|> hole(circle('XY', [2, 2], .5), %)
|
||||
|> hole(circle('XY', [2, 8], .5), %)
|
||||
|> hole(circle([2, 2], .5, startSketchOn('XY')), %)
|
||||
|> hole(circle([2, 8], .5, startSketchOn('XY')), %)
|
||||
|> extrude(2, %)
|
||||
"#;
|
||||
|
||||
@ -765,10 +788,10 @@ const holeRadius = 1
|
||||
const holeIndex = 6
|
||||
|
||||
const part = roundedRectangle([0, 0], 20, 20, 4)
|
||||
|> hole(circle('XY', [-holeIndex, holeIndex], holeRadius), %)
|
||||
|> hole(circle('XY', [holeIndex, holeIndex], holeRadius), %)
|
||||
|> hole(circle('XY', [-holeIndex, -holeIndex], holeRadius), %)
|
||||
|> hole(circle('XY', [holeIndex, -holeIndex], holeRadius), %)
|
||||
|> hole(circle([-holeIndex, holeIndex], holeRadius, startSketchOn('XY')), %)
|
||||
|> hole(circle([holeIndex, holeIndex], holeRadius, startSketchOn('XY')), %)
|
||||
|> hole(circle([-holeIndex, -holeIndex], holeRadius, startSketchOn('XY')), %)
|
||||
|> hole(circle([holeIndex, -holeIndex], holeRadius, startSketchOn('XY')), %)
|
||||
|> extrude(2, %)
|
||||
"#;
|
||||
|
||||
@ -780,7 +803,7 @@ const part = roundedRectangle([0, 0], 20, 20, 4)
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_top_level_expression() {
|
||||
let code = r#"circle('XY', [0,0], 22) |> extrude(14, %)"#;
|
||||
let code = r#"circle([0,0], 22, startSketchOn('XY')) |> extrude(14, %)"#;
|
||||
|
||||
let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm)
|
||||
.await
|
||||
@ -790,7 +813,8 @@ async fn serial_test_top_level_expression() {
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_patterns_linear_basic() {
|
||||
let code = r#"const part = circle('XY', [0,0], 2)
|
||||
let code = r#"const part = startSketchOn('XY')
|
||||
|> circle([0,0], 2, %)
|
||||
|> patternLinear({axis: [0,1], repetitions: 12, distance: 2}, %)
|
||||
"#;
|
||||
|
||||
@ -820,7 +844,8 @@ async fn serial_test_patterns_linear_basic_3d() {
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_patterns_linear_basic_negative_distance() {
|
||||
let code = r#"const part = circle('XY', [0,0], 2)
|
||||
let code = r#"const part = startSketchOn('XY')
|
||||
|> circle([0,0], 2, %)
|
||||
|> patternLinear({axis: [0,1], repetitions: 12, distance: -2}, %)
|
||||
"#;
|
||||
|
||||
@ -836,7 +861,8 @@ async fn serial_test_patterns_linear_basic_negative_distance() {
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_patterns_linear_basic_negative_axis() {
|
||||
let code = r#"const part = circle('XY', [0,0], 2)
|
||||
let code = r#"const part = startSketchOn('XY')
|
||||
|> circle([0,0], 2, %)
|
||||
|> patternLinear({axis: [0,-1], repetitions: 12, distance: 2}, %)
|
||||
"#;
|
||||
|
||||
@ -852,7 +878,8 @@ async fn serial_test_patterns_linear_basic_negative_axis() {
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_patterns_linear_basic_holes() {
|
||||
let code = r#"const circles = circle('XY', [5, 5], 1)
|
||||
let code = r#"const circles = startSketchOn('XY')
|
||||
|> circle([5, 5], 1, %)
|
||||
|> patternLinear({axis: [1,1], repetitions: 12, distance: 3}, %)
|
||||
|
||||
const rectangle = startSketchOn('XY')
|
||||
@ -873,7 +900,8 @@ const rectangle = startSketchOn('XY')
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_patterns_circular_basic_2d() {
|
||||
let code = r#"const part = circle('XY', [0,0], 2)
|
||||
let code = r#"const part = startSketchOn('XY')
|
||||
|> circle([0,0], 2, %)
|
||||
|> patternCircular({axis: [0,1], center: [20, 20, 20], repetitions: 12, arcDegrees: 210, rotateDuplicates: true}, %)
|
||||
"#;
|
||||
|
||||
@ -1225,7 +1253,7 @@ async fn serial_test_stdlib_kcl_error_right_code_path() {
|
||||
|> line([0, -10], %)
|
||||
|> close(%)
|
||||
|> hole(circle([2, 2], .5), %)
|
||||
|> hole(circle('XY', [2, 8], .5), %)
|
||||
|> hole(circle([2, 8], .5, startSketchOn('XY')), %)
|
||||
|> extrude(2, %)
|
||||
"#;
|
||||
|
||||
@ -1236,3 +1264,55 @@ async fn serial_test_stdlib_kcl_error_right_code_path() {
|
||||
r#"semantic: KclErrorDetails { source_ranges: [SourceRange([157, 175])], message: "this function expected 3 arguments, got 2" }"#
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_sketch_on_face_circle() {
|
||||
let code = r#"fn cube = (pos, scale) => {
|
||||
const sg = startSketchOn('XY')
|
||||
|> startProfileAt(pos, %)
|
||||
|> line([0, scale], %)
|
||||
|> line([scale, 0], %)
|
||||
|> line([0, -scale], %)
|
||||
|
||||
return sg
|
||||
}
|
||||
const part001 = cube([0,0], 20)
|
||||
|> close(%)
|
||||
|> extrude(20, %)
|
||||
|
||||
const part002 = startSketchOn(part001, "end")
|
||||
|> circle([0, 0], 5, %)
|
||||
|> extrude(5, %)
|
||||
"#;
|
||||
|
||||
let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm)
|
||||
.await
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_circle.png", &result, 1.0);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_sketch_on_face_circle_tagged() {
|
||||
let code = r#"fn cube = (pos, scale) => {
|
||||
const sg = startSketchOn('XY')
|
||||
|> startProfileAt(pos, %)
|
||||
|> line([0, scale], %)
|
||||
|> line([scale, 0], %)
|
||||
|> line([0, -scale], %)
|
||||
|
||||
return sg
|
||||
}
|
||||
const part001 = cube([0,0], 20)
|
||||
|> close(%)
|
||||
|> extrude(20, %)
|
||||
|
||||
const part002 = startSketchOn(part001, "end")
|
||||
|> circle([0, 0], 5, %, "myCircle")
|
||||
|> extrude(5, %)
|
||||
"#;
|
||||
|
||||
let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm)
|
||||
.await
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_circle_tagged.png", &result, 1.0);
|
||||
}
|
||||
|
After Width: | Height: | Size: 99 KiB |
BIN
src/wasm-lib/tests/executor/outputs/sketch_on_face_circle.png
Normal file
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 114 KiB |