Files
modeling-app/docs/kcl/offsetPlane.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

439 KiB

title, excerpt, layout
title excerpt layout
offsetPlane Offset a plane by a distance along its normal. manual

Offset a plane by a distance along its normal.

For example, if you offset the 'XZ' plane by 10, the new plane will be parallel to the 'XZ' plane and 10 units away from it.

offsetPlane(std_plane: StandardPlane, offset: number) -> PlaneData

Arguments

Name Type Description Required
std_plane StandardPlane One of the standard planes. Yes
offset number Yes

Returns

PlaneData - Data for a plane.

Examples

// Loft a square and a circle on the `XY` plane using offset.
squareSketch = startSketchOn('XY')
  |> startProfileAt([-100, 200], %)
  |> line([200, 0], %)
  |> line([0, -200], %)
  |> line([-200, 0], %)
  |> lineTo([profileStartX(%), profileStartY(%)], %)
  |> close(%)

circleSketch = startSketchOn(offsetPlane('XY', 150))
  |> circle({ center: [0, 100], radius: 50 }, %)

loft([squareSketch, circleSketch])

Rendered example of offsetPlane 0

// Loft a square and a circle on the `XZ` plane using offset.
squareSketch = startSketchOn('XZ')
  |> startProfileAt([-100, 200], %)
  |> line([200, 0], %)
  |> line([0, -200], %)
  |> line([-200, 0], %)
  |> lineTo([profileStartX(%), profileStartY(%)], %)
  |> close(%)

circleSketch = startSketchOn(offsetPlane('XZ', 150))
  |> circle({ center: [0, 100], radius: 50 }, %)

loft([squareSketch, circleSketch])

Rendered example of offsetPlane 1

// Loft a square and a circle on the `YZ` plane using offset.
squareSketch = startSketchOn('YZ')
  |> startProfileAt([-100, 200], %)
  |> line([200, 0], %)
  |> line([0, -200], %)
  |> line([-200, 0], %)
  |> lineTo([profileStartX(%), profileStartY(%)], %)
  |> close(%)

circleSketch = startSketchOn(offsetPlane('YZ', 150))
  |> circle({ center: [0, 100], radius: 50 }, %)

loft([squareSketch, circleSketch])

Rendered example of offsetPlane 2

// Loft a square and a circle on the `-XZ` plane using offset.
squareSketch = startSketchOn('-XZ')
  |> startProfileAt([-100, 200], %)
  |> line([200, 0], %)
  |> line([0, -200], %)
  |> line([-200, 0], %)
  |> lineTo([profileStartX(%), profileStartY(%)], %)
  |> close(%)

circleSketch = startSketchOn(offsetPlane('-XZ', -150))
  |> circle({ center: [0, 100], radius: 50 }, %)

loft([squareSketch, circleSketch])

Rendered example of offsetPlane 3