Files
modeling-app/docs/kcl/mirror2d.md
Paul Tagliamonte c84c0b0fef return errors back to user (#4075)
* Log any Errors to stderr

This isn't perfect -- in fact, this is maybe not even very good at all,
but it's better than what we have today.

Currently, when we get an Erorr back from the WebSocket, we drop it in
kcl-lib. The web-app logs these to the console (I can't find my commit
doing that off the top of my head, but I remember doing it) -- so this
is some degree of partity.

This won't be very useful at all for wasm usage, but it will fix issues
with the zoo cli silently breaking with a "WebSocket Closed" error --
which is the same issue I was solving for in the desktop app too.

In the future perhaps this can be a real Error? I'm not totally sure
yet, since we can't align to the request-id, so we can't really tie it
to a specific call (yet).

* add to responses

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)

* add a test

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* clippy[

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)

* empty

* fix error

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates tests

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* docs

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
2024-10-02 22:05:12 -07:00

292 KiB

title, excerpt, layout
title excerpt layout
mirror2d Mirror a sketch. manual

Mirror a sketch.

Only works on unclosed sketches for now.

Mirror occurs around a local sketch axis rather than a global axis.

mirror2d(data: Mirror2dData, sketch_set: SketchSet) -> [Sketch]

Arguments

Name Type Description Required
data Mirror2dData Data for a mirror. Yes
sketch_set SketchSet A sketch or a group of sketches. Yes

Returns

[Sketch]

Examples

// Mirror an un-closed sketch across the Y axis.
sketch001 = startSketchOn('XZ')
  |> startProfileAt([0, 10], %)
  |> line([15, 0], %)
  |> line([-7, -3], %)
  |> line([9, -1], %)
  |> line([-8, -5], %)
  |> line([9, -3], %)
  |> line([-8, -3], %)
  |> line([9, -1], %)
  |> line([-19, -0], %)
  |> mirror2d({ axis: 'Y' }, %)

example = extrude(10, sketch001)

Rendered example of mirror2d 0

// Mirror a un-closed sketch across the Y axis.
sketch001 = startSketchOn('XZ')
  |> startProfileAt([0, 8.5], %)
  |> line([20, -8.5], %)
  |> line([-20, -8.5], %)
  |> mirror2d({ axis: 'Y' }, %)

example = extrude(10, sketch001)

Rendered example of mirror2d 1

// Mirror a un-closed sketch across an edge.
helper001 = startSketchOn('XZ')
  |> startProfileAt([0, 0], %)
  |> line([0, 10], %, $edge001)

sketch001 = startSketchOn('XZ')
  |> startProfileAt([0, 8.5], %)
  |> line([20, -8.5], %)
  |> line([-20, -8.5], %)
  |> mirror2d({ axis: edge001 }, %)

example = extrude(10, sketch001)

Rendered example of mirror2d 2

// Mirror an un-closed sketch across a custom axis.
sketch001 = startSketchOn('XZ')
  |> startProfileAt([0, 8.5], %)
  |> line([20, -8.5], %)
  |> line([-20, -8.5], %)
  |> mirror2d({
       axis: {
         custom: { axis: [0.0, 1.0], origin: [0.0, 0.0] }
       }
     }, %)

example = extrude(10, sketch001)

Rendered example of mirror2d 3