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

499 KiB

title, excerpt, layout
title excerpt layout
loft Create a 3D surface or solid by interpolating between two or more sketches. manual

Create a 3D surface or solid by interpolating between two or more sketches.

The sketches need to closed and on the same plane.

loft(sketches: [Sketch], data?: LoftData) -> Solid

Arguments

Name Type Description Required
sketches [Sketch] Yes
data LoftData Data for a loft. No

Returns

Solid - An solid is a collection of extrude surfaces.

Examples

// Loft a square and a triangle.
squareSketch = startSketchOn('XY')
  |> startProfileAt([-100, 200], %)
  |> line([200, 0], %)
  |> line([0, -200], %)
  |> line([-200, 0], %)
  |> lineTo([profileStartX(%), profileStartY(%)], %)
  |> close(%)

triangleSketch = startSketchOn(offsetPlane('XY', 75))
  |> startProfileAt([0, 125], %)
  |> line([-15, -30], %)
  |> line([30, 0], %)
  |> lineTo([profileStartX(%), profileStartY(%)], %)
  |> close(%)

loft([squareSketch, triangleSketch])

Rendered example of loft 0

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

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

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

loft([
  squareSketch,
  circleSketch0,
  circleSketch1
])

Rendered example of loft 1

// Loft a square, a circle, and another circle with options.
squareSketch = startSketchOn('XY')
  |> startProfileAt([-100, 200], %)
  |> line([200, 0], %)
  |> line([0, -200], %)
  |> line([-200, 0], %)
  |> lineTo([profileStartX(%), profileStartY(%)], %)
  |> close(%)

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

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

loft([
  squareSketch,
  circleSketch0,
  circleSketch1
], {
  // This can be set to override the automatically determined
  // topological base curve, which is usually the first section encountered.
  baseCurveIndex: 0,
  // 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.
  bezApproximateRational: false,
  // Tolerance for the loft operation.
  tolerance: 0.000001,
  // 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.
  vDegree: 2
})

Rendered example of loft 2