From 50669fb833ef82a72530877fc8ff323dc96e0c2c Mon Sep 17 00:00:00 2001 From: Adam Chalmers Date: Mon, 24 Feb 2025 14:56:44 -0600 Subject: [PATCH] KCL: All keyword arguments should use camelCase --- docs/kcl/appearance.md | 4 +- docs/kcl/circle.md | 4 +- docs/kcl/circleThreePoint.md | 4 +- docs/kcl/extrude.md | 4 +- docs/kcl/helix.md | 4 +- docs/kcl/hole.md | 4 +- docs/kcl/import.md | 4 +- docs/kcl/line.md | 4 +- docs/kcl/loft.md | 8 +-- docs/kcl/map.md | 4 +- docs/kcl/mirror2d.md | 4 +- docs/kcl/patternCircular2d.md | 10 +-- docs/kcl/patternCircular3d.md | 10 +-- docs/kcl/patternLinear2d.md | 6 +- docs/kcl/patternLinear3d.md | 6 +- docs/kcl/patternTransform.md | 6 +- docs/kcl/patternTransform2d.md | 6 +- docs/kcl/polygon.md | 4 +- docs/kcl/reduce.md | 4 +- docs/kcl/shell.md | 4 +- docs/kcl/startProfileAt.md | 4 +- docs/kcl/std.json | 66 +++++++++---------- src/wasm-lib/derive-docs/src/lib.rs | 5 +- src/wasm-lib/kcl/src/docs/mod.rs | 4 +- .../kcl/tests/fillet-and-shell/ops.snap | 8 +-- src/wasm-lib/kcl/tests/i_shape/ops.snap | 3 +- 26 files changed, 98 insertions(+), 96 deletions(-) diff --git a/docs/kcl/appearance.md b/docs/kcl/appearance.md index 9aebfd0566..c9ccbd78a4 100644 --- a/docs/kcl/appearance.md +++ b/docs/kcl/appearance.md @@ -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 | diff --git a/docs/kcl/circle.md b/docs/kcl/circle.md index cdc34f3e53..59f8815b52 100644 --- a/docs/kcl/circle.md +++ b/docs/kcl/circle.md @@ -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 diff --git a/docs/kcl/circleThreePoint.md b/docs/kcl/circleThreePoint.md index 7c353eb6ba..1cf2640272 100644 --- a/docs/kcl/circleThreePoint.md +++ b/docs/kcl/circleThreePoint.md @@ -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 diff --git a/docs/kcl/extrude.md b/docs/kcl/extrude.md index 7f6a0fdf2e..0f0f9f9b1b 100644 --- a/docs/kcl/extrude.md +++ b/docs/kcl/extrude.md @@ -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 diff --git a/docs/kcl/helix.md b/docs/kcl/helix.md index 75992d1bae..c137b8b6ca 100644 --- a/docs/kcl/helix.md +++ b/docs/kcl/helix.md @@ -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 | diff --git a/docs/kcl/hole.md b/docs/kcl/hole.md index fe8025193c..18e0acd685 100644 --- a/docs/kcl/hole.md +++ b/docs/kcl/hole.md @@ -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 diff --git a/docs/kcl/import.md b/docs/kcl/import.md index dbc818d685..91053ceb45 100644 --- a/docs/kcl/import.md +++ b/docs/kcl/import.md @@ -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 diff --git a/docs/kcl/line.md b/docs/kcl/line.md index 43358b3ab1..cbb3b214b3 100644 --- a/docs/kcl/line.md +++ b/docs/kcl/line.md @@ -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 | diff --git a/docs/kcl/loft.md b/docs/kcl/loft.md index d64548424b..796a031d54 100644 --- a/docs/kcl/loft.md +++ b/docs/kcl/loft.md @@ -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 diff --git a/docs/kcl/map.md b/docs/kcl/map.md index a2cc7bb70d..ff42f212fd 100644 --- a/docs/kcl/map.md +++ b/docs/kcl/map.md @@ -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 diff --git a/docs/kcl/mirror2d.md b/docs/kcl/mirror2d.md index 914076fa04..80e0a848a9 100644 --- a/docs/kcl/mirror2d.md +++ b/docs/kcl/mirror2d.md @@ -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 diff --git a/docs/kcl/patternCircular2d.md b/docs/kcl/patternCircular2d.md index bd27659223..e9837f106f 100644 --- a/docs/kcl/patternCircular2d.md +++ b/docs/kcl/patternCircular2d.md @@ -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 diff --git a/docs/kcl/patternCircular3d.md b/docs/kcl/patternCircular3d.md index d5ba557a26..585d7de7a0 100644 --- a/docs/kcl/patternCircular3d.md +++ b/docs/kcl/patternCircular3d.md @@ -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 diff --git a/docs/kcl/patternLinear2d.md b/docs/kcl/patternLinear2d.md index e436019a9a..b886be7553 100644 --- a/docs/kcl/patternLinear2d.md +++ b/docs/kcl/patternLinear2d.md @@ -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 diff --git a/docs/kcl/patternLinear3d.md b/docs/kcl/patternLinear3d.md index 3f5b16e5f7..f7a277329a 100644 --- a/docs/kcl/patternLinear3d.md +++ b/docs/kcl/patternLinear3d.md @@ -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 diff --git a/docs/kcl/patternTransform.md b/docs/kcl/patternTransform.md index 37fb89eb6e..b05fecb73d 100644 --- a/docs/kcl/patternTransform.md +++ b/docs/kcl/patternTransform.md @@ -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 diff --git a/docs/kcl/patternTransform2d.md b/docs/kcl/patternTransform2d.md index b580fbb389..07f3e34e5c 100644 --- a/docs/kcl/patternTransform2d.md +++ b/docs/kcl/patternTransform2d.md @@ -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 diff --git a/docs/kcl/polygon.md b/docs/kcl/polygon.md index dade2077d1..512fce494a 100644 --- a/docs/kcl/polygon.md +++ b/docs/kcl/polygon.md @@ -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 diff --git a/docs/kcl/reduce.md b/docs/kcl/reduce.md index c8ca2a7b04..36fdf83af1 100644 --- a/docs/kcl/reduce.md +++ b/docs/kcl/reduce.md @@ -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 diff --git a/docs/kcl/shell.md b/docs/kcl/shell.md index c57818a314..e313663b6a 100644 --- a/docs/kcl/shell.md +++ b/docs/kcl/shell.md @@ -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 | diff --git a/docs/kcl/startProfileAt.md b/docs/kcl/startProfileAt.md index 9d7dd193e5..b85b1a097d 100644 --- a/docs/kcl/startProfileAt.md +++ b/docs/kcl/startProfileAt.md @@ -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 diff --git a/docs/kcl/std.json b/docs/kcl/std.json index 60cae5bf75..2a5f6fa64e 100644 --- a/docs/kcl/std.json +++ b/docs/kcl/std.json @@ -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", diff --git a/src/wasm-lib/derive-docs/src/lib.rs b/src/wasm-lib/derive-docs/src/lib.rs index fee6bfe4ec..ea4dce5392 100644 --- a/src/wasm-lib/derive-docs/src/lib.rs +++ b/src/wasm-lib/derive-docs/src/lib.rs @@ -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, diff --git a/src/wasm-lib/kcl/src/docs/mod.rs b/src/wasm-lib/kcl/src/docs/mod.rs index d56e079d3f..1df0790539 100644 --- a/src/wasm-lib/kcl/src/docs/mod.rs +++ b/src/wasm-lib/kcl/src/docs/mod.rs @@ -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})${}"# ); } diff --git a/src/wasm-lib/kcl/tests/fillet-and-shell/ops.snap b/src/wasm-lib/kcl/tests/fillet-and-shell/ops.snap index 171271010f..372d488ba3 100644 --- a/src/wasm-lib/kcl/tests/fillet-and-shell/ops.snap +++ b/src/wasm-lib/kcl/tests/fillet-and-shell/ops.snap @@ -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": { diff --git a/src/wasm-lib/kcl/tests/i_shape/ops.snap b/src/wasm-lib/kcl/tests/i_shape/ops.snap index 8c9421c453..71e949d6f8 100644 --- a/src/wasm-lib/kcl/tests/i_shape/ops.snap +++ b/src/wasm-lib/kcl/tests/i_shape/ops.snap @@ -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": {