Migrate to tauri v2

Fixes #1349
This commit is contained in:
Pierre Jacquier
2024-03-11 07:35:22 +01:00
parent 3c03641a57
commit af5917f3d9
59 changed files with 1204 additions and 1655 deletions

View File

@ -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 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 currently move or transform the imported objects at all, once we have assemblies
this will work. this will work.
- **Fillets**: Fillets cannot intersect, you will get an error. Only simple fillet cases work currently.

File diff suppressed because it is too large Load Diff

View File

@ -83,7 +83,7 @@ abs(num: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
#### Returns #### Returns
@ -103,7 +103,7 @@ acos(num: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
#### Returns #### Returns
@ -123,9 +123,9 @@ angleToMatchLengthX(segment_name: string, to: number, sketch_group: SketchGroup)
#### Arguments #### Arguments
* `segment_name`: `string` * `segment_name`: `string` (REQUIRED)
* `to`: `number` * `to`: `number` (REQUIRED)
* `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. // The plane id or face id of the sketch group.
@ -308,9 +308,9 @@ angleToMatchLengthY(segment_name: string, to: number, sketch_group: SketchGroup)
#### Arguments #### Arguments
* `segment_name`: `string` * `segment_name`: `string` (REQUIRED)
* `to`: `number` * `to`: `number` (REQUIRED)
* `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. // The plane id or face id of the sketch group.
@ -493,7 +493,7 @@ angledLine(data: AngledLineData, sketch_group: SketchGroup) -> SketchGroup
#### Arguments #### Arguments
* `data`: `AngledLineData` - Data to draw an angled line. * `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED)
``` ```
{ {
// The angle of the line. // The angle of the line.
@ -505,7 +505,7 @@ angledLine(data: AngledLineData, sketch_group: SketchGroup) -> SketchGroup
} | } |
[number, number] [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. // The plane id or face id of the sketch group.
@ -851,7 +851,7 @@ angledLineOfXLength(data: AngledLineData, sketch_group: SketchGroup) -> SketchGr
#### Arguments #### Arguments
* `data`: `AngledLineData` - Data to draw an angled line. * `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED)
``` ```
{ {
// The angle of the line. // The angle of the line.
@ -863,7 +863,7 @@ angledLineOfXLength(data: AngledLineData, sketch_group: SketchGroup) -> SketchGr
} | } |
[number, number] [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. // The plane id or face id of the sketch group.
@ -1209,7 +1209,7 @@ angledLineOfYLength(data: AngledLineData, sketch_group: SketchGroup) -> SketchGr
#### Arguments #### Arguments
* `data`: `AngledLineData` - Data to draw an angled line. * `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED)
``` ```
{ {
// The angle of the line. // The angle of the line.
@ -1221,7 +1221,7 @@ angledLineOfYLength(data: AngledLineData, sketch_group: SketchGroup) -> SketchGr
} | } |
[number, number] [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. // The plane id or face id of the sketch group.
@ -1567,7 +1567,7 @@ angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch_group: Sketc
#### Arguments #### 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. // The angle of the line.
@ -1580,7 +1580,7 @@ angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch_group: Sketc
tag: string, 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. // The plane id or face id of the sketch group.
@ -1926,7 +1926,7 @@ angledLineToX(data: AngledLineToData, sketch_group: SketchGroup) -> SketchGroup
#### Arguments #### 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. // The angle of the line.
@ -1938,7 +1938,7 @@ angledLineToX(data: AngledLineToData, sketch_group: SketchGroup) -> SketchGroup
} | } |
[number, number] [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. // The plane id or face id of the sketch group.
@ -2284,7 +2284,7 @@ angledLineToY(data: AngledLineToData, sketch_group: SketchGroup) -> SketchGroup
#### Arguments #### 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. // The angle of the line.
@ -2296,7 +2296,7 @@ angledLineToY(data: AngledLineToData, sketch_group: SketchGroup) -> SketchGroup
} | } |
[number, number] [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. // The plane id or face id of the sketch group.
@ -2642,7 +2642,7 @@ arc(data: ArcData, sketch_group: SketchGroup) -> SketchGroup
#### Arguments #### Arguments
* `data`: `ArcData` - Data to draw an arc. * `data`: `ArcData` - Data to draw an arc. (REQUIRED)
``` ```
{ {
// The end angle. // The end angle.
@ -2654,14 +2654,6 @@ arc(data: ArcData, sketch_group: SketchGroup) -> SketchGroup
// The tag. // The tag.
tag: string, tag: string,
} | } |
{
// The end angle.
angle_end: number,
// The start angle.
angle_start: number,
// The radius.
radius: number,
} |
{ {
// The center. // The center.
center: [number, number], center: [number, number],
@ -2671,17 +2663,9 @@ arc(data: ArcData, sketch_group: SketchGroup) -> SketchGroup
tag: string, tag: string,
// The to point. // The to point.
to: [number, number], 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. // The plane id or face id of the sketch group.
@ -3027,7 +3011,7 @@ asin(num: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
#### Returns #### Returns
@ -3047,7 +3031,7 @@ atan(num: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
#### Returns #### Returns
@ -3067,7 +3051,7 @@ bezierCurve(data: BezierData, sketch_group: SketchGroup) -> SketchGroup
#### Arguments #### Arguments
* `data`: `BezierData` - Data to draw a bezier curve. * `data`: `BezierData` - Data to draw a bezier curve. (REQUIRED)
``` ```
{ {
// The first control point. // The first control point.
@ -3078,17 +3062,9 @@ bezierCurve(data: BezierData, sketch_group: SketchGroup) -> SketchGroup
tag: string, tag: string,
// The to point. // The to point.
to: [number, number], 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. // The plane id or face id of the sketch group.
@ -3434,7 +3410,7 @@ ceil(num: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
#### Returns #### 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 #### 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 of the plane.
origin: { origin: {
x: number, x: number,
y: number, y: number,
z: number, z: number,
}, },
type: "plane",
// Type for a plane.
value: "XY" | "XZ" | "YZ" | "Custom",
// What should the planes X axis be? // What should the planes X axis be?
x_axis: {
x: number,
y: number,
z: number,
},
// What should the planes 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: { xAxis: {
x: number, x: number,
y: number, y: number,
z: number, z: number,
}, },
// The y-axis of the extrude group base plane in the 3D space // What should the planes Y axis be?
yAxis: { yAxis: {
x: number, x: number,
y: number, y: number,
z: 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 faces X axis be?
xAxis: {
x: number,
y: number,
z: number,
},
// What should the faces Y axis be?
yAxis: {
x: number,
y: number,
z: number,
},
// The z-axis (normal).
zAxis: { zAxis: {
x: number, x: number,
y: number, y: number,
@ -3619,8 +3493,7 @@ circle(plane: SketchData, center: [number, number], radius: number) -> SketchGro
}, },
} }
``` ```
* `center`: `[number, number]` * `tag`: `String` (OPTIONAL)
* `radius`: `number`
#### Returns #### Returns
@ -3798,12 +3671,12 @@ Close the current sketch.
``` ```
close(sketch_group: SketchGroup) -> SketchGroup close(sketch_group: SketchGroup, tag?: String) -> SketchGroup
``` ```
#### Arguments #### 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. // The plane id or face id of the sketch group.
@ -3967,6 +3840,7 @@ close(sketch_group: SketchGroup) -> SketchGroup
}, },
} }
``` ```
* `tag`: `String` (OPTIONAL)
#### Returns #### Returns
@ -4149,7 +4023,7 @@ cos(num: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
#### Returns #### Returns
@ -4188,8 +4062,8 @@ extrude(length: number, sketch_group: SketchGroup) -> ExtrudeGroup
#### Arguments #### Arguments
* `length`: `number` * `length`: `number` (REQUIRED)
* `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. // The plane id or face id of the sketch group.
@ -4502,7 +4376,7 @@ fillet(data: FilletData, extrude_group: ExtrudeGroup) -> ExtrudeGroup
#### Arguments #### Arguments
* `data`: `FilletData` - Data for fillets. * `data`: `FilletData` - Data for fillets. (REQUIRED)
``` ```
{ {
// The radius of the fillet. // The radius of the fillet.
@ -4512,7 +4386,7 @@ fillet(data: FilletData, extrude_group: ExtrudeGroup) -> ExtrudeGroup
string], 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 // The id of the extrusion end cap
@ -4792,7 +4666,7 @@ floor(num: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
#### Returns #### Returns
@ -4812,8 +4686,8 @@ getExtrudeWallTransform(surface_name: string, extrude_group: ExtrudeGroup) -> Ex
#### Arguments #### Arguments
* `surface_name`: `string` * `surface_name`: `string` (REQUIRED)
* `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 // The id of the extrusion end cap
@ -4969,8 +4843,8 @@ getNextAdjacentEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid
#### Arguments #### Arguments
* `tag`: `String` * `tag`: `String` (REQUIRED)
* `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 // The id of the extrusion end cap
@ -5120,8 +4994,8 @@ getOppositeEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid
#### Arguments #### Arguments
* `tag`: `String` * `tag`: `String` (REQUIRED)
* `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 // The id of the extrusion end cap
@ -5271,8 +5145,8 @@ getPreviousAdjacentEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid
#### Arguments #### Arguments
* `tag`: `String` * `tag`: `String` (REQUIRED)
* `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 // The id of the extrusion end cap
@ -5422,7 +5296,7 @@ hole(hole_sketch_group: SketchGroupSet, sketch_group: SketchGroup) -> SketchGrou
#### Arguments #### 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. // 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", 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. // 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 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 #### Arguments
* `file_path`: `String` * `file_path`: `String` (REQUIRED)
* `options`: `ImportFormat` - Import format specifier * `options`: `ImportFormat` - Import format specifier (OPTIONAL)
``` ```
{ {
type: "fbx", type: "fbx",
@ -6046,7 +5920,7 @@ lastSegX(sketch_group: SketchGroup) -> number
#### Arguments #### 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. // The plane id or face id of the sketch group.
@ -6229,7 +6103,7 @@ lastSegY(sketch_group: SketchGroup) -> number
#### Arguments #### 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. // The plane id or face id of the sketch group.
@ -6412,8 +6286,8 @@ legAngX(hypotenuse: number, leg: number) -> number
#### Arguments #### Arguments
* `hypotenuse`: `number` * `hypotenuse`: `number` (REQUIRED)
* `leg`: `number` * `leg`: `number` (REQUIRED)
#### Returns #### Returns
@ -6433,8 +6307,8 @@ legAngY(hypotenuse: number, leg: number) -> number
#### Arguments #### Arguments
* `hypotenuse`: `number` * `hypotenuse`: `number` (REQUIRED)
* `leg`: `number` * `leg`: `number` (REQUIRED)
#### Returns #### Returns
@ -6454,8 +6328,8 @@ legLen(hypotenuse: number, leg: number) -> number
#### Arguments #### Arguments
* `hypotenuse`: `number` * `hypotenuse`: `number` (REQUIRED)
* `leg`: `number` * `leg`: `number` (REQUIRED)
#### Returns #### Returns
@ -6475,7 +6349,7 @@ line(data: LineData, sketch_group: SketchGroup) -> SketchGroup
#### Arguments #### Arguments
* `data`: `LineData` - Data to draw a line. * `data`: `LineData` - Data to draw a line. (REQUIRED)
``` ```
{ {
// The tag. // The tag.
@ -6485,7 +6359,7 @@ line(data: LineData, sketch_group: SketchGroup) -> SketchGroup
} | } |
[number, number] [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. // The plane id or face id of the sketch group.
@ -6831,7 +6705,7 @@ lineTo(data: LineToData, sketch_group: SketchGroup) -> SketchGroup
#### Arguments #### Arguments
* `data`: `LineToData` - Data to draw a line to a point. * `data`: `LineToData` - Data to draw a line to a point. (REQUIRED)
``` ```
{ {
// The tag. // The tag.
@ -6841,7 +6715,7 @@ lineTo(data: LineToData, sketch_group: SketchGroup) -> SketchGroup
} | } |
[number, number] [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. // The plane id or face id of the sketch group.
@ -7187,7 +7061,7 @@ ln(num: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
#### Returns #### Returns
@ -7207,8 +7081,8 @@ log(num: number, base: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
* `base`: `number` * `base`: `number` (REQUIRED)
#### Returns #### Returns
@ -7228,7 +7102,7 @@ log10(num: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
#### Returns #### Returns
@ -7248,7 +7122,7 @@ log2(num: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
#### Returns #### Returns
@ -7268,7 +7142,7 @@ max(args: [number]) -> number
#### Arguments #### Arguments
* `args`: `[number]` * `args`: `[number]` (REQUIRED)
#### Returns #### Returns
@ -7288,7 +7162,7 @@ min(args: [number]) -> number
#### Arguments #### Arguments
* `args`: `[number]` * `args`: `[number]` (REQUIRED)
#### Returns #### Returns
@ -7308,7 +7182,7 @@ patternCircular(data: CircularPatternData, geometry: Geometry) -> Geometries
#### Arguments #### 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. // 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, rotateDuplicates: string,
} }
``` ```
* `geometry`: `Geometry` - A geometry. * `geometry`: `Geometry` - A geometry. (REQUIRED)
``` ```
{ {
// The plane id or face id of the sketch group. // The plane id or face id of the sketch group.
@ -7644,7 +7518,7 @@ patternLinear(data: LinearPatternData, geometry: Geometry) -> Geometries
#### Arguments #### 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. // The axis of the pattern. This is a 2D vector.
@ -7655,7 +7529,7 @@ patternLinear(data: LinearPatternData, geometry: Geometry) -> Geometries
repetitions: number, repetitions: number,
} }
``` ```
* `geometry`: `Geometry` - A geometry. * `geometry`: `Geometry` - A geometry. (REQUIRED)
``` ```
{ {
// The plane id or face id of the sketch group. // The plane id or face id of the sketch group.
@ -7995,8 +7869,8 @@ pow(num: number, pow: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
* `pow`: `number` * `pow`: `number` (REQUIRED)
#### Returns #### Returns
@ -8016,8 +7890,8 @@ segAng(segment_name: string, sketch_group: SketchGroup) -> number
#### Arguments #### Arguments
* `segment_name`: `string` * `segment_name`: `string` (REQUIRED)
* `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. // The plane id or face id of the sketch group.
@ -8200,8 +8074,8 @@ segEndX(segment_name: string, sketch_group: SketchGroup) -> number
#### Arguments #### Arguments
* `segment_name`: `string` * `segment_name`: `string` (REQUIRED)
* `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. // The plane id or face id of the sketch group.
@ -8384,8 +8258,8 @@ segEndY(segment_name: string, sketch_group: SketchGroup) -> number
#### Arguments #### Arguments
* `segment_name`: `string` * `segment_name`: `string` (REQUIRED)
* `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. // The plane id or face id of the sketch group.
@ -8568,8 +8442,8 @@ segLen(segment_name: string, sketch_group: SketchGroup) -> number
#### Arguments #### Arguments
* `segment_name`: `string` * `segment_name`: `string` (REQUIRED)
* `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. // The plane id or face id of the sketch group.
@ -8752,7 +8626,7 @@ sin(num: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
#### Returns #### Returns
@ -8772,7 +8646,7 @@ sqrt(num: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
#### Returns #### Returns
@ -8792,7 +8666,7 @@ startProfileAt(data: LineData, sketch_surface: SketchSurface) -> SketchGroup
#### Arguments #### Arguments
* `data`: `LineData` - Data to draw a line. * `data`: `LineData` - Data to draw a line. (REQUIRED)
``` ```
{ {
// The tag. // The tag.
@ -8802,7 +8676,7 @@ startProfileAt(data: LineData, sketch_surface: SketchSurface) -> SketchGroup
} | } |
[number, number] [number, number]
``` ```
* `sketch_surface`: `SketchSurface` - A sketch group type. * `sketch_surface`: `SketchSurface` - A sketch group type. (REQUIRED)
``` ```
{ {
// The id of the plane. // The id of the plane.
@ -9045,7 +8919,7 @@ startSketchAt(data: LineData) -> SketchGroup
#### Arguments #### Arguments
* `data`: `LineData` - Data to draw a line. * `data`: `LineData` - Data to draw a line. (REQUIRED)
``` ```
{ {
// The tag. // 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 #### 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" |
"-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" | "start" | "end" |
string string
@ -9486,7 +9360,7 @@ tan(num: number) -> number
#### Arguments #### Arguments
* `num`: `number` * `num`: `number` (REQUIRED)
#### Returns #### Returns
@ -9506,7 +9380,7 @@ tangentialArc(data: TangentialArcData, sketch_group: SketchGroup) -> SketchGroup
#### Arguments #### Arguments
* `data`: `TangentialArcData` - Data to draw a tangential arc. * `data`: `TangentialArcData` - Data to draw a tangential arc. (REQUIRED)
``` ```
{ {
// Offset of the arc, in degrees. // Offset of the arc, in degrees.
@ -9522,7 +9396,7 @@ tangentialArc(data: TangentialArcData, sketch_group: SketchGroup) -> SketchGroup
} | } |
[number, number] [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. // 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 #### Arguments
* `to`: `[number]` * `to`: `[number]` (REQUIRED)
* `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. // 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 #### Returns
@ -10235,7 +10109,7 @@ xLine(data: AxisLineData, sketch_group: SketchGroup) -> SketchGroup
#### Arguments #### 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. // The length of the line.
@ -10245,7 +10119,7 @@ xLine(data: AxisLineData, 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. // The plane id or face id of the sketch group.
@ -10591,7 +10465,7 @@ xLineTo(data: AxisLineToData, sketch_group: SketchGroup) -> SketchGroup
#### Arguments #### 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. // The tag.
@ -10601,7 +10475,7 @@ xLineTo(data: AxisLineToData, 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. // The plane id or face id of the sketch group.
@ -10947,7 +10821,7 @@ yLine(data: AxisLineData, sketch_group: SketchGroup) -> SketchGroup
#### Arguments #### 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. // The length of the line.
@ -10957,7 +10831,7 @@ yLine(data: AxisLineData, 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. // The plane id or face id of the sketch group.
@ -11303,7 +11177,7 @@ yLineTo(data: AxisLineToData, sketch_group: SketchGroup) -> SketchGroup
#### Arguments #### 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. // The tag.
@ -11313,7 +11187,7 @@ yLineTo(data: AxisLineToData, 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. // The plane id or face id of the sketch group.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -1,6 +1,6 @@
{ {
"name": "untitled-app", "name": "untitled-app",
"version": "0.15.5", "version": "0.15.6",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@codemirror/autocomplete": "^6.10.2", "@codemirror/autocomplete": "^6.10.2",

164
src-tauri/Cargo.lock generated
View File

@ -144,9 +144,9 @@ dependencies = [
[[package]] [[package]]
name = "async-io" name = "async-io"
version = "2.3.1" version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65" checksum = "dcccb0f599cfa2f8ace422d3555572f47424da5648a4382a9dd0310ff8210884"
dependencies = [ dependencies = [
"async-lock 3.3.0", "async-lock 3.3.0",
"cfg-if", "cfg-if",
@ -313,6 +313,12 @@ version = "0.21.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d"
[[package]]
name = "base64"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51"
[[package]] [[package]]
name = "base64ct" name = "base64ct"
version = "1.6.0" version = "1.6.0"
@ -426,9 +432,9 @@ dependencies = [
[[package]] [[package]]
name = "bytemuck_derive" name = "bytemuck_derive"
version = "1.5.0" version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1805,7 +1811,7 @@ dependencies = [
"futures-sink", "futures-sink",
"futures-util", "futures-util",
"http", "http",
"indexmap 2.0.0", "indexmap 2.2.5",
"slab", "slab",
"tokio", "tokio",
"tokio-util", "tokio-util",
@ -1820,9 +1826,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.14.0" version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
[[package]] [[package]]
name = "heck" name = "heck"
@ -2021,12 +2027,12 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.0.0" version = "2.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown 0.14.0", "hashbrown 0.14.3",
"serde", "serde",
] ]
@ -2371,9 +2377,9 @@ dependencies = [
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.20" version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
dependencies = [ dependencies = [
"serde", "serde",
] ]
@ -2788,9 +2794,9 @@ checksum = "44d11de466f4a3006fe8a5e7ec84e93b79c70cb992ae0aa0eb631ad2df8abfe2"
[[package]] [[package]]
name = "open" name = "open"
version = "4.2.0" version = "5.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a083c0c7e5e4a8ec4176346cf61f67ac674e8bfb059d9226e1c54a96b377c12" checksum = "449f0ff855d85ddbf1edd5b646d65249ead3f5e422aaa86b7d2d0b049b103e32"
dependencies = [ dependencies = [
"is-wsl", "is-wsl",
"libc", "libc",
@ -3910,9 +3916,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.112" version = "1.0.114"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d1bd37ce2324cf3bf85e5a25f96eb4baf0d5aa6eba43e7ae8958870c4ec48ed" checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0"
dependencies = [ dependencies = [
"itoa 1.0.6", "itoa 1.0.6",
"ryu", "ryu",
@ -3971,7 +3977,7 @@ dependencies = [
"chrono", "chrono",
"hex", "hex",
"indexmap 1.9.3", "indexmap 1.9.3",
"indexmap 2.0.0", "indexmap 2.2.5",
"serde", "serde",
"serde_json", "serde_json",
"serde_with_macros", "serde_with_macros",
@ -4453,9 +4459,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri" name = "tauri"
version = "2.0.0-beta.8" version = "2.0.0-beta.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2bd3d5ccf5316833c0f71c645c25585bddf997a16bea652bf3eab8114273cff" checksum = "e7ad6ebcb36709f29f161bd017c14c247b110a8563d90531f879df096510d697"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@ -4482,7 +4488,6 @@ dependencies = [
"serde_repr", "serde_repr",
"serialize-to-javascript", "serialize-to-javascript",
"state", "state",
"static_assertions",
"swift-rs", "swift-rs",
"tauri-build", "tauri-build",
"tauri-macros", "tauri-macros",
@ -4493,6 +4498,7 @@ dependencies = [
"tokio", "tokio",
"tray-icon", "tray-icon",
"url", "url",
"urlpattern",
"webkit2gtk", "webkit2gtk",
"webview2-com", "webview2-com",
"window-vibrancy", "window-vibrancy",
@ -4501,9 +4507,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-build" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ca30dbed856449b41abed13a5a46655ea2196075e09e99e22fe8ed0958b6aee" checksum = "746bc44948a2de0535fd66dd11510973f091d84a2d5cb61f2cdef9db85080816"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cargo_toml", "cargo_toml",
@ -4523,11 +4529,11 @@ dependencies = [
[[package]] [[package]]
name = "tauri-codegen" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4ed45a0d2a1723ef4ea71d1aa5809c4a8bcaa92de77f6c9a8f4d4f28c5d86a" checksum = "9d54988388d81d51c778cb93854553d6e50d3afa8fb7693ff362f718c06956f2"
dependencies = [ dependencies = [
"base64 0.21.2", "base64 0.22.0",
"brotli", "brotli",
"ico", "ico",
"json-patch", "json-patch",
@ -4550,9 +4556,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-macros" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0a75661fb86b350141e78ad54ce9c60346149afc5cbf41de2ca60a1ebc252b3" checksum = "2aa739d28ebddc149d781851a22f8d4f0d1e76de7d7348475c5072cb60f56c07"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
@ -4564,9 +4570,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-plugin" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9530f0f0d809e77ff9a93da5ff2483faf8fef2cb8ed125ca7b0172cb92685d4" checksum = "62895dc0fbcf604a20a1559e742b8eb79230e2c98564d0b99c77c953a48fd60d"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"glob", "glob",
@ -4581,9 +4587,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-plugin-dialog" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ed2ac81ffb8fd76d854578784491bbf8d8baba274fa9e18c0bbdc4ba00b0013" checksum = "14c7894fb904ed003fd15915b263655672be4e4581298f7fa8916016e50010ed"
dependencies = [ dependencies = [
"glib 0.16.9", "glib 0.16.9",
"log", "log",
@ -4599,9 +4605,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-plugin-fs" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4a556b50d761ec405087bf67e82b3936ddeaf39d4d602a443e2a0d2df6cdb2a" checksum = "d5d71f69535111078131380bcf2a4c2f190ef4d045a33d787a606e7d4fc6a786"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"glob", "glob",
@ -4618,13 +4624,13 @@ dependencies = [
[[package]] [[package]]
name = "tauri-plugin-http" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f5c00ebdfdab74d9669460665a1158dacd0cc692bf95a3b7d7e5160ebbd8ad0" checksum = "8ed4a2d9de58cafba4dbafff9330ed56b57176b9e6a153268113ffc66b5f70e7"
dependencies = [ dependencies = [
"data-url", "data-url",
"glob",
"http", "http",
"regex",
"reqwest", "reqwest",
"schemars", "schemars",
"serde", "serde",
@ -4634,13 +4640,14 @@ dependencies = [
"tauri-plugin-fs", "tauri-plugin-fs",
"thiserror", "thiserror",
"url", "url",
"urlpattern",
] ]
[[package]] [[package]]
name = "tauri-plugin-os" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f9bd936030047ce0143dda585f908f4e8433089c4aa95ef182959283483abfb" checksum = "29d3b15199f234b9f9c9df69e75aaf0d3e001ffa71c53d7c91c0aaca02964503"
dependencies = [ dependencies = [
"gethostname", "gethostname",
"log", "log",
@ -4656,9 +4663,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-plugin-shell" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb42a100bd4b6adad6f07455f54c5916d32be79d81e5914478ece45a04560cad" checksum = "19e5c2d4187bc552d1be72081588c34187eb29e4c375cdfe99872f8d57b6aead"
dependencies = [ dependencies = [
"encoding_rs", "encoding_rs",
"log", "log",
@ -4676,9 +4683,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-plugin-updater" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "587dfbe753c43e5db6c7f82b399c7c9f548c744ce7485d0f41a55ad7bb31d23c" checksum = "6cb1f95a0fa908434f19241137255ad84bc9433b4b5ce6727f26f6b22a74622e"
dependencies = [ dependencies = [
"base64 0.21.2", "base64 0.21.2",
"dirs-next", "dirs-next",
@ -4704,9 +4711,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0381b4b96e1f4f39a24ca6472c9b016151b103a54b1425233007fdbc26cf20a8" checksum = "b5a16d9e5634401c03477d2c3ff3d5c051efb05ed48fda5a8757e2d3e7859d6d"
dependencies = [ dependencies = [
"gtk", "gtk",
"http", "http",
@ -4722,14 +4729,15 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime-wry" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eef6a8373c9936b33a58c1bdbdd76fe4603d00ebe72304c0777bf0674e455aa" checksum = "71cd401defa237dc112b9e53f40f628c1cac6dfdd56d6ecbba6ad85b5a016d0c"
dependencies = [ dependencies = [
"cocoa", "cocoa",
"gtk", "gtk",
"http", "http",
"jni", "jni",
"log",
"percent-encoding", "percent-encoding",
"raw-window-handle 0.6.0", "raw-window-handle 0.6.0",
"softbuffer", "softbuffer",
@ -4745,9 +4753,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-utils" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92e35e2f9a5ee8539d00dde621f176647747736a388a07c3083a0cc1b96ba6d7" checksum = "1e9ab52971229a67ca96a8cefb7671d32aca844558518bda8e545ee5c8e1a787"
dependencies = [ dependencies = [
"brotli", "brotli",
"cargo_metadata", "cargo_metadata",
@ -4764,6 +4772,7 @@ dependencies = [
"phf 0.11.2", "phf 0.11.2",
"proc-macro2", "proc-macro2",
"quote", "quote",
"regex",
"schemars", "schemars",
"semver", "semver",
"serde", "serde",
@ -4773,6 +4782,7 @@ dependencies = [
"thiserror", "thiserror",
"toml 0.8.2", "toml 0.8.2",
"url", "url",
"urlpattern",
"walkdir", "walkdir",
] ]
@ -4966,7 +4976,7 @@ version = "0.19.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [ dependencies = [
"indexmap 2.0.0", "indexmap 2.2.5",
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
@ -4979,7 +4989,7 @@ version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
dependencies = [ dependencies = [
"indexmap 2.0.0", "indexmap 2.2.5",
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
@ -5120,6 +5130,47 @@ dependencies = [
"winapi", "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]] [[package]]
name = "unicase" name = "unicase"
version = "2.7.0" version = "2.7.0"
@ -5174,6 +5225,19 @@ dependencies = [
"serde", "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]] [[package]]
name = "utf-8" name = "utf-8"
version = "0.7.6" version = "0.7.6"

View File

@ -55,5 +55,5 @@
} }
}, },
"productName": "zoo-modeling-app", "productName": "zoo-modeling-app",
"version": "0.15.5" "version": "0.15.6"
} }

View File

@ -731,6 +731,7 @@ export class CameraControls {
async tweenCameraToQuaternion( async tweenCameraToQuaternion(
targetQuaternion: Quaternion, targetQuaternion: Quaternion,
targetPosition = new Vector3(),
duration = 500, duration = 500,
toOrthographic = true toOrthographic = true
): Promise<void> { ): Promise<void> {
@ -750,12 +751,14 @@ export class CameraControls {
} }
await this._tweenCameraToQuaternion( await this._tweenCameraToQuaternion(
targetQuaternion, targetQuaternion,
targetPosition,
remainingDuration, remainingDuration,
toOrthographic toOrthographic
) )
} }
_tweenCameraToQuaternion( _tweenCameraToQuaternion(
targetQuaternion: Quaternion, targetQuaternion: Quaternion,
targetPosition: Vector3,
duration = 500, duration = 500,
toOrthographic = false toOrthographic = false
): Promise<void> { ): Promise<void> {
@ -763,10 +766,11 @@ export class CameraControls {
const camera = this.camera const camera = this.camera
this._isCamMovingCallback(true, true) this._isCamMovingCallback(true, true)
const initialQuaternion = camera.quaternion.clone() const initialQuaternion = camera.quaternion.clone()
const initialTarget = this.target.clone()
const isVertical = isQuaternionVertical(targetQuaternion) const isVertical = isQuaternionVertical(targetQuaternion)
let tweenEnd = isVertical ? 0.99 : 1 let tweenEnd = isVertical ? 0.99 : 1
const controlsTarget = this.target.clone() const tempVec = new Vector3()
const initialDistance = controlsTarget.distanceTo(camera.position.clone()) const initialDistance = initialTarget.distanceTo(camera.position.clone())
const cameraAtTime = (animationProgress: number /* 0 - 1 */) => { const cameraAtTime = (animationProgress: number /* 0 - 1 */) => {
const currentQ = tempQuaternion.slerpQuaternions( const currentQ = tempQuaternion.slerpQuaternions(
@ -774,6 +778,11 @@ export class CameraControls {
targetQuaternion, targetQuaternion,
animationProgress animationProgress
) )
const currentTarget = tempVec.lerpVectors(
initialTarget,
targetPosition,
animationProgress
)
if (this.camera instanceof PerspectiveCamera) if (this.camera instanceof PerspectiveCamera)
// changing the camera position back when it's orthographic doesn't do anything // changing the camera position back when it's orthographic doesn't do anything
// and it messes up animating back to perspective later // and it messes up animating back to perspective later
@ -781,12 +790,11 @@ export class CameraControls {
.set(0, 0, 1) .set(0, 0, 1)
.applyQuaternion(currentQ) .applyQuaternion(currentQ)
.multiplyScalar(initialDistance) .multiplyScalar(initialDistance)
.add(controlsTarget) .add(currentTarget)
this.camera.up.set(0, 1, 0).applyQuaternion(currentQ).normalize() this.camera.up.set(0, 1, 0).applyQuaternion(currentQ).normalize()
this.camera.quaternion.copy(currentQ) this.camera.quaternion.copy(currentQ)
this.target.copy(controlsTarget) this.target.copy(currentTarget)
// this.controls.update()
this.camera.updateProjectionMatrix() this.camera.updateProjectionMatrix()
this.update() this.update()
this.onCameraChange() this.onCameraChange()

View File

@ -1,6 +1,6 @@
.button { .button {
@apply flex justify-between items-center gap-2 px-2 py-1 text-left border-none rounded-sm; @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 ui-active:bg-energy-10/50 ui-active:text-inherit;
@apply transition-colors ease-out; @apply transition-colors ease-out;
} }

View File

@ -1,9 +1,6 @@
import { Menu } from '@headlessui/react' import { Menu } from '@headlessui/react'
import { PropsWithChildren } from 'react' import { PropsWithChildren } from 'react'
import { import { faArrowUpRightFromSquare } from '@fortawesome/free-solid-svg-icons'
faArrowUpRightFromSquare,
faEllipsis,
} from '@fortawesome/free-solid-svg-icons'
import { ActionIcon } from './ActionIcon' import { ActionIcon } from './ActionIcon'
import styles from './CodeMenu.module.css' import styles from './CodeMenu.module.css'
import { useConvertToVariable } from 'hooks/useToolbarGuards' import { useConvertToVariable } from 'hooks/useToolbarGuards'
@ -29,7 +26,7 @@ export const CodeMenu = ({ children }: PropsWithChildren) => {
> >
<Menu.Button className="p-0 border-none relative"> <Menu.Button className="p-0 border-none relative">
<ActionIcon <ActionIcon
icon={faEllipsis} icon="three-dots"
className="p-1" className="p-1"
size="sm" size="sm"
bgClassName={ bgClassName={

View File

@ -29,6 +29,7 @@ export type CustomIconName =
| 'search' | 'search'
| 'settings' | 'settings'
| 'sketch' | 'sketch'
| 'three-dots'
| 'vertical' | 'vertical'
export const CustomIcon = ({ export const CustomIcon = ({
@ -516,6 +517,22 @@ export const CustomIcon = ({
/> />
</svg> </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': case 'vertical':
return ( return (
<svg <svg

View File

@ -106,7 +106,7 @@ function ProjectCard({
<> <>
<div className="p-1 flex flex-col h-full gap-2"> <div className="p-1 flex flex-col h-full gap-2">
<Link <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)}`} to={`${paths.FILE}/${encodeURIComponent(project.path)}`}
data-testid="project-link" data-testid="project-link"
> >

View File

@ -11,6 +11,7 @@ import { sep } from '@tauri-apps/api/path'
import { Logo } from './Logo' import { Logo } from './Logo'
import { APP_NAME } from 'lib/constants' import { APP_NAME } from 'lib/constants'
import { useCommandsContext } from 'hooks/useCommandsContext' import { useCommandsContext } from 'hooks/useCommandsContext'
import { CustomIcon } from './CustomIcon'
const ProjectSidebarMenu = ({ const ProjectSidebarMenu = ({
project, project,
@ -21,29 +22,49 @@ const ProjectSidebarMenu = ({
project?: IndexLoaderData['project'] project?: IndexLoaderData['project']
file?: IndexLoaderData['file'] file?: IndexLoaderData['file']
}) => { }) => {
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="!no-underline"
data-testid="project-sidebar-link"
>
<span
className="hidden text-sm text-chalkboard-110 dark:text-chalkboard-20 whitespace-nowrap lg:block"
data-testid="project-sidebar-link-name"
>
{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() const { commandBarSend } = useCommandsContext()
return renderAsLink ? ( return (
<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"
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"
>
{project?.name ? project.name : APP_NAME}
</span>
</Link>
) : (
<Popover className="relative"> <Popover className="relative">
<Popover.Button <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" 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"> <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"> <span className="hidden text-sm text-chalkboard-110 dark:text-chalkboard-20 whitespace-nowrap lg:block">
{isTauri() && file?.name {isTauri() && file?.name
@ -85,7 +106,6 @@ const ProjectSidebarMenu = ({
{({ close }) => ( {({ close }) => (
<> <>
<div className="flex items-center gap-4 px-4 py-3"> <div className="flex items-center gap-4 px-4 py-3">
<Logo />
<div> <div>
<p <p
className="m-0 text-chalkboard-100 dark:text-energy-10 text-mono" className="m-0 text-chalkboard-100 dark:text-energy-10 text-mono"

View File

@ -88,11 +88,11 @@ button:disabled {
} }
a:not(.action-button) { 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) { .dark a:not(.action-button) {
@apply text-chalkboard-20 hover:text-energy-10; @apply text-energy-20 hover:text-energy-10;
} }
input { input {

View File

@ -27,22 +27,34 @@ export type Toggle = 'On' | 'Off'
export const SETTINGS_PERSIST_KEY = 'SETTINGS_PERSIST_KEY' 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( export const settingsMachine = createMachine(
{ {
/** @xstate-layout N4IgpgJg5mDOIC5QGUwBc0EsB2VYDpMIAbMAYlTQAIAVACzAFswBtABgF1FQAHAe1iYsfbNxAAPRAA42+AEwB2KQFYAzGznKAnADZli1QBoQAT2kBGKfm37lOned3nzqgL6vjlLLgJFSFdCoAETAAMwBDAFdiagAFACc+ACswAGNqADlw5nYuJBB+QWFRfMkEABY5fDYa2rra83LjMwQdLWV8BXLyuxlVLU1Ld090bzxCEnJKYLComODMeLS0PniTXLFCoUwRMTK7fC1zNql7NgUjtnKjU0RlBSqpLVUVPVUda60tYZAvHHG-FNAgBVbBCKjIEywNBMDb5LbFPaILqdfRSORsS4qcxXZqIHqyK6qY4XOxsGTKco-P4+Cb+aYAIXCsDAVFBQjhvAE212pWkskUKnUml0+gUNxaqkU+EccnKF1UCnucnMcjcHl+o3+vkmZBofCgUFIMwARpEoFRYuFsGBiJyCtzEXzWrJlGxlKdVFKvfY1XiEBjyvhVOVzBdzu13pYFNStbTAQFqAB5bAmvjheIQf4QtDhNCRWD2hE7EqgfayHTEh7lHQNSxSf1Scz4cpHHFyFVujTKczuDXYPgQOBiGl4TaOktIhAAWg6X3nC4Xp39050sYw2rpYHHRUnztVhPJqmUlIGbEriv9WhrLZ6uibHcqUr7riAA */ /** @xstate-layout N4IgpgJg5mDOIC5QGUwBc0EsB2VYDpMIAbMAYlTQAIAVACzAFswBtABgF1FQAHAe1iYsfbNxAAPRAA42+AEwB2KQFYAzGznKAnADZli1QBoQAT2kBGKfm37lOned3nzqgL6vjlLLgJFSFdCoAETAAMwBDAFdiagAFACc+ACswAGNqADlw5nYuJBB+QWFRfMkEABY5fDYa2rra83LjMwQdLWV8BXLyuxlVLU1Ld090bzxCEnJKYLComODMeLS0PniTXLFCoUwRMTK7fC1zNql7NgUjtnKjU0RlBSqpLVUVPVUda60tYZAvHHG-FNAgBVbBCKjIEywNBMDb5LbFPaILqdfRSORsS4qcxXZqIHqyK6qY4XOxsGTKco-P4+Cb+aYAIXCsDAVFBQjhvAE212pWkskUKnUml0+gUNxaqkU+EccnKF1UCnucnMcjcHl+o3+vkmZBofCgUFIMwARpEoFRYuFsGBiJyCtzEXzWrJlGxlKdVFKvfY1XiEBjyvhVOVzBdzu13pYFNStbTAQFqAB5bAmvjheIQf4QtDhNCRWD2hE7EqgfayHTEh7lHQNSxSf1Scz4cpHHFyFVujTKczuDXYPgQOBiGl4TaOktIhAAWg6X3nC4Xp39050sYw2rpYHHRUnztVhPJqmUlIGbEriv9WhrLZ6uibHcqUr7riAA */
id: 'Settings', id: 'Settings',
predictableActionArguments: true, predictableActionArguments: true,
context: { context: {
baseUnit: 'mm' as BaseUnit, baseUnit: 'mm',
cameraControls: 'KittyCAD' as CameraSystem, cameraControls: 'KittyCAD',
defaultDirectory: '', defaultDirectory: '',
defaultProjectName: DEFAULT_PROJECT_NAME, defaultProjectName: DEFAULT_PROJECT_NAME,
onboardingStatus: '', onboardingStatus: '',
showDebugPanel: false, showDebugPanel: false,
textWrapping: 'On' as Toggle, textWrapping: 'On',
theme: Themes.System, theme: Themes.System,
unitSystem: UnitSystem.Metric, unitSystem: UnitSystem.Metric,
}, } as SettingsMachineContext,
initial: 'idle', initial: 'idle',
states: { states: {
idle: { idle: {

View File

@ -33,9 +33,10 @@ export default function Units() {
} }
> >
<SettingsSection <SettingsSection
title="Camera Controls" title="Mouse 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." 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" className="my-4 last-of-type:mb-12"
headingClassName="text-3xl font-bold"
> >
<select <select
id="camera-controls" id="camera-controls"
@ -70,6 +71,7 @@ export default function Units() {
</ul> </ul>
</SettingsSection> </SettingsSection>
<OnboardingButtons <OnboardingButtons
currentSlug={onboardingPaths.CAMERA}
dismiss={dismiss} dismiss={dismiss}
next={next} next={next}
nextText="Next: Streaming" nextText="Next: Streaming"

View File

@ -1,5 +1,5 @@
import usePlatform from 'hooks/usePlatform' import usePlatform from 'hooks/usePlatform'
import { OnboardingButtons, useDismiss, useNextClick } from '.' import { OnboardingButtons, kbdClasses, useDismiss, useNextClick } from '.'
import { onboardingPaths } from 'routes/Onboarding/paths' import { onboardingPaths } from 'routes/Onboarding/paths'
import { useStore } from '../../useStore' import { useStore } from '../../useStore'
@ -24,11 +24,11 @@ export default function CmdK() {
Press{' '} Press{' '}
{platformName === 'macos' ? ( {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. to open the command bar. Try changing your theme with it.
@ -44,11 +44,11 @@ export default function CmdK() {
> >
XState XState
</a> </a>
. Currently you can only control settings, authentication, and file . You can control settings, authentication, and file management from
management from the command bar, but we will be powering modeling the command bar, as well as a growing number of modeling commands.
commands with it soon.
</p> </p>
<OnboardingButtons <OnboardingButtons
currentSlug={onboardingPaths.COMMAND_K}
dismiss={dismiss} dismiss={dismiss}
next={next} next={next}
nextText="Next: User Menu" nextText="Next: User Menu"

View File

@ -13,7 +13,7 @@ export default function CodeEditor() {
return ( return (
<div className="fixed grid justify-end items-center inset-0 z-50 pointer-events-none"> <div className="fixed grid justify-end items-center inset-0 z-50 pointer-events-none">
<div <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') }} style={{ clipPath: useBackdropHighlight('code-pane') }}
></div> ></div>
<div <div
@ -23,24 +23,45 @@ export default function CodeEditor() {
} }
> >
<section className="flex-1"> <section className="flex-1">
<h2 className="text-2xl font-bold"> <h2 className="text-3xl font-bold">
Editing code with <code>kcl</code> Editing code with{' '}
<span className="text-energy-60 dark:text-energy-20">kcl</span>
</h2> </h2>
<p className="my-4"> <p className="my-4">
The left pane is where you write your code. It's a code editor with kcl is our language for describing geometry. Building our own
syntax highlighting and autocompletion. We've decided to take the language is difficult, but we chose to do it to have a language
difficult route of writing our own languagecalled <code>kcl</code> honed for spatial relationships and geometric computation. It'll
for describing geometry, because we don't want to inherit all the always be open-source, and we hope it can grow into a new standard
other functionality from existing languages. We have a lot of ideas for describing parametric objects.
about how <code>kcl</code> will evolve, and we want to hear your
thoughts on it.
</p> </p>
<p className="my-4"> <p className="my-4">
We've built a language server for <code>kcl</code> that provides The left pane is where you write your code. It's a code editor with
documentation and autocompletion automatically generated from our syntax highlighting and autocompletion for kcl. New features arrive
compiler code. You can try it out by hovering over some of the in kcl before they're available as point-and-click tools, so it's
function names in the pane now. If you like using VSCode, you can good to have a link to{' '}
try out our{' '} <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 <a
href="https://marketplace.visualstudio.com/items?itemName=KittyCAD.kcl-language-server" href="https://marketplace.visualstudio.com/items?itemName=KittyCAD.kcl-language-server"
rel="noreferrer noopener" rel="noreferrer noopener"
@ -57,6 +78,7 @@ export default function CodeEditor() {
</p> </p>
</section> </section>
<OnboardingButtons <OnboardingButtons
currentSlug={onboardingPaths.EDITOR}
dismiss={dismiss} dismiss={dismiss}
next={next} next={next}
nextText="Next: Parametric Modeling" nextText="Next: Parametric Modeling"

View File

@ -32,7 +32,7 @@ export default function Export() {
> >
our open-source extension proposal our open-source extension proposal
</a>{' '} </a>{' '}
for the GLTF file format.{' '} for the gLTF file format.{' '}
<a <a
href="https://zoo.dev/docs/api/convert-cad-file" href="https://zoo.dev/docs/api/convert-cad-file"
rel="noopener noreferrer" rel="noopener noreferrer"
@ -43,8 +43,20 @@ export default function Export() {
can convert to and from most common CAD file formats, allowing can convert to and from most common CAD file formats, allowing
export to almost any CAD software. export to almost any CAD software.
</p> </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> </section>
<OnboardingButtons <OnboardingButtons
currentSlug={onboardingPaths.EXPORT}
next={next} next={next}
dismiss={dismiss} dismiss={dismiss}
nextText="Next: Sketching" nextText="Next: Sketching"

View File

@ -4,6 +4,7 @@ import { bracket } from 'lib/exampleKcl'
import { kclManager } from 'lang/KclSingleton' import { kclManager } from 'lang/KclSingleton'
import { useModelingContext } from 'hooks/useModelingContext' import { useModelingContext } from 'hooks/useModelingContext'
import { APP_NAME } from 'lib/constants' import { APP_NAME } from 'lib/constants'
import { onboardingPaths } from './paths'
export default function FutureWork() { export default function FutureWork() {
const { send } = useModelingContext() const { send } = useModelingContext()
@ -28,16 +29,39 @@ export default function FutureWork() {
<p className="my-4"> <p className="my-4">
We have curves, cuts, and many more CAD features coming soon. We want 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 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 features you want to see next. Please message us in{' '}
and open issues on GitHub. <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>
<p className="my-4"> <p className="my-4">
If you make anything with the app we'd love to see it! Thank you for If you make anything with the app we'd love to see it, feel free to{' '}
taking time to try out {APP_NAME}, and build the future of hardware <a
design with us. 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>
<p className="my-4">💚 The Zoo Team</p> <p className="my-4">💚 The Zoo Team</p>
<OnboardingButtons <OnboardingButtons
currentSlug={onboardingPaths.FUTURE_WORK}
className="mt-6" className="mt-6"
dismiss={dismiss} dismiss={dismiss}
next={dismiss} next={dismiss}

View File

@ -1,4 +1,4 @@
import { OnboardingButtons, useDismiss, useNextClick } from '.' import { OnboardingButtons, kbdClasses, useDismiss, useNextClick } from '.'
import { onboardingPaths } from 'routes/Onboarding/paths' import { onboardingPaths } from 'routes/Onboarding/paths'
import { useStore } from '../../useStore' import { useStore } from '../../useStore'
import { useBackdropHighlight } from 'hooks/useBackdropHighlight' import { useBackdropHighlight } from 'hooks/useBackdropHighlight'
@ -23,52 +23,32 @@ export default function InteractiveNumbers() {
} }
> >
<section className="flex-1 overflow-y-auto mb-6"> <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"> <p className="my-4">
Let's do a little bit of hybrid editing to this part. Try changing the value of <code>width</code> on line 2 by holding
</p> the <kbd className={kbdClasses}>Alt</kbd> (or{' '}
<p className="my-4"> <kbd className={kbdClasses}>Option</kbd>) key and dragging the
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
number left and right. You can hold down different modifier keys to number left and right. You can hold down different modifier keys to
change the value by different increments: change the value by different increments:
</p> </p>
<table className="border-collapse text-sm mx-auto my-4"> <ul className="flex flex-col text-sm my-4 mx-12 divide-y divide-chalkboard-20 dark:divide-chalkboard-70">
<tbody> <li className="flex justify-between m-0 px-0 py-2">
<tr> <kbd className={kbdClasses}>Alt + Shift + Cmd/Win</kbd>
<td className="border border-solid w-1/2 py-1 px-2 border-chalkboard-40 dark:border-chalkboard-70"> ±0.01
<kbd>Alt + Shift + Cmd/Win</kbd> </li>
</td> <li className="flex justify-between m-0 px-0 py-2">
<td className="border border-solid w-1/2 py-1 px-2 border-chalkboard-40 dark:border-chalkboard-70 text-right"> <kbd className={kbdClasses}>Alt + Cmd/Win</kbd>
0.01 ±0.1
</td> </li>
</tr> <li className="flex justify-between m-0 px-0 py-2">
<tr> <kbd className={kbdClasses}>Alt</kbd>±1
<td className="border border-solid w-1/2 py-1 px-2 border-chalkboard-40 dark:border-chalkboard-70"> </li>
<kbd>Alt + Cmd/Win</kbd> <li className="flex justify-between m-0 px-0 py-2">
</td> <kbd className={kbdClasses}>Alt + Shift</kbd>
<td className="border border-solid w-1/2 py-1 px-2 border-chalkboard-40 dark:border-chalkboard-70 text-right"> ±10
0.1 </li>
</td> </ul>
</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>
<p className="my-4"> <p className="my-4">
Our code editor is built with{' '} Our code editor is built with{' '}
<a <a
@ -90,13 +70,14 @@ export default function InteractiveNumbers() {
lets you interact with numbers in your code by dragging them around. lets you interact with numbers in your code by dragging them around.
</p> </p>
<p className="my-4"> <p className="my-4">
Editing code should feel as interactive as point-and-click when you We believe editing in Modeling App should feel fluid between code
want it to be, so that you can work in the way that feels most 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 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. we'd love to hear your ideas for how to make it better.
</p> </p>
</section> </section>
<OnboardingButtons <OnboardingButtons
currentSlug={onboardingPaths.INTERACTIVE_NUMBERS}
dismiss={dismiss} dismiss={dismiss}
next={next} next={next}
nextText="Next: Command Bar" nextText="Next: Command Bar"

View File

@ -58,7 +58,7 @@ function OnboardingWithNewFile() {
<div className="max-w-3xl p-8 rounded bg-chalkboard-10 dark:bg-chalkboard-90"> <div className="max-w-3xl p-8 rounded bg-chalkboard-10 dark:bg-chalkboard-90">
{!isTauri() ? ( {!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 Replaying onboarding resets your code
</h1> </h1>
<p className="my-4"> <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? Would you like to create a new project?
</h1> </h1>
<section className="my-12"> <section className="my-12">
@ -128,7 +128,7 @@ export default function Introduction() {
return isStarterCode ? ( return isStarterCode ? (
<div className="fixed inset-0 z-50 grid place-content-center bg-chalkboard-110/50"> <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"> <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 <img
src={`/zma-logomark${getLogoTheme()}.svg`} src={`/zma-logomark${getLogoTheme()}.svg`}
alt={APP_NAME} alt={APP_NAME}
@ -156,11 +156,20 @@ export default function Introduction() {
> >
expectations for alpha users here expectations for alpha users here
</a> </a>
. Please give us feedback on your experience! We are trying to , and please give us feedback on your experience{' '}
release as early as possible to get feedback from users like you. <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> </p>
</section> </section>
<OnboardingButtons <OnboardingButtons
currentSlug={onboardingPaths.INDEX}
className="mt-6" className="mt-6"
dismiss={dismiss} dismiss={dismiss}
next={next} next={next}

View File

@ -25,7 +25,7 @@ export default function ParametricModeling() {
return ( return (
<div className="fixed grid justify-end items-center inset-0 z-50 pointer-events-none"> <div className="fixed grid justify-end items-center inset-0 z-50 pointer-events-none">
<div <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') }} style={{ clipPath: useBackdropHighlight('code-pane') }}
></div> ></div>
<div <div
@ -35,16 +35,21 @@ export default function ParametricModeling() {
} }
> >
<section className="flex-1 overflow-y-auto mb-6"> <section className="flex-1 overflow-y-auto mb-6">
<h2 className="text-2xl font-bold"> <h2 className="text-3xl font-bold">Parametric modeling with kcl</h2>
Towards true parametric modeling
</h2>
<p className="my-4"> <p className="my-4">
This example script shows how having access to the code This example script shows how a code representation of your design
representation of a part can allow us to do things that are tedious makes easy work of tedious tasks in traditional CAD software, such
or impossible in traditional CAD software. Here we are building a as calculating a safety factor.
simplified shelf bracket out of aluminum:
</p> </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 <img
src={`/onboarding-bracket${getImageTheme()}.png`} src={`/onboarding-bracket${getImageTheme()}.png`}
alt="Bracket" alt="Bracket"
@ -55,10 +60,12 @@ export default function ParametricModeling() {
</figure> </figure>
<p className="my-4"> <p className="my-4">
We are able to easily calculate the thickness of the material based 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> </p>
</section> </section>
<OnboardingButtons <OnboardingButtons
currentSlug={onboardingPaths.PARAMETRIC_MODELING}
dismiss={dismiss} dismiss={dismiss}
next={next} next={next}
nextText="Next: Interactive Numbers" nextText="Next: Interactive Numbers"

View File

@ -9,6 +9,7 @@ export default function ProjectMenu() {
})) }))
const dismiss = useDismiss() const dismiss = useDismiss()
const next = useNextClick(onboardingPaths.EXPORT) const next = useNextClick(onboardingPaths.EXPORT)
const tauri = isTauri()
return ( return (
<div className="fixed grid justify-center items-start inset-0 z-50 pointer-events-none"> <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"> <section className="flex-1">
<h2 className="text-2xl font-bold">Project Menu</h2> <h2 className="text-2xl font-bold">Project Menu</h2>
<p className="my-4"> <p className="my-4">
Click on the Zoo logo in the upper left to open the project menu. Click on your part's name in the upper left to open the project
You can only {isTauri() && 'go home or '}export your modelwhich menu.
we'll talk about next—for now. We'll add more options here soon, {tauri && (
especially as we add support for multi-file assemblies. <> You can click the Zoo logo to quickly navigate home.</>
)}
</p> </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> </section>
<OnboardingButtons <OnboardingButtons
currentSlug={onboardingPaths.PROJECT_MENU}
next={next} next={next}
dismiss={dismiss} dismiss={dismiss}
nextText="Next: Export" nextText="Next: Export"

View File

@ -39,6 +39,7 @@ export default function Sketching() {
always just modifying and generating code in Zoo Modeling App. always just modifying and generating code in Zoo Modeling App.
</p> </p>
<OnboardingButtons <OnboardingButtons
currentSlug={onboardingPaths.SKETCHING}
className="mt-6" className="mt-6"
next={next} next={next}
dismiss={dismiss} dismiss={dismiss}

View File

@ -18,18 +18,28 @@ export default function Streaming() {
} }
> >
<section className="flex-1"> <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"> <p className="my-4">
The 3D view is not running on your computer. Instead, our Historically, CAD programs run on your computer, so to run
infrastructure spins up our Geometry Engine on a remote GPU, performance-heavy apps you have to have a powerful, expensive
Modeling App sends it a series of commands via Websockets and desktop. But the 3D scene you see here is not running on your
WebRTC, and the Geometry Engine sends back a video stream of the 3D computer.
view.
</p> </p>
<p className="my-4"> <p className="my-4">
This means that you could run our Modeling App on a Chromebook, a Instead, our infrastructure spins up our Geometry Engine on a remote
tablet, or even a phone, as long as you have a good internet GPU, Modeling App sends it a series of commands{' '}
connection. <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>
<p className="my-4"> <p className="my-4">
It also means that whatever tools you build on top of our Geometry It also means that whatever tools you build on top of our Geometry
@ -38,6 +48,7 @@ export default function Streaming() {
</p> </p>
</section> </section>
<OnboardingButtons <OnboardingButtons
currentSlug={onboardingPaths.STREAMING}
dismiss={dismiss} dismiss={dismiss}
next={next} next={next}
nextText="Next: Code Editor" nextText="Next: Code Editor"

View File

@ -23,8 +23,21 @@ export default function UserMenu() {
Click your avatar on the upper right to open the user menu. You can Click your avatar on the upper right to open the user menu. You can
change your settings, sign out, or request a feature. change your settings, sign out, or request a feature.
</p> </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> </section>
<OnboardingButtons <OnboardingButtons
currentSlug={onboardingPaths.USER_MENU}
dismiss={dismiss} dismiss={dismiss}
next={next} next={next}
nextText="Next: Project Menu" nextText="Next: Project Menu"

View File

@ -21,6 +21,8 @@ import { ActionButton } from 'components/ActionButton'
import { onboardingPaths } from 'routes/Onboarding/paths' import { onboardingPaths } from 'routes/Onboarding/paths'
export const ONBOARDING_PROJECT_NAME = 'Tutorial Project $nn' 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 = [ export const onboardingRoutes = [
{ {
@ -106,20 +108,40 @@ export function useDismiss() {
}, [send, navigate, filePath]) }, [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({ export function OnboardingButtons({
next, next,
nextText, nextText,
dismiss, dismiss,
currentSlug,
className, className,
...props ...props
}: { }: {
next: () => void next: () => void
nextText?: string nextText?: string
dismiss: () => void dismiss: () => void
currentSlug?: (typeof onboardingPaths)[keyof typeof onboardingPaths]
className?: string className?: string
} & React.HTMLAttributes<HTMLDivElement>) { } & React.HTMLAttributes<HTMLDivElement>) {
const stepNumber = useStepNumber(currentSlug)
return ( return (
<div className={'flex justify-between ' + (className ?? '')} {...props}> <div
className={'flex items-center justify-between ' + (className ?? '')}
{...props}
>
<ActionButton <ActionButton
Element="button" Element="button"
onClick={dismiss} onClick={dismiss}
@ -132,6 +154,11 @@ export function OnboardingButtons({
> >
Dismiss Dismiss
</ActionButton> </ActionButton>
{stepNumber !== undefined && (
<p className="font-mono text-xs text-center m-0">
{stepNumber} / {onboardingRoutes.length}
</p>
)}
<ActionButton <ActionButton
Element="button" Element="button"
onClick={next} onClick={next}

View File

@ -12,4 +12,4 @@ export const onboardingPaths = {
MOVE: '/move', MOVE: '/move',
SKETCHING: '/sketching', SKETCHING: '/sketching',
FUTURE_WORK: '/future-work', FUTURE_WORK: '/future-work',
} } as const

View File

@ -328,6 +328,7 @@ interface SettingsSectionProps extends React.PropsWithChildren {
title: string title: string
description?: string description?: string
className?: string className?: string
headingClassName?: string
} }
export function SettingsSection({ export function SettingsSection({
@ -335,6 +336,7 @@ export function SettingsSection({
description, description,
className, className,
children, children,
headingClassName = 'text-2xl font-bold',
}: SettingsSectionProps) { }: SettingsSectionProps) {
return ( return (
<section <section
@ -344,7 +346,7 @@ export function SettingsSection({
} }
> >
<div className="w-80"> <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> <p className="mt-2 text-sm">{description}</p>
</div> </div>
<div>{children}</div> <div>{children}</div>

View File

@ -155,9 +155,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.79" version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1"
dependencies = [ dependencies = [
"backtrace", "backtrace",
] ]
@ -574,9 +574,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.1" version = "4.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" checksum = "b230ab84b0ffdf890d5a10abdbc8b83ae1c4918275daea1ab8801f71536b2651"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@ -584,9 +584,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.1" version = "4.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -937,7 +937,7 @@ dependencies = [
[[package]] [[package]]
name = "derive-docs" name = "derive-docs"
version = "0.1.8" version = "0.1.9"
dependencies = [ dependencies = [
"convert_case", "convert_case",
"expectorate", "expectorate",
@ -954,9 +954,9 @@ dependencies = [
[[package]] [[package]]
name = "derive-docs" name = "derive-docs"
version = "0.1.8" version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d58c9464a20d3ece3260838ad7c2f504c925a852cfdad13f0ea2e9e4bb8a859" checksum = "b81bc4c6288273218d0bb4f2ee7cda229264f2e8381e53aae250c840946171f9"
dependencies = [ dependencies = [
"convert_case", "convert_case",
"once_cell", "once_cell",
@ -1782,9 +1782,9 @@ dependencies = [
[[package]] [[package]]
name = "insta" name = "insta"
version = "1.34.0" version = "1.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d64600be34b2fcfc267740a243fa7744441bb4947a619ac4e5bb6507f35fbfc" checksum = "0a7c22c4d34ef4788c351e971c52bfdfe7ea2766f8c5466bc175dd46e52ac22e"
dependencies = [ dependencies = [
"console", "console",
"lazy_static", "lazy_static",
@ -1897,7 +1897,7 @@ dependencies = [
[[package]] [[package]]
name = "kcl-lib" name = "kcl-lib"
version = "0.1.42" version = "0.1.44"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"approx 0.5.1", "approx 0.5.1",
@ -1908,7 +1908,7 @@ dependencies = [
"criterion", "criterion",
"dashmap", "dashmap",
"databake", "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", "expectorate",
"futures", "futures",
"gltf-json", "gltf-json",
@ -1990,7 +1990,7 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-execution-plan" name = "kittycad-execution-plan"
version = "0.1.0" 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 = [ dependencies = [
"bytes", "bytes",
"insta", "insta",
@ -2010,7 +2010,7 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-execution-plan-macros" name = "kittycad-execution-plan-macros"
version = "0.1.8" 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 = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2020,7 +2020,7 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-execution-plan-traits" name = "kittycad-execution-plan-traits"
version = "0.1.12" 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 = [ dependencies = [
"serde", "serde",
"thiserror", "thiserror",
@ -2030,7 +2030,7 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-modeling-cmds" name = "kittycad-modeling-cmds"
version = "0.1.28" 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 = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
@ -2058,7 +2058,7 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-modeling-cmds-macros" name = "kittycad-modeling-cmds-macros"
version = "0.1.2" 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 = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2068,7 +2068,7 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-modeling-session" name = "kittycad-modeling-session"
version = "0.1.0" 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 = [ dependencies = [
"futures", "futures",
"kittycad", "kittycad",
@ -3581,9 +3581,9 @@ checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.196" version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
@ -3599,9 +3599,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.196" version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -4823,9 +4823,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-futures" name = "wasm-bindgen-futures"
version = "0.4.41" version = "0.4.42"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"futures-core", "futures-core",
@ -4918,9 +4918,9 @@ dependencies = [
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.68" version = "0.3.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",

View File

@ -17,7 +17,7 @@ kittycad = { workspace = true }
serde_json = "1.0.114" serde_json = "1.0.114"
uuid = { version = "1.7.0", features = ["v4", "js", "serde"] } uuid = { version = "1.7.0", features = ["v4", "js", "serde"] }
wasm-bindgen = "0.2.91" wasm-bindgen = "0.2.91"
wasm-bindgen-futures = "0.4.41" wasm-bindgen-futures = "0.4.42"
[dev-dependencies] [dev-dependencies]
anyhow = "1" anyhow = "1"
@ -37,7 +37,7 @@ wasm-bindgen-futures = { version = "0.4.41", features = ["futures-core-03-stream
wasm-streams = "0.4.0" wasm-streams = "0.4.0"
[target.'cfg(target_arch = "wasm32")'.dependencies.web-sys] [target.'cfg(target_arch = "wasm32")'.dependencies.web-sys]
version = "0.3.68" version = "0.3.69"
features = [ features = [
"console", "console",
"HtmlTextAreaElement", "HtmlTextAreaElement",

View File

@ -1,7 +1,7 @@
[package] [package]
name = "derive-docs" name = "derive-docs"
description = "A tool for generating documentation from Rust derive macros" description = "A tool for generating documentation from Rust derive macros"
version = "0.1.8" version = "0.1.9"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
repository = "https://github.com/KittyCAD/modeling-app" repository = "https://github.com/KittyCAD/modeling-app"
@ -17,7 +17,7 @@ once_cell = "1.19.0"
proc-macro2 = "1" proc-macro2 = "1"
quote = "1" quote = "1"
regex = "1.10" regex = "1.10"
serde = { version = "1.0.193", features = ["derive"] } serde = { version = "1.0.197", features = ["derive"] }
serde_tokenstream = "0.2" serde_tokenstream = "0.2"
syn = { version = "2.0.52", features = ["full"] } syn = { version = "2.0.52", features = ["full"] }

View File

@ -197,6 +197,7 @@ fn do_stdlib_inner(
let (ty_string, ty_ident) = clean_ty_string(ty.to_string().as_str()); let (ty_string, ty_ident) = clean_ty_string(ty.to_string().as_str());
let ty_string = rust_type_to_openapi_type(&ty_string); let ty_string = rust_type_to_openapi_type(&ty_string);
let required = !ty_ident.to_string().starts_with("Option <");
if ty_string != "Args" { if ty_string != "Args" {
let schema = if ty_ident.to_string().starts_with("Vec < ") let schema = if ty_ident.to_string().starts_with("Vec < ")
@ -216,7 +217,7 @@ fn do_stdlib_inner(
name: #arg_name.to_string(), name: #arg_name.to_string(),
type_: #ty_string.to_string(), type_: #ty_string.to_string(),
schema: #schema, schema: #schema,
required: true, required: #required,
} }
}); });
} }

View File

@ -44,7 +44,7 @@ impl crate::docs::StdLibFn for Show {
name: "args".to_string(), name: "args".to_string(),
type_: "number".to_string(), type_: "number".to_string(),
schema: <Option<f64>>::json_schema(&mut generator), schema: <Option<f64>>::json_schema(&mut generator),
required: true, required: false,
}] }]
} }

View File

@ -44,7 +44,7 @@ impl crate::docs::StdLibFn for Import {
name: "args".to_string(), name: "args".to_string(),
type_: "kittycad::types::InputFormat".to_string(), type_: "kittycad::types::InputFormat".to_string(),
schema: <Option<kittycad::types::InputFormat>>::json_schema(&mut generator), schema: <Option<kittycad::types::InputFormat>>::json_schema(&mut generator),
required: true, required: false,
}] }]
} }

View File

@ -1,7 +1,7 @@
[package] [package]
name = "kcl-lib" name = "kcl-lib"
description = "KittyCAD Language implementation and tools" description = "KittyCAD Language implementation and tools"
version = "0.1.42" version = "0.1.44"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
repository = "https://github.com/KittyCAD/modeling-app" 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 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
anyhow = { version = "1.0.79", features = ["backtrace"] } anyhow = { version = "1.0.80", features = ["backtrace"] }
async-recursion = "1.0.5" async-recursion = "1.0.5"
async-trait = "0.1.77" 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" dashmap = "5.5.3"
databake = { version = "0.1.7", features = ["derive"] } databake = { version = "0.1.7", features = ["derive"] }
derive-docs = { version = "0.1.8" } derive-docs = { version = "0.1.9" }
#derive-docs = { path = "../derive-docs" } #derive-docs = { path = "../derive-docs" }
futures = { version = "0.3.30" } futures = { version = "0.3.30" }
gltf-json = "1.4.0" 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"] } reqwest = { version = "0.11.24", default-features = false, features = ["stream", "rustls-tls"] }
ropey = "1.6.1" ropey = "1.6.1"
schemars = { version = "0.8.16", features = ["impl_json_schema", "url", "uuid1"] } 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" serde_json = "1.0.114"
thiserror = "1.0.57" thiserror = "1.0.57"
ts-rs = { version = "7.1.1", features = ["uuid-impl"] } ts-rs = { version = "7.1.1", features = ["uuid-impl"] }
@ -40,8 +40,8 @@ winnow = "0.5.40"
js-sys = { version = "0.3.69" } js-sys = { version = "0.3.69" }
tower-lsp = { version = "0.20.0", default-features = false, features = ["runtime-agnostic"] } tower-lsp = { version = "0.20.0", default-features = false, features = ["runtime-agnostic"] }
wasm-bindgen = "0.2.91" wasm-bindgen = "0.2.91"
wasm-bindgen-futures = "0.4.41" wasm-bindgen-futures = "0.4.42"
web-sys = { version = "0.3.68", features = ["console"] } web-sys = { version = "0.3.69", features = ["console"] }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
approx = "0.5" approx = "0.5"
@ -65,7 +65,7 @@ debug = true # Flamegraphs of benchmarks require accurate debug symbols
[dev-dependencies] [dev-dependencies]
criterion = "0.5.1" criterion = "0.5.1"
expectorate = "1.1.0" expectorate = "1.1.0"
insta = { version = "1.34.0", features = ["json"] } insta = { version = "1.36.1", features = ["json"] }
itertools = "0.12.1" itertools = "0.12.1"
pretty_assertions = "1.4.0" pretty_assertions = "1.4.0"
tokio = { version = "1.36.0", features = ["rt-multi-thread", "macros", "time"] } tokio = { version = "1.36.0", features = ["rt-multi-thread", "macros", "time"] }

View File

@ -1084,11 +1084,17 @@ impl CallExpression {
} }
FunctionKind::Std(func) => { FunctionKind::Std(func) => {
let function_expression = func.function(); 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 { return Err(KclError::Semantic(KclErrorDetails {
message: format!( message: format!(
"this function expected {} arguments, got {}", "this function expected {} arguments, got {}",
function_expression.params.len(), parts.params_required.len(),
fn_args.len(), fn_args.len(),
), ),
source_ranges: vec![self.into()], source_ranges: vec![self.into()],
@ -1097,13 +1103,28 @@ impl CallExpression {
// Add the arguments to the memory. // Add the arguments to the memory.
let mut fn_memory = memory.clone(); 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( fn_memory.add(
&param.identifier.name, &param.identifier.name,
fn_args.get(index).unwrap().clone(), fn_args.get(index).unwrap().clone(),
param.identifier.clone().into(), 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(&param.identifier.name, arg.clone(), param.identifier.clone().into())?;
} else {
fn_memory.add(
&param.identifier.name,
MemoryItem::UserVal(UserVal {
value: serde_json::value::Value::Null,
meta: Default::default(),
}),
param.identifier.clone().into(),
)?;
}
}
// Call the stdlib function // Call the stdlib function
let p = func.function().clone().body; let p = func.function().clone().body;

View File

@ -132,7 +132,11 @@ pub trait StdLibFn: std::fmt::Debug + Send + Sync {
if i > 0 { if i > 0 {
signature.push_str(", "); signature.push_str(", ");
} }
signature.push_str(&format!("{}: {}", arg.name, arg.type_)); if arg.required {
signature.push_str(&format!("{}: {}", arg.name, arg.type_));
} else {
signature.push_str(&format!("{}?: {}", arg.name, arg.type_));
}
} }
signature.push(')'); signature.push(')');
if let Some(return_value) = self.return_value() { if let Some(return_value) = self.return_value() {

View File

@ -4,18 +4,18 @@ expression: actual
--- ---
{ {
"start": 0, "start": 0,
"end": 59, "end": 87,
"body": [ "body": [
{ {
"type": "VariableDeclaration", "type": "VariableDeclaration",
"type": "VariableDeclaration", "type": "VariableDeclaration",
"start": 0, "start": 0,
"end": 58, "end": 86,
"declarations": [ "declarations": [
{ {
"type": "VariableDeclarator", "type": "VariableDeclarator",
"start": 6, "start": 6,
"end": 58, "end": 86,
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 6, "start": 6,
@ -26,59 +26,27 @@ expression: actual
"type": "PipeExpression", "type": "PipeExpression",
"type": "PipeExpression", "type": "PipeExpression",
"start": 17, "start": 17,
"end": 58, "end": 86,
"body": [ "body": [
{ {
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression", "type": "CallExpression",
"start": 17, "start": 17,
"end": 40, "end": 36,
"callee": { "callee": {
"type": "Identifier", "type": "Identifier",
"start": 17, "start": 17,
"end": 23, "end": 30,
"name": "circle" "name": "startSketchOn"
}, },
"arguments": [ "arguments": [
{ {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"start": 24, "start": 31,
"end": 28, "end": 35,
"value": "XY", "value": "XY",
"raw": "'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 "optional": false
@ -87,27 +55,80 @@ expression: actual
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression", "type": "CallExpression",
"start": 44, "start": 44,
"end": 58, "end": 64,
"callee": { "callee": {
"type": "Identifier", "type": "Identifier",
"start": 44, "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" "name": "extrude"
}, },
"arguments": [ "arguments": [
{ {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"start": 52, "start": 80,
"end": 54, "end": 82,
"value": 14, "value": 14,
"raw": "14" "raw": "14"
}, },
{ {
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution", "type": "PipeSubstitution",
"start": 56, "start": 84,
"end": 57 "end": 85
} }
], ],
"optional": false "optional": false

View File

@ -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>( fn get_data_and_optional_tag<T: serde::de::DeserializeOwned>(
&self, &self,
) -> Result<(T, Option<SketchOnFaceTag>), KclError> { ) -> Result<(T, Option<SketchOnFaceTag>), KclError> {
@ -881,10 +911,14 @@ mod tests {
fn_docs.push_str("#### Arguments\n\n"); fn_docs.push_str("#### Arguments\n\n");
for arg in internal_fn.args() { for arg in internal_fn.args() {
let (format, should_be_indented) = arg.get_type_string().unwrap(); 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() { 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 { } 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 { if should_be_indented {

View File

@ -8,13 +8,13 @@ use crate::{
}; };
pub const CIRCLE_FN: &str = r#" pub const CIRCLE_FN: &str = r#"
(plane, center, radius) => { (center, radius, surface, tag?) => {
const sg = startSketchOn(plane) const sg = startProfileAt([center[0] + radius, center[1]], surface)
|> startProfileAt([center[0] + radius, center[1]], %)
|> arc({ |> arc({
angle_end: 360, angle_end: 360,
angle_start: 0, angle_start: 0,
radius: radius radius: radius,
tag: tag
}, %) }, %)
|> close(%) |> close(%)
return sg return sg
@ -70,14 +70,6 @@ impl StdLibFn for Circle {
let mut args = Vec::new(); let mut args = Vec::new();
for parameter in &self.function.params { for parameter in &self.function.params {
match parameter.identifier.name.as_str() { 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" => { "center" => {
args.push(crate::docs::StdLibFnArg { args.push(crate::docs::StdLibFnArg {
name: parameter.identifier.name.to_owned(), name: parameter.identifier.name.to_owned(),
@ -94,6 +86,22 @@ impl StdLibFn for Circle {
required: true, 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), _ => panic!("Unknown parameter: {:?}", parameter.identifier.name),
} }
} }

View File

@ -1073,9 +1073,9 @@ async fn inner_start_profile_at(
/// Close the current sketch. /// Close the current sketch.
pub async fn close(args: Args) -> Result<MemoryItem, KclError> { 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)) Ok(MemoryItem::SketchGroup(new_sketch_group))
} }
@ -1084,7 +1084,11 @@ pub async fn close(args: Args) -> Result<MemoryItem, KclError> {
#[stdlib { #[stdlib {
name = "close", 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 from = sketch_group.get_coords_from_paths()?;
let to: Point2d = sketch_group.start.from.into(); 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 { base: BasePath {
from: from.into(), from: from.into(),
to: to.into(), to: to.into(),
// TODO: should we use a different name? name: tag.unwrap_or_default(),
name: "".into(),
geo_meta: GeoMeta { geo_meta: GeoMeta {
id, id,
metadata: args.source_range.into(), metadata: args.source_range.into(),
@ -1127,18 +1130,7 @@ async fn inner_close(sketch_group: Box<SketchGroup>, args: Args) -> Result<Box<S
#[ts(export)] #[ts(export)]
#[serde(rename_all = "camelCase", untagged)] #[serde(rename_all = "camelCase", untagged)]
pub enum ArcData { pub enum ArcData {
/// Angles and radius with a tag. /// Angles and radius with an optional 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.
AnglesAndRadius { AnglesAndRadius {
/// The start angle. /// The start angle.
angle_start: f64, angle_start: f64,
@ -1146,19 +1138,11 @@ pub enum ArcData {
angle_end: f64, angle_end: f64,
/// The radius. /// The radius.
radius: f64, 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. /// The tag.
tag: String, #[serde(default)]
tag: Option<String>,
}, },
/// Center, to and radius. /// Center, to and radius with an optional tag.
CenterToRadius { CenterToRadius {
/// The center. /// The center.
center: [f64; 2], center: [f64; 2],
@ -1166,6 +1150,9 @@ pub enum ArcData {
to: [f64; 2], to: [f64; 2],
/// The radius. /// The radius.
radius: f64, 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 from: Point2d = sketch_group.get_coords_from_paths()?;
let (center, angle_start, angle_end, radius, end) = match &data { let (center, angle_start, angle_end, radius, end) = match &data {
ArcData::AnglesAndRadiusWithTag { ArcData::AnglesAndRadius {
angle_start, angle_start,
angle_end, angle_end,
radius, 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); let (center, end) = arc_center_and_end(from, a_start, a_end, *radius);
(center, a_start, a_end, *radius, end) (center, a_start, a_end, *radius, end)
} }
ArcData::AnglesAndRadius { ArcData::CenterToRadius { center, to, radius, .. } => {
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 } => {
let (angle_start, angle_end) = arc_angles(from, center.into(), to.into(), *radius, args.source_range)?; 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()) (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(), from: from.into(),
to: end.into(), to: end.into(),
name: match data { name: match data {
ArcData::AnglesAndRadiusWithTag { tag, .. } => tag.to_string(), ArcData::AnglesAndRadius { tag, .. } => tag.unwrap_or_default().to_string(),
ArcData::AnglesAndRadius { .. } => "".to_string(), ArcData::CenterToRadius { tag, .. } => tag.unwrap_or_default().to_string(),
ArcData::CenterToRadiusWithTag { tag, .. } => tag.to_string(),
ArcData::CenterToRadius { .. } => "".to_string(),
}, },
geo_meta: GeoMeta { geo_meta: GeoMeta {
id, id,
@ -1453,28 +1424,16 @@ async fn inner_tangential_arc_to(
/// Data to draw a bezier curve. /// Data to draw a bezier curve.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)] #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
#[ts(export)] #[ts(export)]
#[serde(rename_all = "camelCase", untagged)] #[serde(rename_all = "camelCase")]
pub enum BezierData { pub struct BezierData {
/// Points with a tag. /// The to point.
PointsWithTag { to: [f64; 2],
/// The to point. /// The first control point.
to: [f64; 2], control1: [f64; 2],
/// The first control point. /// The second control point.
control1: [f64; 2], control2: [f64; 2],
/// The second control point. /// The tag.
control2: [f64; 2], tag: Option<String>,
/// 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],
},
} }
/// Draw a bezier curve. /// Draw a bezier curve.
@ -1496,16 +1455,9 @@ async fn inner_bezier_curve(
) -> Result<Box<SketchGroup>, KclError> { ) -> Result<Box<SketchGroup>, KclError> {
let from = sketch_group.get_coords_from_paths()?; 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 relative = true;
let delta = to; let delta = data.to;
let to = [from.x + to[0], from.y + to[1]]; let to = [from.x + data.to[0], from.y + data.to[1]];
let id = uuid::Uuid::new_v4(); let id = uuid::Uuid::new_v4();
@ -1515,13 +1467,13 @@ async fn inner_bezier_curve(
path: sketch_group.id, path: sketch_group.id,
segment: kittycad::types::PathSegment::Bezier { segment: kittycad::types::PathSegment::Bezier {
control1: Point3D { control1: Point3D {
x: control1[0], x: data.control1[0],
y: control1[1], y: data.control1[1],
z: 0.0, z: 0.0,
}, },
control2: Point3D { control2: Point3D {
x: control2[0], x: data.control2[0],
y: control2[1], y: data.control2[1],
z: 0.0, z: 0.0,
}, },
end: Point3D { end: Point3D {
@ -1539,11 +1491,7 @@ async fn inner_bezier_curve(
base: BasePath { base: BasePath {
from: from.into(), from: from.into(),
to, to,
name: if let BezierData::PointsWithTag { tag, .. } = data { name: data.tag.unwrap_or_default().to_string(),
tag.to_string()
} else {
"".to_string()
},
geo_meta: GeoMeta { geo_meta: GeoMeta {
id, id,
metadata: args.source_range.into(), metadata: args.source_range.into(),

View File

@ -1 +1,3 @@
const cylinder = circle('XY', [0,0], 22) |> extrude(14, %) const cylinder = startSketchOn('XY')
|> circle([0,0], 22, %)
|> extrude(14, %)

View File

@ -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); 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")] #[tokio::test(flavor = "multi_thread")]
async fn serial_test_basic_fillet_cube_next_adjacent() { async fn serial_test_basic_fillet_cube_next_adjacent() {
let code = r#"const part001 = startSketchOn('XY') let code = r#"const part001 = startSketchOn('XY')
@ -709,8 +732,8 @@ async fn serial_test_holes() {
|> line([10, 0], %) |> line([10, 0], %)
|> line([0, -10], %) |> line([0, -10], %)
|> close(%) |> close(%)
|> hole(circle('XY', [2, 2], .5), %) |> hole(circle([2, 2], .5, startSketchOn('XY')), %)
|> hole(circle('XY', [2, 8], .5), %) |> hole(circle([2, 8], .5, startSketchOn('XY')), %)
|> extrude(2, %) |> extrude(2, %)
"#; "#;
@ -765,10 +788,10 @@ const holeRadius = 1
const holeIndex = 6 const holeIndex = 6
const part = roundedRectangle([0, 0], 20, 20, 4) const part = roundedRectangle([0, 0], 20, 20, 4)
|> hole(circle('XY', [-holeIndex, holeIndex], holeRadius), %) |> hole(circle([-holeIndex, holeIndex], holeRadius, startSketchOn('XY')), %)
|> hole(circle('XY', [holeIndex, holeIndex], holeRadius), %) |> hole(circle([holeIndex, holeIndex], holeRadius, startSketchOn('XY')), %)
|> hole(circle('XY', [-holeIndex, -holeIndex], holeRadius), %) |> hole(circle([-holeIndex, -holeIndex], holeRadius, startSketchOn('XY')), %)
|> hole(circle('XY', [holeIndex, -holeIndex], holeRadius), %) |> hole(circle([holeIndex, -holeIndex], holeRadius, startSketchOn('XY')), %)
|> extrude(2, %) |> extrude(2, %)
"#; "#;
@ -780,7 +803,7 @@ const part = roundedRectangle([0, 0], 20, 20, 4)
#[tokio::test(flavor = "multi_thread")] #[tokio::test(flavor = "multi_thread")]
async fn serial_test_top_level_expression() { 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) let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm)
.await .await
@ -790,7 +813,8 @@ async fn serial_test_top_level_expression() {
#[tokio::test(flavor = "multi_thread")] #[tokio::test(flavor = "multi_thread")]
async fn serial_test_patterns_linear_basic() { 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}, %) |> 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")] #[tokio::test(flavor = "multi_thread")]
async fn serial_test_patterns_linear_basic_negative_distance() { 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}, %) |> 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")] #[tokio::test(flavor = "multi_thread")]
async fn serial_test_patterns_linear_basic_negative_axis() { 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}, %) |> 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")] #[tokio::test(flavor = "multi_thread")]
async fn serial_test_patterns_linear_basic_holes() { 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}, %) |> patternLinear({axis: [1,1], repetitions: 12, distance: 3}, %)
const rectangle = startSketchOn('XY') const rectangle = startSketchOn('XY')
@ -873,7 +900,8 @@ const rectangle = startSketchOn('XY')
#[tokio::test(flavor = "multi_thread")] #[tokio::test(flavor = "multi_thread")]
async fn serial_test_patterns_circular_basic_2d() { 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}, %) |> 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], %) |> line([0, -10], %)
|> close(%) |> close(%)
|> hole(circle([2, 2], .5), %) |> hole(circle([2, 2], .5), %)
|> hole(circle('XY', [2, 8], .5), %) |> hole(circle([2, 8], .5, startSketchOn('XY')), %)
|> extrude(2, %) |> 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" }"# 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);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB