Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web-app broke while editing kcl #5383

Open
mlfarrell opened this issue Feb 13, 2025 · 0 comments
Open

web-app broke while editing kcl #5383

mlfarrell opened this issue Feb 13, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@mlfarrell
Copy link
Contributor

current kcl code some variant of:
was editing around line 19

fn square(x, y, l, prevSegment, theta) {
  pl = if l > 0.0001 {
    l - 0.05
  } else {
    0.1
  }

  squareSketch = startProfileAt([x, y], prevSegment)
    |> angledLine({ angle = theta, length = pl }, %)
    |> angledLine({ angle = theta + 90, length = pl }, %)
    |> angledLine({ angle = theta + 180, length = pl }, %)
    |> angledLine({ angle = theta + 270, length = pl }, %)
  return squareSketch
}

fn box(plane, start, l, lMin) {
  x = start[0]
  y = start[1]
  box = startSketchOn(box, )
    |> square(x, y, max(l, lMin), %, 0)
  // |> extrude(length = max(h,hMin))
  return box
}

width = 3
blocksize = 3 / 5
height = 0.5
//nCol = 33
//nRow = 33
nCol = 5
nRow = 5
data = [
  1, 1, 1, 0, 0, 0, 1, 0,
  1, 1, 0, 1, 1, 0, 0, 0,
  0, 0, 1, 0, 0, 1, 0, 1,
  1
]

backing = startSketchAt([-0.1, 1.0])
  |> xLine(width + 0.1, %)
  |> yLine(-width - 0.5, %)
  |> xLine(-width - 0.1, %)
  |> close()
  |> extrude(length = -height)

nTotal = nCol * nRow // 
maxIndex = nTotal - 1
index = [0..24] // FORCED TO HARDCODE
emptySG = startSketchAt([0, 0])
reduce(index, emptySG, fn(i, QR) {
  row = floor(i / nCol)
  col = i - (row * nCol)
  box("XY", [col * blocksize, -row * blocksize], data[i] * blocksize, .0001 * blocksize)
    |> extrude(length = (-height * 0.5) * max(data[i], 0.0001))
  return QR
})

console attached separately

console.log

@mlfarrell mlfarrell added the bug Something isn't working label Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant