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

215 KiB

title, excerpt, layout
title excerpt layout
chamfer Cut a straight transitional edge along a tagged path. manual

Cut a straight transitional edge along a tagged path.

Chamfer is similar in function and use to a fillet, except a fillet will blend the transition along an edge, rather than cut a sharp, straight transitional edge.

chamfer(data: ChamferData, solid: Solid, tag?: TagDeclarator) -> Solid

Arguments

Name Type Description Required
data ChamferData Data for chamfers. Yes
solid Solid An solid is a collection of extrude surfaces. Yes
tag TagDeclarator No

Returns

Solid - An solid is a collection of extrude surfaces.

Examples

// Chamfer a mounting plate.
width = 20
length = 10
thickness = 1
chamferLength = 2

mountingPlateSketch = startSketchOn("XY")
  |> startProfileAt([-width / 2, -length / 2], %)
  |> lineTo([width / 2, -length / 2], %, $edge1)
  |> lineTo([width / 2, length / 2], %, $edge2)
  |> lineTo([-width / 2, length / 2], %, $edge3)
  |> close(%, $edge4)

mountingPlate = extrude(thickness, mountingPlateSketch)
  |> chamfer({
       length: chamferLength,
       tags: [
         getNextAdjacentEdge(edge1),
         getNextAdjacentEdge(edge2),
         getNextAdjacentEdge(edge3),
         getNextAdjacentEdge(edge4)
       ]
     }, %)

Rendered example of chamfer 0

// Sketch on the face of a chamfer.
fn cube = (pos, scale) => {
  sg = startSketchOn('XY')
    |> startProfileAt(pos, %)
    |> line([0, scale], %)
    |> line([scale, 0], %)
    |> line([0, -scale], %)

  return sg
}

part001 = cube([0, 0], 20)
  |> close(%, $line1)
  |> extrude(20, %)
  |> chamfer({
       length: 10,
       tags: [getOppositeEdge(line1)]
     }, %, $chamfer1) // We tag the chamfer to reference it later.

sketch001 = startSketchOn(part001, chamfer1)
  |> startProfileAt([10, 10], %)
  |> line([2, 0], %)
  |> line([0, 2], %)
  |> line([-2, 0], %)
  |> lineTo([profileStartX(%), profileStartY(%)], %)
  |> close(%)
  |> extrude(10, %)

Rendered example of chamfer 1