KittyCAD / modeling-app

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

Modeling-App should Close a path and convert to Solid2d without close(%) #4271

Open gserena01 opened 2 days ago

gserena01 commented 2 days ago

Currently, a user needs to explicitly use close(%) in order to have a sketch be "closed" in the engine and converted to a Solid2D. Even though it's a quick and easy fix, this is confusing and not very intuitive for users (see https://github.com/KittyCAD/modeling-app/issues/3895#issuecomment-2416043184).

I propose that the modeling-app+engine close a sketch and convert to a Solid2D if the user extends the path to be within a certain tolerance of the start point.

adamchalmers commented 2 days ago

This would make it very difficult to add a type checker in the future, because lineTo() would return a different type (a 2d sketch or a 3d solid) depending on the specific point you gave it, and where the first point in the sketch was.

I'd be more open to, instead, allowing extrude to take either a solid or sketch, and if it's a sketch, extrude would attempt to close it first before extruding.

jgomez720 commented 2 days ago

lineTo() would return a 3d solid? Shouldn't it only ever return a sketch at the most? extrude, revolve, etc. should return the solid3d, no?

nrc commented 2 days ago

I wonder if instead of having a separate close function or implicitly closing, closing should be a property of the drawing function which physically closes the path?

So, the typical use case is draw a bunch of stuff, complete the path by calling lineTo(startingPoint()) (pseudo code, obviously) and then call close. There is duplication of intention here. What if instead we had a flavour of line (and arc, etc). which was lineToClose (straw-man name) which draws a line to the starting point (without having to extract the starting point from the path) and also closes the path (i.e., the input type is 'open path' and the output type is 'closed path').

Separately, I would like to look into these functions with many different 'flavour's to make finding and using them more ergonomic.