KittyCAD / modeling-app

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

`getNextAdjacentEdge` & `getPreviousAdjacentEdge` with fillets are backwards #3437

Closed jgomez720 closed 2 months ago

jgomez720 commented 2 months ago

Description

Jordan was showing me his KCL code and trying to make a fillet. We noticed that the getNextAdjacentEdge & getPreviousAdjacentEdge were doing the opposite of their intent. We noticed that they were flipped with revolves a while ago here: https://github.com/KittyCAD/modeling-app/issues/1935. Once we flipped these, the order caused issues with fillets.

Version

v0.24.10

Recording

https://github.com/user-attachments/assets/2b8aa3ae-c1df-4a24-83e8-04cfede1a8ea

KCL

const grainD = 4
const grainR = grainD / 2
const length = 5
const insulationThickness = 0.25
const propR = grainR - insulationThickness
const starPoints = 5
const starDepth = 1.25
const starWidth = 0.249999
const portD = 0.5
const portR = portD / 2
const portAngle = 360 / (2 * pi()) * asin(starWidth / 2 / portR)
const angleEnd =  (360 / starPoints / 2)

const baseInsulation = startSketchOn('XY')
  |> circle([0, 0], grainR, %)
  |> extrude(insulationThickness, %)

const propellant = startSketchOn(baseInsulation, 'END')
  |> startProfileAt([
       propR * cos(-2 * pi() / starPoints / 2),
       propR * sin(-2 * pi() / starPoints / 2)
     ], %)
  |> arc({
       angle_start: -angleEnd,
       angle_end: angleEnd,
       radius: propR
     }, %)
  |> angledLine({
       angle: angleEnd + 180,
       length: propR - portR
     }, %)
  |> arc({
       angle_start: angleEnd,
       angle_end: portAngle,
       radius: portR
     }, %)
  |> xLine(starDepth, %,$c1)
  |> yLine(-starWidth, %,$c2)
  |> xLine(-starDepth,%,$c3)
  |> arc({
       angle_start: 360-portAngle,
       angle_end:  360-angleEnd,
       radius: portR
     }, %)
  |> close(%)
  |> extrude(length, %)
  |> fillet({
    radius: 0.1,
    tags: [getPreviousAdjacentEdge(c2), getPreviousAdjacentEdge(c1)]
  }, %)

  // |> patternCircular3d({
  //   arcDegrees: 360,
  //   axis: [0, 0, 1],
  //   center: [0, 0, 0],
  //   repetitions: starPoints-1,
  //   rotateDuplicates: true,
  // }, %)
jessfraz commented 2 months ago

closing its covered in engine by this issue https://github.com/KittyCAD/engine/issues/2467