diff --git a/src/wasm-lib/kcl/src/std/patterns.rs b/src/wasm-lib/kcl/src/std/patterns.rs index 5929e1568f..ccc49d3d66 100644 --- a/src/wasm-lib/kcl/src/std/patterns.rs +++ b/src/wasm-lib/kcl/src/std/patterns.rs @@ -398,6 +398,61 @@ pub async fn pattern_linear_3d(args: Args) -> Result { /// distance: 6 /// }, %) /// ``` +/// +/// ```no_run +/// // Pattern a whole sketch on face. +/// let size = 100 +/// const case = startSketchOn('XY') +/// |> startProfileAt([-size, -size], %) +/// |> line([2 * size, 0], %) +/// |> line([0, 2 * size], %) +/// |> tangentialArcTo([-size, size], %) +/// |> close(%) +/// |> extrude(65, %) +/// +/// const thing1 = startSketchOn(case, 'end') +/// |> circle([-size / 2, -size / 2], 25, %) +/// |> extrude(50, %) +/// +/// const thing2 = startSketchOn(case, 'end') +/// |> circle([size / 2, -size / 2], 25, %) +/// |> extrude(50, %) +/// +/// // We pass in the "case" here since we want to pattern the whole sketch. +/// // And the case was the base of the sketch. +/// patternLinear3d({ +/// axis: [1, 0, 0], +/// distance: 250, +/// repetitions:2, +/// }, case) +/// ``` +/// +/// ```no_run +/// // Pattern an object on a face. +/// let size = 100 +/// const case = startSketchOn('XY') +/// |> startProfileAt([-size, -size], %) +/// |> line([2 * size, 0], %) +/// |> line([0, 2 * size], %) +/// |> tangentialArcTo([-size, size], %) +/// |> close(%) +/// |> extrude(65, %) +/// +/// const thing1 = startSketchOn(case, 'end') +/// |> circle([-size / 2, -size / 2], 25, %) +/// |> extrude(50, %) +/// +/// const thing2 = startSketchOn(case, 'end') +/// |> circle([size / 2, -size / 2], 25, %) +/// |> extrude(50, %) +/// +/// // We pass in "thing1" here since we want to pattern just this object on the face. +/// patternLinear3d({ +/// axis: [0, 1, 0], +/// distance: 10, +/// repetitions:2, +/// }, thing1) +/// ``` #[stdlib { name = "patternLinear3d", }] @@ -662,6 +717,65 @@ pub async fn pattern_circular_3d(args: Args) -> Result { /// rotateDuplicates: true /// }, %) /// ``` +/// +/// ```no_run +/// // Pattern a whole sketch on face. +/// let size = 100 +/// const case = startSketchOn('XY') +/// |> startProfileAt([-size, -size], %) +/// |> line([2 * size, 0], %) +/// |> line([0, 2 * size], %) +/// |> tangentialArcTo([-size, size], %) +/// |> close(%) +/// |> extrude(65, %) +/// +/// const thing1 = startSketchOn(case, 'end') +/// |> circle([-size / 2, -size / 2], 25, %) +/// |> extrude(50, %) +/// +/// const thing2 = startSketchOn(case, 'end') +/// |> circle([size / 2, -size / 2], 25, %) +/// |> extrude(50, %) +/// +/// // We pass in the "case" here since we want to pattern the whole sketch. +/// // And the case was the base of the sketch. +/// patternCircular3d({ +/// arcDegrees: 360, +/// axis: [0,0,10], +/// center: [200,100,0], +/// repetitions: 2, +/// rotateDuplicates: false, +/// }, case) +/// ``` +/// +/// ```no_run +/// // Pattern an object on a face. +/// let size = 100 +/// const case = startSketchOn('XY') +/// |> startProfileAt([-size, -size], %) +/// |> line([2 * size, 0], %) +/// |> line([0, 2 * size], %) +/// |> tangentialArcTo([-size, size], %) +/// |> close(%) +/// |> extrude(65, %) +/// +/// const thing1 = startSketchOn(case, 'end') +/// |> circle([-size / 2, -size / 2], 25, %) +/// |> extrude(50, %) +/// +/// const thing2 = startSketchOn(case, 'end') +/// |> circle([size / 2, -size / 2], 25, %) +/// |> extrude(50, %) +/// +/// // We pass in "thing1" here since we want to pattern just this object on the face. +/// patternCircular3d({ +/// arcDegrees: 360, +/// axis: [0,0,10], +/// center: [0,0,0], +/// repetitions: 2, +/// rotateDuplicates: false, +/// }, thing1) +/// ``` #[stdlib { name = "patternCircular3d", }] diff --git a/src/wasm-lib/kcl/tests/outputs/serial_test_example_pattern_circular_3d1.png b/src/wasm-lib/kcl/tests/outputs/serial_test_example_pattern_circular_3d1.png new file mode 100644 index 0000000000..5cc744c194 Binary files /dev/null and b/src/wasm-lib/kcl/tests/outputs/serial_test_example_pattern_circular_3d1.png differ diff --git a/src/wasm-lib/kcl/tests/outputs/serial_test_example_pattern_circular_3d2.png b/src/wasm-lib/kcl/tests/outputs/serial_test_example_pattern_circular_3d2.png new file mode 100644 index 0000000000..8a4d1765d1 Binary files /dev/null and b/src/wasm-lib/kcl/tests/outputs/serial_test_example_pattern_circular_3d2.png differ diff --git a/src/wasm-lib/kcl/tests/outputs/serial_test_example_pattern_linear_3d1.png b/src/wasm-lib/kcl/tests/outputs/serial_test_example_pattern_linear_3d1.png new file mode 100644 index 0000000000..b04a0b76f2 Binary files /dev/null and b/src/wasm-lib/kcl/tests/outputs/serial_test_example_pattern_linear_3d1.png differ diff --git a/src/wasm-lib/kcl/tests/outputs/serial_test_example_pattern_linear_3d2.png b/src/wasm-lib/kcl/tests/outputs/serial_test_example_pattern_linear_3d2.png new file mode 100644 index 0000000000..2c50c62b45 Binary files /dev/null and b/src/wasm-lib/kcl/tests/outputs/serial_test_example_pattern_linear_3d2.png differ