-
Notifications
You must be signed in to change notification settings - Fork 45
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
SketchGroup should allow multiple profiles #1876
Comments
Since a user might want any sketch/2D geometry to be construction geometry, would it make sense to have it as a
Or would that cause other problems? I'm seeing if there's a way to avoid making |
Another thought: if we're going to support multiple profiles it might help readability to rename |
So the ask is:
I don't really know what you want for construction geometry yet.
So I think construction geometry should be out of scope for this, let's do it in #1553 instead. |
@franknoirot can profiles within a sketch group be extruded independently? Or are they all extruded/rotated at once, with the same parameters? |
@adamchalmers they should be able to be extruded independently if we are to match behavior with existing CAD programs. Sketches are a collection of profiles, some of which are closed and therefor eligible for use in 3D geometry operations like Extrude and Sweep. Here's an example of this behavior from OnShape: Screenshare.-.2024-05-29.2_55_08.PM-compressed.mp4 |
OK, so clarifying question: in what way are the profiles within a SketchGroup related? Why not just make two separate SketchGroups? |
The profiles in a SketchGroup are related by dimensions and constraints between the profiles and their constituent elements. Doing a number of sketch operations become significantly more tedious if each closed profile is its own sketch:
|
I agree with Franks points. Construction geometry doesn't need to be sent to the engine. I'm not sure about the independently extrude thing, I think it might be a good to check with @jgomez720. Not extruded independently
Extruded independently
|
Profiles should be able to be extruded independently. When that happens, typically the designer created a profile as a reference (really similar to the purpose of construction geometry). This is a complex example, but gears are really hard without construction geometry. Even if you skim through the video, you'll see how often he creates a profile to reference off of, and then deletes it afterward (deleting a construction geometry after using it is a bad practice) |
I feel like if you draw two profiles A and B, and A is inside B, and you want them subtracted from each other, then the frontend code generation should generate KCL that uses the This way you wouldn't need a rule like "generally, extrude profiles independently, but if one encloses the other then treat it as a subtraction". You could have the simpler "always extrude profiles independently" (though some profiles will have holes). |
Just one small point @Irev-Dev:
Onshape doesn't alternate nested profiles as extrude/void; only the outer-most is extruded and the user opts into any nested profiles by clicking. Screenshare.-.2024-06-13.8_26_02.PM.mp4 |
I really like that idea @adamchalmers. I think using those profiles in that generated code with |
Frank and I talked about this a bit in length and honestly I think the multi-profile code the way it is is extrememly hard to read and not user friendly. Instead if you look in on shape when you edit a "sketch" the shared commonality for that sketch is the "plane" so we should allow anyone to edit any sketchgroup on that same plane versus our one sketchgroup per edit we have now. I feel like this is a problem with the constraint we put on ourselves for one sketch per edit/create mode versus being a code issue. ill show what im talking about. Screenshare.-.2024-06-21.1_52_59.PM.mp4I will try and take a look at where that forced requirement of one sketchgroup per edit/create mode is but if you've got ideas @franknoirot or @Irev-Dev let me know but i def think this is a better approach |
@Irev-Dev's original idea is still what makes the most sense to me. Even if two sketches share the same plane, that does not mean they are used for similar processes Screenshare.-.2024-06-21.3_15_55.PM.mp4This really only touches on the multiple profiles part. Nothing about the construction geometry stuff. |
I promise i think we want the same things here just I feel strongly the code as an artifact of the first idea is completely unreadable and maintainable and will get out of hand quickly so we need some sort of middle ground here, but like if we do this code it will deflect MEs from learning to code. But i think we are saying the same thing, let me show you, the semantic is just can I edit it in here, and can I not. They would not be combined sorry let me make this more clear. But i think we are saying the same thing. Screenshare.-.2024-06-21.3_35_14.PM.mp4 |
the main difference between what you are doing and what i am doing is youd be able to edit all three of those sketches on the same plane at the same time versus being constrained to the ones you explicitly put in a sketch which I dont think should matter it kinda seems like a feature but maybe im wrong |
Okay, I see what you are saying. I am fine with the idea, but I do have one more artifact in my devils advocate toy box. I'll show in video one sec |
and this doesnt block the extruding at the same time it would just be like
|
i am glad! sorry im also only getting heated not because im like mad just becasuse im into finding a better solution here haha and im hoping the you can edit them all at the same time is a win versus a blocker |
also now i really like the idea of this
where then the sketch is a vec of profiles, i like that! for some reason this code doesn't work today but I can fix it , in thoery it should very weird |
Screenshare.-.2024-06-21.3_51_54.PM.mp4 |
Ok wait i gotchu i gotchu 1 sec |
also this is fun you likely think im insane but i like this hahah in general the discussion ahaha Screenshare.-.2024-06-21.3_59_23.PM.mp4 |
also we could call it a surface for sketch on face too:
so then its clear shared surfaces can be added or edited together, so if you sketch on a face the same goes |
we could also do something cool and fade out all the code from other "surfaces" so you can see it but its lighter when in edit mode so its clear you just changing code for this surface |
so then if i wanted to do a cut out it would generate like:
|
I'm on board, From the get-go, I preferred these proposal's API, and in fact the only reason I wanted to pipe forever with sketches is because of what I thought were pragmatic reasons around re-executing to keep code as the source of truth and the fact that in sketch mode we also make a new mini-ast for perf reasons so that when we re-execute it's not having to do all the geometry again. I'm brushing over it, but I had a quick chat with Jess to sanity check my thoughts. The main case I was worried about was something like const plane = startSketchOn('XZ')
const profile = startProfileAt([1.01, 0.93], plane)
|> line([1.63, 1.25], %)
|> line([2.69, -0.6], %)
|> line([-0.01, -2.85], %)
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
const profile2 = startProfileAt([6, 0.93], plane)
|> line([2.14, 1.77], %, 'seg01')
|> line([2.69, -0.6], %)
|> angledLine([
-90,
segLen('seg01', %) * segLen('seg01', %) / 2
], %)
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
const extrude001 = extrude(5, profile2)
const profile3 = startProfileAt([2, 3], plane)
|> line([1.63, 5], %)
|> line([4.85, -3.14], %)
|> line([4.85, getExtrudeVolume(extrude001)], %) emphasis on One other final thing I'll note is that this is our language and we can do whatever we want with it, and infact originally in the language before we swapped it out for plain old pipes we had something like something like const mySketch = sketch {
const profile001 = surface001
|> startProfileAt([40.82, 240.82], %)
|> line([235.72, -8.16], %)
|> line([13.27, -253.07], %)
|> line([-247.97, -19.39], %)
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
const profile002 = surface001
|> startProfileAt([47.17, -71.91], %)
|> line([247.96, -4.03], %)
|> line([-17.26, -116.79], %)
|> line([-235.87, 12.66], %)
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
} That is a keyword
That would be a bigger change, but something to consider. |
There's going to be some confusion with the three-level approach from those that come from traditional CAD. Users are used to sketch -> profiles. Not sketch -> surface -> profile. However, none of those programs are code as source of truth, so I'm on board if it means make the code easier to understand. I've been trying to think of ways to break it, but either it's too early for my brain or I can't think of anything. This is really clear to me @Irev-Dev. It won't be clear for users until they start using the sketch tool more. As the code generates while they create multiple profiles, they'll get it, but expect a learning curve at first if we go this route const mySketch = sketch {
const profile001 = surface001
|> startProfileAt([40.82, 240.82], %)
|> line([235.72, -8.16], %)
|> line([13.27, -253.07], %)
|> line([-247.97, -19.39], %)
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
const profile002 = surface001
|> startProfileAt([47.17, -71.91], %)
|> line([247.96, -4.03], %)
|> line([-17.26, -116.79], %)
|> line([-235.87, 12.66], %)
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
} |
Hey hey I have a little draft mockup of something related to this here in Figma (obviously not including the code tweaks discussed here which I like): |
I think a sketch would be a vec of profiles, just a thin group, but where the piping with And the user selects the region between them... The resulting extrusion would look something like this: const surface001 = startSketchOn(‘XY’)
const profile001 = surface001
|> rectangleFromCenter({
center: [0, 0],
width: 20,
height: 10,
})
const profile002 = surface001
|> circle([0, 0], 5)
const sketch001 = [
profile001,
profile002
]
const extrude001 = extrude(
22.5,
profile001 |> hole(profile002)
) or if we wanted to show the user that we were making a region more clearly... const surface001 = startSketchOn(‘XY’)
const profile001 = surface001
|> rectangleFromCenter({
center: [0, 0],
width: 20,
height: 10,
})
const profile002 = surface001
|> circle([0, 0], 5)
const sketch001 = [
profile001,
profile002
]
const sketchRegion001 = profile001 |> hole(profile002)
const extrude001 = extrude(
22.5,
sketchRegion001
) |
A video walking through this flow:
Screenshare.-.2024-06-24.6_17_37.PM-compressed.mp4 |
I should also note that I found a CodeMirror extension to make certain ranges read-only, so once we make a sketch surface its own top-level constant we can just make that line read-only with it. |
Throw that on the thread with Marijn so we can make sure it's good :) he might suggest implementing our own |
Marijn recommended against that extension in favor of making our own change filter, which is a direct CodeMirror utility. But that'd be better as its own issue. |
relevant to #2931 |
We want to support having multiple profiles in the one sketch, (outer and inner loop).
The kcl code would be as simple as having more than one
startProfileAt
.But on top of that we also want to support "construction geometry", the concept here is that it's 2d geometry that you can reference in your sketch, but is not necessarily part of your profile for example.
Example code aside we'll need to change the sketch group struct, something like this would work.
The text was updated successfully, but these errors were encountered: