Compare commits

..

5 Commits

35 changed files with 169 additions and 170 deletions

2
.gitignore vendored
View File

@ -24,7 +24,7 @@ yarn-debug.log*
yarn-error.log*
.idea
.vscode
# .vscode
.helix
src/wasm-lib/.idea
src/wasm-lib/.vscode

5
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"rust-analyzer.linkedProjects": [
"src/wasm-lib/Cargo.toml"
]
}

View File

@ -9,7 +9,7 @@ Set the appearance of a solid. This only works on solids, not sketches or indivi
This will work on any solid, including extruded solids, revolved solids, and shelled solids.
```js
appearance(solid_set: SolidSet, color: String, metalness?: number, roughness?: number) -> SolidSet
appearance(solidSet: SolidSet, color: String, metalness?: number, roughness?: number) -> SolidSet
```
@ -17,7 +17,7 @@ appearance(solid_set: SolidSet, color: String, metalness?: number, roughness?: n
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `solid_set` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) whose appearance is being set | Yes |
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) whose appearance is being set | Yes |
| `color` | `String` | Color of the new material, a hex string like '#ff0000' | Yes |
| `metalness` | `number` | Metalness of the new material, a percentage like 95.7. | No |
| `roughness` | `number` | Roughness of the new material, a percentage like 95.7. | No |

View File

@ -9,7 +9,7 @@ Construct a 2-dimensional circle, of the specified radius, centered at
the provided (x, y) origin point.
```js
circle(data: CircleData, sketch_surface_or_group: SketchOrSurface, tag?: TagDeclarator) -> Sketch
circle(data: CircleData, sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDeclarator) -> Sketch
```
@ -18,7 +18,7 @@ circle(data: CircleData, sketch_surface_or_group: SketchOrSurface, tag?: TagDecl
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `data` | [`CircleData`](/docs/kcl/types/CircleData) | Data for drawing an circle | Yes |
| `sketch_surface_or_group` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns

View File

@ -9,7 +9,7 @@ Construct a circle derived from 3 points.
```js
circleThreePoint(p1: [number], p2: [number], p3: [number], sketch_surface_or_group: SketchOrSurface, tag?: TagDeclarator) -> Sketch
circleThreePoint(p1: [number], p2: [number], p3: [number], sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDeclarator) -> Sketch
```
@ -20,7 +20,7 @@ circleThreePoint(p1: [number], p2: [number], p3: [number], sketch_surface_or_gro
| `p1` | `[number]` | 1st point to derive the circle. | Yes |
| `p2` | `[number]` | 2nd point to derive the circle. | Yes |
| `p3` | `[number]` | 3rd point to derive the circle. | Yes |
| `sketch_surface_or_group` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes |
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Identifier for the circle to reference elsewhere. | No |
### Returns

View File

@ -9,7 +9,7 @@ Extend a 2-dimensional sketch through a third dimension in order to
create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid.
```js
extrude(sketch_set: SketchSet, length: number) -> SolidSet
extrude(sketchSet: SketchSet, length: number) -> SolidSet
```
@ -17,7 +17,7 @@ extrude(sketch_set: SketchSet, length: number) -> SolidSet
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch_set` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketches should be extruded | Yes |
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketches should be extruded | Yes |
| `length` | `number` | How far to extrude the given sketches | Yes |
### Returns

View File

@ -9,7 +9,7 @@ Create a helix.
```js
helix(revolutions: number, angle_start: number, ccw?: bool, radius: number, axis: Axis3dOrEdgeReference, length?: number) -> HelixValue
helix(revolutions: number, angleStart: number, ccw?: bool, radius: number, axis: Axis3dOrEdgeReference, length?: number) -> HelixValue
```
@ -18,7 +18,7 @@ helix(revolutions: number, angle_start: number, ccw?: bool, radius: number, axis
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `revolutions` | `number` | Number of revolutions. | Yes |
| `angle_start` | `number` | Start angle (in degrees). | Yes |
| `angleStart` | `number` | Start angle (in degrees). | Yes |
| `ccw` | `bool` | Is the helix rotation counter clockwise? The default is `false`. | No |
| `radius` | `number` | Radius of the helix. | Yes |
| `axis` | [`Axis3dOrEdgeReference`](/docs/kcl/types/Axis3dOrEdgeReference) | Axis to use for the helix. | Yes |

View File

@ -9,7 +9,7 @@ Use a 2-dimensional sketch to cut a hole in another 2-dimensional sketch.
```js
hole(hole_sketch: SketchSet, sketch: Sketch) -> Sketch
hole(holeSketch: SketchSet, sketch: Sketch) -> Sketch
```
@ -17,7 +17,7 @@ hole(hole_sketch: SketchSet, sketch: Sketch) -> Sketch
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `hole_sketch` | [`SketchSet`](/docs/kcl/types/SketchSet) | A sketch or a group of sketches. | Yes |
| `holeSketch` | [`SketchSet`](/docs/kcl/types/SketchSet) | A sketch or a group of sketches. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
### Returns

View File

@ -15,7 +15,7 @@ For formats lacking unit data (such as STL, OBJ, or PLY files), the default unit
Note: The import command currently only works when using the native Modeling App.
```js
import(file_path: String, options?: ImportFormat) -> ImportedGeometry
import(filePath: String, options?: ImportFormat) -> ImportedGeometry
```
@ -23,7 +23,7 @@ import(file_path: String, options?: ImportFormat) -> ImportedGeometry
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `file_path` | `String` | | Yes |
| `filePath` | `String` | | Yes |
| `options` | [`ImportFormat`](/docs/kcl/types/ImportFormat) | Import format specifier | No |
### Returns

View File

@ -9,7 +9,7 @@ Extend the current sketch with a new straight line.
```js
line(sketch: Sketch, end_absolute?: [number], end?: [number], tag?: TagDeclarator) -> Sketch
line(sketch: Sketch, endAbsolute?: [number], end?: [number], tag?: TagDeclarator) -> Sketch
```
@ -18,7 +18,7 @@ line(sketch: Sketch, end_absolute?: [number], end?: [number], tag?: TagDeclarato
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `end_absolute` | `[number]` | Which absolute point should this line go to? Incompatible with `end`. | No |
| `endAbsolute` | `[number]` | Which absolute point should this line go to? Incompatible with `end`. | No |
| `end` | `[number]` | How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`. | No |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |

View File

@ -9,7 +9,7 @@ Create a 3D surface or solid by interpolating between two or more sketches.
The sketches need to closed and on the same plane.
```js
loft(sketches: [Sketch], v_degree: NonZeroU32, bez_approximate_rational: bool, base_curve_index?: integer, tolerance?: number) -> Solid
loft(sketches: [Sketch], vDegree: NonZeroU32, bezApproximateRational: bool, baseCurveIndex?: integer, tolerance?: number) -> Solid
```
@ -18,9 +18,9 @@ loft(sketches: [Sketch], v_degree: NonZeroU32, bez_approximate_rational: bool, b
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | Which sketches to loft. Must include at least 2 sketches. | Yes |
| `v_degree` | `NonZeroU32` | Degree of the interpolation. Must be greater than zero. For example, use 2 for quadratic, or 3 for cubic interpolation in the V direction. This defaults to 2, if not specified. | Yes |
| `bez_approximate_rational` | `bool` | Attempt to approximate rational curves (such as arcs) using a bezier. This will remove banding around interpolations between arcs and non-arcs. It may produce errors in other scenarios Over time, this field won't be necessary. | Yes |
| `base_curve_index` | `integer` | This can be set to override the automatically determined topological base curve, which is usually the first section encountered. | No |
| `vDegree` | `NonZeroU32` | Degree of the interpolation. Must be greater than zero. For example, use 2 for quadratic, or 3 for cubic interpolation in the V direction. This defaults to 2, if not specified. | Yes |
| `bezApproximateRational` | `bool` | Attempt to approximate rational curves (such as arcs) using a bezier. This will remove banding around interpolations between arcs and non-arcs. It may produce errors in other scenarios Over time, this field won't be necessary. | Yes |
| `baseCurveIndex` | `integer` | This can be set to override the automatically determined topological base curve, which is usually the first section encountered. | No |
| `tolerance` | `number` | Tolerance for the loft operation. | No |
### Returns

View File

@ -9,7 +9,7 @@ Apply a function to every element of a list.
Given a list like `[a, b, c]`, and a function like `f`, returns `[f(a), f(b), f(c)]`
```js
map(array: [KclValue], map_fn: FunctionSource) -> [KclValue]
map(array: [KclValue], mapFn: FunctionSource) -> [KclValue]
```
@ -18,7 +18,7 @@ map(array: [KclValue], map_fn: FunctionSource) -> [KclValue]
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | | Yes |
| `map_fn` | `FunctionSource` | | Yes |
| `mapFn` | `FunctionSource` | | Yes |
### Returns

View File

@ -11,7 +11,7 @@ Only works on unclosed sketches for now.
Mirror occurs around a local sketch axis rather than a global axis.
```js
mirror2d(data: Mirror2dData, sketch_set: SketchSet) -> [Sketch]
mirror2d(data: Mirror2dData, sketchSet: SketchSet) -> [Sketch]
```
@ -20,7 +20,7 @@ mirror2d(data: Mirror2dData, sketch_set: SketchSet) -> [Sketch]
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `data` | [`Mirror2dData`](/docs/kcl/types/Mirror2dData) | Data for a mirror. | Yes |
| `sketch_set` | [`SketchSet`](/docs/kcl/types/SketchSet) | A sketch or a group of sketches. | Yes |
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | A sketch or a group of sketches. | Yes |
### Returns

View File

@ -9,7 +9,7 @@ Repeat a 2-dimensional sketch some number of times along a partial or
complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orentation of the solid with respect to the center of the circle is maintained.
```js
patternCircular2d(sketch_set: SketchSet, instances: integer, center: [number], arc_degrees: number, rotate_duplicates: bool, use_original?: bool) -> [Sketch]
patternCircular2d(sketchSet: SketchSet, instances: integer, center: [number], arcDegrees: number, rotateDuplicates: bool, useOriginal?: bool) -> [Sketch]
```
@ -17,12 +17,12 @@ patternCircular2d(sketch_set: SketchSet, instances: integer, center: [number], a
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch_set` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketch(es) to pattern | Yes |
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketch(es) to pattern | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `center` | `[number]` | The center about which to make the pattern. This is a 2D vector. | Yes |
| `arc_degrees` | `number` | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
| `rotate_duplicates` | `bool` | Whether or not to rotate the duplicates as they are copied. | Yes |
| `use_original` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
| `arcDegrees` | `number` | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
| `rotateDuplicates` | `bool` | Whether or not to rotate the duplicates as they are copied. | Yes |
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns

View File

@ -9,7 +9,7 @@ Repeat a 3-dimensional solid some number of times along a partial or
complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orentation of the solid with respect to the center of the circle is maintained.
```js
patternCircular3d(solid_set: SolidSet, instances: integer, axis: [number], center: [number], arc_degrees: number, rotate_duplicates: bool, use_original?: bool) -> [Solid]
patternCircular3d(solidSet: SolidSet, instances: integer, axis: [number], center: [number], arcDegrees: number, rotateDuplicates: bool, useOriginal?: bool) -> [Solid]
```
@ -17,13 +17,13 @@ patternCircular3d(solid_set: SolidSet, instances: integer, axis: [number], cente
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `solid_set` | [`SolidSet`](/docs/kcl/types/SolidSet) | Which solid(s) to pattern | Yes |
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | Which solid(s) to pattern | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `axis` | `[number]` | The axis around which to make the pattern. This is a 3D vector | Yes |
| `center` | `[number]` | The center about which to make the pattern. This is a 3D vector. | Yes |
| `arc_degrees` | `number` | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
| `rotate_duplicates` | `bool` | Whether or not to rotate the duplicates as they are copied. | Yes |
| `use_original` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
| `arcDegrees` | `number` | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
| `rotateDuplicates` | `bool` | Whether or not to rotate the duplicates as they are copied. | Yes |
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns

View File

@ -9,7 +9,7 @@ Repeat a 2-dimensional sketch along some dimension, with a dynamic amount
of distance between each repetition, some specified number of times.
```js
patternLinear2d(sketch_set: SketchSet, instances: integer, distance: number, axis: [number], use_original?: bool) -> [Sketch]
patternLinear2d(sketchSet: SketchSet, instances: integer, distance: number, axis: [number], useOriginal?: bool) -> [Sketch]
```
@ -17,11 +17,11 @@ patternLinear2d(sketch_set: SketchSet, instances: integer, distance: number, axi
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch_set` | [`SketchSet`](/docs/kcl/types/SketchSet) | The sketch(es) to duplicate | Yes |
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | The sketch(es) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `distance` | `number` | Distance between each repetition. Also known as 'spacing'. | Yes |
| `axis` | `[number]` | The axis of the pattern. A 2D vector. | Yes |
| `use_original` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns

View File

@ -9,7 +9,7 @@ Repeat a 3-dimensional solid along a linear path, with a dynamic amount
of distance between each repetition, some specified number of times.
```js
patternLinear3d(solid_set: SolidSet, instances: integer, distance: number, axis: [number], use_original?: bool) -> [Solid]
patternLinear3d(solidSet: SolidSet, instances: integer, distance: number, axis: [number], useOriginal?: bool) -> [Solid]
```
@ -17,11 +17,11 @@ patternLinear3d(solid_set: SolidSet, instances: integer, distance: number, axis:
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `solid_set` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes |
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `distance` | `number` | Distance between each repetition. Also known as 'spacing'. | Yes |
| `axis` | `[number]` | The axis of the pattern. A 2D vector. | Yes |
| `use_original` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns

View File

@ -35,7 +35,7 @@ The transform function returns a transform object. All properties of the object
- `rotation.origin` (either "local" i.e. rotate around its own center, "global" i.e. rotate around the scene's center, or a 3D point, defaults to "local")
```js
patternTransform(solid_set: SolidSet, instances: integer, transform: FunctionSource, use_original?: bool) -> [Solid]
patternTransform(solidSet: SolidSet, instances: integer, transform: FunctionSource, useOriginal?: bool) -> [Solid]
```
@ -43,10 +43,10 @@ patternTransform(solid_set: SolidSet, instances: integer, transform: FunctionSou
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `solid_set` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes |
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
| `use_original` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns

View File

@ -9,7 +9,7 @@ Just like patternTransform, but works on 2D sketches not 3D solids.
```js
patternTransform2d(sketch_set: SketchSet, instances: integer, transform: FunctionSource, use_original?: bool) -> [Sketch]
patternTransform2d(sketchSet: SketchSet, instances: integer, transform: FunctionSource, useOriginal?: bool) -> [Sketch]
```
@ -17,10 +17,10 @@ patternTransform2d(sketch_set: SketchSet, instances: integer, transform: Functio
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketch_set` | [`SketchSet`](/docs/kcl/types/SketchSet) | The sketch(es) to duplicate | Yes |
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | The sketch(es) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
| `use_original` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns

View File

@ -9,7 +9,7 @@ Create a regular polygon with the specified number of sides that is either inscr
```js
polygon(data: PolygonData, sketch_surface_or_group: SketchOrSurface, tag?: TagDeclarator) -> Sketch
polygon(data: PolygonData, sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDeclarator) -> Sketch
```
@ -18,7 +18,7 @@ polygon(data: PolygonData, sketch_surface_or_group: SketchOrSurface, tag?: TagDe
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `data` | [`PolygonData`](/docs/kcl/types/PolygonData) | Data for drawing a polygon | Yes |
| `sketch_surface_or_group` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns

View File

@ -9,7 +9,7 @@ Take a starting value. Then, for each element of an array, calculate the next va
using the previous value and the element.
```js
reduce(array: [KclValue], start: KclValue, reduce_fn: FunctionSource) -> KclValue
reduce(array: [KclValue], start: KclValue, reduceFn: FunctionSource) -> KclValue
```
@ -19,7 +19,7 @@ reduce(array: [KclValue], start: KclValue, reduce_fn: FunctionSource) -> KclValu
|----------|------|-------------|----------|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | | Yes |
| `start` | [`KclValue`](/docs/kcl/types/KclValue) | Any KCL value. | Yes |
| `reduce_fn` | `FunctionSource` | | Yes |
| `reduceFn` | `FunctionSource` | | Yes |
### Returns

View File

@ -9,7 +9,7 @@ Remove volume from a 3-dimensional shape such that a wall of the
provided thickness remains, taking volume starting at the provided face, leaving it open in that direction.
```js
shell(solid_set: SolidSet, thickness: number, faces: [FaceTag]) -> SolidSet
shell(solidSet: SolidSet, thickness: number, faces: [FaceTag]) -> SolidSet
```
@ -17,7 +17,7 @@ shell(solid_set: SolidSet, thickness: number, faces: [FaceTag]) -> SolidSet
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `solid_set` | [`SolidSet`](/docs/kcl/types/SolidSet) | Which solid (or solids) to shell out | Yes |
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | Which solid (or solids) to shell out | Yes |
| `thickness` | `number` | The thickness of the shell | Yes |
| `faces` | [`[FaceTag]`](/docs/kcl/types/FaceTag) | The faces you want removed | Yes |

View File

@ -9,7 +9,7 @@ Start a new profile at a given point.
```js
startProfileAt(to: [number], sketch_surface: SketchSurface, tag?: TagDeclarator) -> Sketch
startProfileAt(to: [number], sketchSurface: SketchSurface, tag?: TagDeclarator) -> Sketch
```
@ -18,7 +18,7 @@ startProfileAt(to: [number], sketch_surface: SketchSurface, tag?: TagDeclarator)
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `to` | `[number]` | | Yes |
| `sketch_surface` | [`SketchSurface`](/docs/kcl/types/SketchSurface) | A sketch type. | Yes |
| `sketchSurface` | [`SketchSurface`](/docs/kcl/types/SketchSurface) | A sketch type. | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns

View File

@ -38863,7 +38863,7 @@
"keywordArguments": true,
"args": [
{
"name": "solid_set",
"name": "solidSet",
"type": "SolidSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -70936,7 +70936,7 @@
"labelRequired": true
},
{
"name": "sketch_surface_or_group",
"name": "sketchSurfaceOrGroup",
"type": "SketchOrSurface",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -75887,7 +75887,7 @@
"labelRequired": true
},
{
"name": "sketch_surface_or_group",
"name": "sketchSurfaceOrGroup",
"type": "SketchOrSurface",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -85796,7 +85796,7 @@
"keywordArguments": true,
"args": [
{
"name": "sketch_set",
"name": "sketchSet",
"type": "SketchSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -104094,7 +104094,7 @@
"labelRequired": true
},
{
"name": "angle_start",
"name": "angleStart",
"type": "number",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -110158,7 +110158,7 @@
"keywordArguments": false,
"args": [
{
"name": "hole_sketch",
"name": "holeSketch",
"type": "SketchSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -118587,7 +118587,7 @@
"keywordArguments": false,
"args": [
{
"name": "file_path",
"name": "filePath",
"type": "String",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -124304,7 +124304,7 @@
"labelRequired": false
},
{
"name": "end_absolute",
"name": "endAbsolute",
"type": "[number]",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -132449,7 +132449,7 @@
"labelRequired": false
},
{
"name": "v_degree",
"name": "vDegree",
"type": "NonZeroU32",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -134051,7 +134051,7 @@
"labelRequired": true
},
{
"name": "bez_approximate_rational",
"name": "bezApproximateRational",
"type": "bool",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -135651,7 +135651,7 @@
"labelRequired": true
},
{
"name": "base_curve_index",
"name": "baseCurveIndex",
"type": "integer",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -143301,7 +143301,7 @@
"labelRequired": true
},
{
"name": "map_fn",
"name": "mapFn",
"type": "FunctionSource",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -149807,7 +149807,7 @@
"labelRequired": true
},
{
"name": "sketch_set",
"name": "sketchSet",
"type": "SketchSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -153703,7 +153703,7 @@
"keywordArguments": true,
"args": [
{
"name": "sketch_set",
"name": "sketchSet",
"type": "SketchSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -158613,7 +158613,7 @@
"labelRequired": true
},
{
"name": "arc_degrees",
"name": "arcDegrees",
"type": "number",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -160214,7 +160214,7 @@
"labelRequired": true
},
{
"name": "rotate_duplicates",
"name": "rotateDuplicates",
"type": "bool",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -161814,7 +161814,7 @@
"labelRequired": true
},
{
"name": "use_original",
"name": "useOriginal",
"type": "bool",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -165030,7 +165030,7 @@
"keywordArguments": true,
"args": [
{
"name": "solid_set",
"name": "solidSet",
"type": "SolidSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -171550,7 +171550,7 @@
"labelRequired": true
},
{
"name": "arc_degrees",
"name": "arcDegrees",
"type": "number",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -173151,7 +173151,7 @@
"labelRequired": true
},
{
"name": "rotate_duplicates",
"name": "rotateDuplicates",
"type": "bool",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -174751,7 +174751,7 @@
"labelRequired": true
},
{
"name": "use_original",
"name": "useOriginal",
"type": "bool",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -177967,7 +177967,7 @@
"keywordArguments": true,
"args": [
{
"name": "sketch_set",
"name": "sketchSet",
"type": "SketchSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -184478,7 +184478,7 @@
"labelRequired": true
},
{
"name": "use_original",
"name": "useOriginal",
"type": "bool",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -187694,7 +187694,7 @@
"keywordArguments": true,
"args": [
{
"name": "solid_set",
"name": "solidSet",
"type": "SolidSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -194209,7 +194209,7 @@
"labelRequired": true
},
{
"name": "use_original",
"name": "useOriginal",
"type": "bool",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -197425,7 +197425,7 @@
"keywordArguments": true,
"args": [
{
"name": "solid_set",
"name": "solidSet",
"type": "SolidSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -202333,7 +202333,7 @@
"labelRequired": true
},
{
"name": "use_original",
"name": "useOriginal",
"type": "bool",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -205554,7 +205554,7 @@
"keywordArguments": true,
"args": [
{
"name": "sketch_set",
"name": "sketchSet",
"type": "SketchSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -210458,7 +210458,7 @@
"labelRequired": true
},
{
"name": "use_original",
"name": "useOriginal",
"type": "bool",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -214182,7 +214182,7 @@
"labelRequired": true
},
{
"name": "sketch_surface_or_group",
"name": "sketchSurfaceOrGroup",
"type": "SketchOrSurface",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -244378,7 +244378,7 @@
"labelRequired": true
},
{
"name": "reduce_fn",
"name": "reduceFn",
"type": "FunctionSource",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -263874,7 +263874,7 @@
"keywordArguments": true,
"args": [
{
"name": "solid_set",
"name": "solidSet",
"type": "SolidSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
@ -270603,7 +270603,7 @@
"labelRequired": true
},
{
"name": "sketch_surface",
"name": "sketchSurface",
"type": "SketchSurface",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",

View File

@ -101,7 +101,8 @@ export class AuthenticatedTronApp {
// running against electron applications.
// The timeline is still broken but failure screenshots work again.
this.context = context
Object.assign(this.browserContext, this.context)
// TODO: try to get this to work again for screenshots, but it messed with test ends when enabled
// Object.assign(this.browserContext, this.context)
this.electronApp = electronApp
this.dir = dir

View File

@ -2729,13 +2729,9 @@ segAng(rectangleSegmentA002),
await page.getByText(codeToSelecton).click()
await toolbar.revolveButton.click()
await cmdBar.progressCmdBar()
await page.waitForTimeout(100)
await cmdBar.progressCmdBar()
await page.waitForTimeout(100)
await cmdBar.progressCmdBar()
await page.waitForTimeout(100)
await cmdBar.progressCmdBar()
await scene.waitForExecutionDone()
const newCodeToFind = `revolve001 = revolve({ angle = 360, axis = 'X' }, sketch002)`
expect(editor.expectEditor.toContain(newCodeToFind)).toBeTruthy()
@ -2837,11 +2833,6 @@ radius = 8.69
const lineCodeToSelection = `|> xLine(2.6, %)`
await page.getByText(lineCodeToSelection).click()
await cmdBar.progressCmdBar()
await page.waitForTimeout(100)
await cmdBar.progressCmdBar()
await page.waitForTimeout(100)
await cmdBar.progressCmdBar()
await scene.waitForExecutionDone()
const newCodeToFind = `revolve001 = revolve({ angle = 360, axis = seg01 }, sketch003)`
expect(editor.expectEditor.toContain(newCodeToFind)).toBeTruthy()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -122,9 +122,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.95"
version = "1.0.96"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
checksum = "6b964d184e89d9b6b67dd2715bc8e74cf3107fb2b529990c90cf517326150bf4"
dependencies = [
"backtrace",
]
@ -1858,9 +1858,9 @@ dependencies = [
[[package]]
name = "kittycad-modeling-cmds"
version = "0.2.97"
version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c37ad10b8a2afdcd1852d027f123cf4e38864ea93e0fda5c7ee1e8a49af49fb"
checksum = "828a0c74476533e6258ea7dd70cfc7d63a5df4b37753d30ef198e0689eaac4eb"
dependencies = [
"anyhow",
"chrono",
@ -3245,9 +3245,9 @@ checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03"
[[package]]
name = "serde"
version = "1.0.217"
version = "1.0.218"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
dependencies = [
"serde_derive",
]
@ -3263,9 +3263,9 @@ dependencies = [
[[package]]
name = "serde_derive"
version = "1.0.217"
version = "1.0.218"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
dependencies = [
"proc-macro2",
"quote",
@ -3285,9 +3285,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.138"
version = "1.0.139"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949"
checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6"
dependencies = [
"indexmap 2.7.1",
"itoa",
@ -4208,9 +4208,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "uuid"
version = "1.13.1"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ced87ca4be083373936a67f8de945faa23b6b42384bd5b64434850802c6dccd0"
checksum = "93d59ca99a559661b96bf898d8fce28ed87935fd2bea9f05983c1464dd6c71b1"
dependencies = [
"getrandom 0.3.1",
"js-sys",

View File

@ -80,7 +80,7 @@ members = [
[workspace.dependencies]
http = "1"
kittycad = { version = "0.3.28", default-features = false, features = ["js", "requests"] }
kittycad-modeling-cmds = { version = "0.2.97", features = [
kittycad-modeling-cmds = { version = "0.2.99", features = [
"ts-rs",
"websocket",
] }

View File

@ -9,7 +9,7 @@ mod unbox;
use std::collections::HashMap;
use convert_case::Casing;
use inflector::Inflector;
use inflector::{cases::camelcase::to_camel_case, Inflector};
use once_cell::sync::Lazy;
use quote::{format_ident, quote, quote_spanned, ToTokens};
use regex::Regex;
@ -326,13 +326,14 @@ fn do_stdlib_inner(
};
let include_in_snippet = required || arg_meta.map(|arg| arg.include_in_snippet).unwrap_or_default();
let label_required = !(i == 0 && metadata.unlabeled_first);
let camel_case_arg_name = to_camel_case(&arg_name);
if ty_string != "ExecState" && ty_string != "Args" {
let schema = quote! {
#docs_crate::cleanup_number_tuples_root(generator.root_schema_for::<#ty_ident>())
};
arg_types.push(quote! {
#docs_crate::StdLibFnArg {
name: #arg_name.to_string(),
name: #camel_case_arg_name.to_string(),
type_: #ty_string.to_string(),
schema: #schema,
required: #required,

View File

@ -968,7 +968,7 @@ mod tests {
let snippet = pattern_fn.to_autocomplete_snippet().unwrap();
assert_eq!(
snippet,
r#"patternCircular3d(${0:%}, instances = ${1:10}, axis = [${2:3.14}, ${3:3.14}, ${4:3.14}], center = [${5:3.14}, ${6:3.14}, ${7:3.14}], arc_degrees = ${8:3.14}, rotate_duplicates = ${9:false})${}"#
r#"patternCircular3d(${0:%}, instances = ${1:10}, axis = [${2:3.14}, ${3:3.14}, ${4:3.14}], center = [${5:3.14}, ${6:3.14}, ${7:3.14}], arcDegrees = ${8:3.14}, rotateDuplicates = ${9:false})${}"#
);
}
@ -1072,7 +1072,7 @@ mod tests {
let snippet = helix_fn.to_autocomplete_snippet().unwrap();
assert_eq!(
snippet,
r#"helix(revolutions = ${0:3.14}, angle_start = ${1:3.14}, radius = ${2:3.14}, axis = ${3:"X"}, length = ${4:3.14})${}"#
r#"helix(revolutions = ${0:3.14}, angleStart = ${1:3.14}, radius = ${2:3.14}, axis = ${3:"X"}, length = ${4:3.14})${}"#
);
}

View File

@ -4,7 +4,7 @@ use anyhow::Result;
use kcmc::{
coord::{System, KITTYCAD},
each_cmd as mcmd,
format::InputFormat,
format::InputFormat3d,
ok_response::OkModelingCmdResponse,
shared::FileImportFormat,
units::UnitLength,
@ -32,7 +32,7 @@ pub const ZOO_COORD_SYSTEM: System = *KITTYCAD;
pub async fn import_foreign(
file_path: &Path,
format: Option<InputFormat>,
format: Option<InputFormat3d>,
exec_state: &mut ExecState,
ctxt: &ExecutorContext,
source_range: SourceRange,
@ -98,7 +98,7 @@ pub async fn import_foreign(
// In the case of a gltf importing a bin file we need to handle that! and figure out where the
// file is relative to our current file.
if let InputFormat::Gltf(..) = format {
if let InputFormat3d::Gltf(..) = format {
// Check if the file is a binary gltf file, in that case we don't need to import the bin
// file.
if !file_contents.starts_with(b"glTF") {
@ -158,7 +158,7 @@ pub(super) fn format_from_annotations(
annotations: &[Node<Annotation>],
path: &Path,
import_source_range: SourceRange,
) -> Result<Option<InputFormat>, KclError> {
) -> Result<Option<InputFormat3d>, KclError> {
if annotations.is_empty() {
return Ok(None);
}
@ -220,7 +220,7 @@ pub(super) fn format_from_annotations(
Ok(Some(result))
}
fn set_coords(fmt: &mut InputFormat, coords_str: &str, source_range: SourceRange) -> Result<(), KclError> {
fn set_coords(fmt: &mut InputFormat3d, coords_str: &str, source_range: SourceRange) -> Result<(), KclError> {
let mut coords = None;
for (name, val) in annotations::IMPORT_COORDS_VALUES {
if coords_str == name {
@ -243,9 +243,9 @@ fn set_coords(fmt: &mut InputFormat, coords_str: &str, source_range: SourceRange
};
match fmt {
InputFormat::Obj(opts) => opts.coords = coords,
InputFormat::Ply(opts) => opts.coords = coords,
InputFormat::Stl(opts) => opts.coords = coords,
InputFormat3d::Obj(opts) => opts.coords = coords,
InputFormat3d::Ply(opts) => opts.coords = coords,
InputFormat3d::Stl(opts) => opts.coords = coords,
_ => {
return Err(KclError::Semantic(KclErrorDetails {
message: format!(
@ -260,13 +260,13 @@ fn set_coords(fmt: &mut InputFormat, coords_str: &str, source_range: SourceRange
Ok(())
}
fn set_length_unit(fmt: &mut InputFormat, units_str: &str, source_range: SourceRange) -> Result<(), KclError> {
fn set_length_unit(fmt: &mut InputFormat3d, units_str: &str, source_range: SourceRange) -> Result<(), KclError> {
let units = UnitLen::from_str(units_str, source_range)?;
match fmt {
InputFormat::Obj(opts) => opts.units = units.into(),
InputFormat::Ply(opts) => opts.units = units.into(),
InputFormat::Stl(opts) => opts.units = units.into(),
InputFormat3d::Obj(opts) => opts.units = units.into(),
InputFormat3d::Ply(opts) => opts.units = units.into(),
InputFormat3d::Stl(opts) => opts.units = units.into(),
_ => {
return Err(KclError::Semantic(KclErrorDetails {
message: format!(
@ -320,7 +320,7 @@ pub async fn send_to_engine(pre: PreImportedGeometry, ctxt: &ExecutorContext) ->
}
/// Get the source format from the extension.
fn get_import_format_from_extension(ext: &str) -> Result<InputFormat> {
fn get_import_format_from_extension(ext: &str) -> Result<InputFormat3d> {
let format = match FileImportFormat::from_str(ext) {
Ok(format) => format,
Err(_) => {
@ -343,44 +343,44 @@ fn get_import_format_from_extension(ext: &str) -> Result<InputFormat> {
// * Up: +Z
// * Handedness: Right
match format {
FileImportFormat::Step => Ok(InputFormat::Step(kcmc::format::step::import::Options {
FileImportFormat::Step => Ok(InputFormat3d::Step(kcmc::format::step::import::Options {
split_closed_faces: false,
})),
FileImportFormat::Stl => Ok(InputFormat::Stl(kcmc::format::stl::import::Options {
FileImportFormat::Stl => Ok(InputFormat3d::Stl(kcmc::format::stl::import::Options {
coords: ZOO_COORD_SYSTEM,
units: ul,
})),
FileImportFormat::Obj => Ok(InputFormat::Obj(kcmc::format::obj::import::Options {
FileImportFormat::Obj => Ok(InputFormat3d::Obj(kcmc::format::obj::import::Options {
coords: ZOO_COORD_SYSTEM,
units: ul,
})),
FileImportFormat::Gltf => Ok(InputFormat::Gltf(kcmc::format::gltf::import::Options {})),
FileImportFormat::Ply => Ok(InputFormat::Ply(kcmc::format::ply::import::Options {
FileImportFormat::Gltf => Ok(InputFormat3d::Gltf(kcmc::format::gltf::import::Options {})),
FileImportFormat::Ply => Ok(InputFormat3d::Ply(kcmc::format::ply::import::Options {
coords: ZOO_COORD_SYSTEM,
units: ul,
})),
FileImportFormat::Fbx => Ok(InputFormat::Fbx(kcmc::format::fbx::import::Options {})),
FileImportFormat::Sldprt => Ok(InputFormat::Sldprt(kcmc::format::sldprt::import::Options {
FileImportFormat::Fbx => Ok(InputFormat3d::Fbx(kcmc::format::fbx::import::Options {})),
FileImportFormat::Sldprt => Ok(InputFormat3d::Sldprt(kcmc::format::sldprt::import::Options {
split_closed_faces: false,
})),
}
}
fn validate_extension_format(ext: InputFormat, given: InputFormat) -> Result<()> {
if let InputFormat::Stl(_) = ext {
if let InputFormat::Stl(_) = given {
fn validate_extension_format(ext: InputFormat3d, given: InputFormat3d) -> Result<()> {
if let InputFormat3d::Stl(_) = ext {
if let InputFormat3d::Stl(_) = given {
return Ok(());
}
}
if let InputFormat::Obj(_) = ext {
if let InputFormat::Obj(_) = given {
if let InputFormat3d::Obj(_) = ext {
if let InputFormat3d::Obj(_) = given {
return Ok(());
}
}
if let InputFormat::Ply(_) = ext {
if let InputFormat::Ply(_) = given {
if let InputFormat3d::Ply(_) = ext {
if let InputFormat3d::Ply(_) = given {
return Ok(());
}
}
@ -396,15 +396,15 @@ fn validate_extension_format(ext: InputFormat, given: InputFormat) -> Result<()>
)
}
fn get_name_of_format(type_: InputFormat) -> &'static str {
fn get_name_of_format(type_: InputFormat3d) -> &'static str {
match type_ {
InputFormat::Fbx(_) => "fbx",
InputFormat::Gltf(_) => "gltf",
InputFormat::Obj(_) => "obj",
InputFormat::Ply(_) => "ply",
InputFormat::Sldprt(_) => "sldprt",
InputFormat::Step(_) => "step",
InputFormat::Stl(_) => "stl",
InputFormat3d::Fbx(_) => "fbx",
InputFormat3d::Gltf(_) => "gltf",
InputFormat3d::Obj(_) => "obj",
InputFormat3d::Ply(_) => "ply",
InputFormat3d::Sldprt(_) => "sldprt",
InputFormat3d::Step(_) => "step",
InputFormat3d::Stl(_) => "stl",
}
}
@ -430,7 +430,7 @@ mod test {
.unwrap();
assert_eq!(
fmt,
InputFormat::Gltf(kittycad_modeling_cmds::format::gltf::import::Options {})
InputFormat3d::Gltf(kittycad_modeling_cmds::format::gltf::import::Options {})
);
// format, no options
@ -442,7 +442,7 @@ mod test {
.unwrap();
assert_eq!(
fmt,
InputFormat::Gltf(kittycad_modeling_cmds::format::gltf::import::Options {})
InputFormat3d::Gltf(kittycad_modeling_cmds::format::gltf::import::Options {})
);
// format, no extension (wouldn't parse but might some day)
@ -451,7 +451,7 @@ mod test {
.unwrap();
assert_eq!(
fmt,
InputFormat::Gltf(kittycad_modeling_cmds::format::gltf::import::Options {})
InputFormat3d::Gltf(kittycad_modeling_cmds::format::gltf::import::Options {})
);
// format, options
@ -463,7 +463,7 @@ mod test {
.unwrap();
assert_eq!(
fmt,
InputFormat::Obj(kittycad_modeling_cmds::format::obj::import::Options {
InputFormat3d::Obj(kittycad_modeling_cmds::format::obj::import::Options {
coords: *kittycad_modeling_cmds::coord::VULKAN,
units: kittycad_modeling_cmds::units::UnitLength::Feet,
})
@ -478,7 +478,7 @@ mod test {
.unwrap();
assert_eq!(
fmt,
InputFormat::Obj(kittycad_modeling_cmds::format::obj::import::Options {
InputFormat3d::Obj(kittycad_modeling_cmds::format::obj::import::Options {
coords: *kittycad_modeling_cmds::coord::VULKAN,
units: kittycad_modeling_cmds::units::UnitLength::Feet,
})

View File

@ -2,7 +2,7 @@
use anyhow::Result;
use derive_docs::stdlib;
use kcmc::{coord::System, format::InputFormat, units::UnitLength};
use kcmc::{coord::System, format::InputFormat3d, units::UnitLength};
use kittycad_modeling_cmds as kcmc;
use crate::{
@ -64,26 +64,26 @@ pub enum ImportFormat {
},
}
impl From<ImportFormat> for InputFormat {
impl From<ImportFormat> for InputFormat3d {
fn from(format: ImportFormat) -> Self {
match format {
ImportFormat::Fbx {} => InputFormat::Fbx(Default::default()),
ImportFormat::Gltf {} => InputFormat::Gltf(Default::default()),
ImportFormat::Obj { coords, units } => InputFormat::Obj(kcmc::format::obj::import::Options {
ImportFormat::Fbx {} => InputFormat3d::Fbx(Default::default()),
ImportFormat::Gltf {} => InputFormat3d::Gltf(Default::default()),
ImportFormat::Obj { coords, units } => InputFormat3d::Obj(kcmc::format::obj::import::Options {
coords: coords.unwrap_or(ZOO_COORD_SYSTEM),
units,
}),
ImportFormat::Ply { coords, units } => InputFormat::Ply(kcmc::format::ply::import::Options {
ImportFormat::Ply { coords, units } => InputFormat3d::Ply(kcmc::format::ply::import::Options {
coords: coords.unwrap_or(ZOO_COORD_SYSTEM),
units,
}),
ImportFormat::Sldprt {} => InputFormat::Sldprt(kcmc::format::sldprt::import::Options {
ImportFormat::Sldprt {} => InputFormat3d::Sldprt(kcmc::format::sldprt::import::Options {
split_closed_faces: false,
}),
ImportFormat::Step {} => InputFormat::Step(kcmc::format::step::import::Options {
ImportFormat::Step {} => InputFormat3d::Step(kcmc::format::step::import::Options {
split_closed_faces: false,
}),
ImportFormat::Stl { coords, units } => InputFormat::Stl(kcmc::format::stl::import::Options {
ImportFormat::Stl { coords, units } => InputFormat3d::Stl(kcmc::format::stl::import::Options {
coords: coords.unwrap_or(ZOO_COORD_SYSTEM),
units,
}),
@ -165,7 +165,7 @@ async fn inner_import(
}));
}
let format = options.map(InputFormat::from);
let format = options.map(InputFormat3d::from);
send_import_to_engine(
import_foreign(
std::path::Path::new(&file_path),

View File

@ -184,7 +184,7 @@ snapshot_kind: text
},
{
"labeledArgs": {
"hole_sketch": {
"holeSketch": {
"value": {
"type": "Sketch",
"value": {
@ -308,7 +308,7 @@ snapshot_kind: text
},
{
"labeledArgs": {
"hole_sketch": {
"holeSketch": {
"value": {
"type": "Sketch",
"value": {
@ -432,7 +432,7 @@ snapshot_kind: text
},
{
"labeledArgs": {
"hole_sketch": {
"holeSketch": {
"value": {
"type": "Sketch",
"value": {
@ -556,7 +556,7 @@ snapshot_kind: text
},
{
"labeledArgs": {
"hole_sketch": {
"holeSketch": {
"value": {
"type": "Sketch",
"value": {

View File

@ -1,11 +1,12 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed i_shape.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"hole_sketch": {
"holeSketch": {
"value": {
"type": "Sketch",
"value": {