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

Starting sketches on faces defined in a function does not work. #3771

Closed
nadr0 opened this issue Sep 4, 2024 · 2 comments
Closed

Starting sketches on faces defined in a function does not work. #3771

nadr0 opened this issue Sep 4, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@nadr0
Copy link
Collaborator

nadr0 commented Sep 4, 2024

There are two problems

  1. The modeling app does not find the correct line of code to safely add the sketch on face from the result of a function call
  2. We do not guarantee that the function returns something you can sketch on

Starting file

fn iAmABox = (start, distance, plane) => {
  const box = startSketchOn(plane)
    |> startProfileAt([0, 0], %)
    |> line([start, 1], %)
    |> line([1, 0], %)
    |> line([0, -1], %)
    |> lineTo([profileStartX(%), profileStartY(%)], %, $seg01)
    |> close(%)
    |> extrude(distance, %)
  return box
}

const myCoolBox = iAmABox(0, 1.5, "XY")

Example after trying to sketch on a face

fn iAmABox = (start, distance, plane) => {
  const box = startSketchOn(plane)
    |> startProfileAt([0, 0], %)
    |> line([start, 1], %)
    |> line([1, 0], %)
    |> line([0, -1], %)
    |> lineTo([profileStartX(%), profileStartY(%)], %, $seg01)
    |> close(%)
    |> extrude(distance, %)
  return box
}

const sketch001 = startSketchOn(box, 'END')
  |> startProfileAt([0.16, 0.36], %)
const myCoolBox = iAmABox(0, 1.5, "XY")

This creates a new sketch001 with the variable name box from line 2 of the code instead of myCoolBox.

Example for second problem

fn iAmABox = (start, distance, plane) => {
  const box = startSketchOn(plane)
    |> startProfileAt([0, 0], %)
    |> line([start, 1], %)
    |> line([1, 0], %)
    |> line([0, -1], %)
    |> lineTo([profileStartX(%), profileStartY(%)], %, $seg01)
    |> close(%)
    |> extrude(distance, %)
  return distance
}

const myCoolBox = iAmABox(0, 1.5, "XY")

What if we returned the distance from the function then started the sketch on face; it would not be able to handle this.

@nadr0 nadr0 added the bug Something isn't working label Sep 4, 2024
@Irev-Dev
Copy link
Collaborator

Irev-Dev commented Sep 5, 2024

We are likely also going to need to change the way functions are defined to make argument default mandatory, in the above sketchMode is going to need some sane values for start, distance, plane before it's able to render the sketch, because when your editing something defined in a function, your editing the abstraction.

@nadr0 nadr0 added enhancement New feature or request and removed bug Something isn't working labels Sep 6, 2024
@nadr0
Copy link
Collaborator Author

nadr0 commented Sep 24, 2024

Closing this since this is a duplicate of #2207

@nadr0 nadr0 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants