KittyCAD / modeling-app

The KittyCAD modeling app.
https://kittycad.io/modeling-app/download
MIT License
354 stars 29 forks source link

[BUG]: pattern*2d functions do not repeat holes #3136

Closed dcl closed 1 month ago

dcl commented 1 month ago

Describe the bug

Consider the following KCL for a series of circles with holes:

let x = startSketchOn("XY")
  |> circle([0, 0], 5, %)
  |> hole(circle([0,0], 2, %), %)
  |> patternLinear2d({
    axis: [0, 1],
    distance: 10,
    repetitions: 3.5,
  }, %)

Instead of producing five circles with holes in them, the first circle correctly gets a hole, and the repeated patterns do not.

Steps to Reproduce

  1. Paste the above KCL

Expected Behavior

All five circles would have holes.

Screenshots and Recordings

ss (2024-07-26 at 01 50 11)

Desktop OS

Windows 10

Browser

No response

Version

0.24.4

Additional Context

No response

dcl commented 1 month ago

This is almost certainly simply repeating the hole at [0, 0] on the XY plane five times -- but startSketchOn only works with planes and ExtrudeGroup faces, so at the present there doesn't seem to be a way to define a hole with relative position directly.

jessfraz commented 1 month ago

we acttually have a test for something like this, see the difference of the code here: https://github.com/KittyCAD/modeling-app/blob/main/src/wasm-lib/tests/executor/main.rs#L936

const circles = startSketchOn('XY')
    |> circle([5, 5], 1, %)
    |> patternLinear2d({axis: [1,1], repetitions: 12, distance: 3}, %)

const rectangle = startSketchOn('XY')
  |> startProfileAt([0, 0], %)
  |> line([0, 50], %)
  |> line([50, 0], %)
  |> line([0, -50], %)
  |> close(%)
  |> hole(circles, %)
  |> extrude(10, %)

I agree the above that you mentioned should work, but as a work around doing two patterns should work for now

jessfraz commented 1 month ago

cc @gserena01 for understanding if engine bug or not, happy to help!

gserena01 commented 1 month ago

confirmed! It's an engine issue, and it only appears with 2d holes, not 3d holes. Expect a fix this week!