I recently been giving some love to a library I wrote to help with radii in
OpenSCAD. Personally, the library is pretty bound to how I think about cading parts now, I like to think it both helps with adding fillets as well as leveraging the battle test paradigm of extruding from sketches of other cad packages since it heavily uses polygons. There are a number of function/modules, but the main api is <http://forum.openscad.org/file/t1892/easyapi.png> Though with some of the more recend editions I've been diving into polyhedrons in order to round the end of polygons. <http://forum.openscad.org/file/t1892/polyRoundextrude.png> The feature list can be found here: https://kurthutten.com/blog/roundanythingapragmaticapproachtoopenscaddesign/ Github repo: https://github.com/IrevDev/RoundAnything And originally I posted a thread here about it and got some really useful feedback: http://forum.openscad.org/RoundedPolygontd21897.html I would love to hear your thoughts/feedback.  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
I am very interested in rounding and your original library inspired me to
write a bunch of rounding functions, some of which are similar to yours. Take a look at: https://github.com/revarbat/BOSL2/wiki/rounding.scad The BOSL2 library also has rounding parameters to cuboid() and cyl() and reguar_ngon() to produce these basic shapes with rounding already applied. I find this general capability indispensable and use the various rounding features in the BOSL2 rounding library all the time. I took a look at your listed examples and am curious what "point translation helpers" does. Also, what is the difference between polyRoundExtrude and radius extrude? I implemented something called offset_sweep that is similar to this, though it takes arbitrary curves for the ends instead of just fillet or roundover. You might want to show code examples on your page so people can really see the API.  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
Oh dam,
Nice, looks like some good functionality there. Glad to see my work live on in another library. Sorry you had to dig through my code. I think/hope I've improved since then. Some of your example smoothing in 3d is really nice. I do have some examples of the api here: https://kurthutten.com/blog/roundanythingapi/ And up offset_sweep looks like it very similar to extrudeWithRadius, the difference between that and polyRoundExtrude is the latter uses polygon point (or radiiPoints) instead of a 2d child. It make it less flexible 2d children certainly cover more cases. Though by using polygon points directly mean it's able to make the shape using the polyhedron and it makes it much more performant, and I don't have to use the step method of extruding small slices with offset. Here's a gif of the fn value changing. It makes for a much smooth transition at much lower values of fn as well since there are no steps. https://twitter.com/IrevDev/status/1292223481728208897  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
I think I understand: you're using a stairstep type construction to create
the shape with extrudeWithRadius and you're constructing a polyhedron for polyRoundExtrude. My offset_sweep() will take any polygon, extrude it, and add rounding (or some other end treatment) to either end. It sounds like it's the same method as your polyRoundExtrude. I compute offsets of the input polygon and use them to construct a polyhedron. The real challenge in doing this was in writing an offset() function, and book keeping when points disappear during offset. (It's very hard to write a robust offset function.) I also have convex_offset_extrude, which is like your stairstep approach but it uses hull to make slices with sloped boundaries. This means it won't work on concave children. (Well, it will hull them.) I never thought the stairstep modeling approach was acceptable. What do you see as the missing functionality for rounding? What do you wish you could do but you can't?  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
Yup, stairstep. I did try the hull as well, but preferred the stairstep
over loosing the ability to use concave children. 👍 I don't have anything in mind that's missing. Some times I wish the polygon could be used more like a "sketch" in other cad packages, where you could add constrains instead of defining every point, but that's got nothing to do with rounding.  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
On 16.08.20 22:05, irevdev via Discuss wrote:
> Some times I wish the polygon could be used more like > a "sketch" in other cad packages, where you could add > constrains instead of defining every point, but that's > got nothing to do with rounding. How would you extend the language to express that? ciao, Torsten. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
 Torsten

In reply to this post by OpenSCAD mailing list2
I'm not familiar with this "sketch" feature. What is it? How does it work?
OpenSCAD mailing list2 wrote > I don't have anything in mind that's missing. > > Some times I wish the polygon could be used more like a "sketch" in other > cad packages, where you could add constrains instead of defining every > point, but that's got nothing to do with rounding.  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
I do rounding for cubes by hull()ing around spheres placed at the corners (pulled in by the rounding radius, so my rounded cube has coplanar faces with a regular cube). Is your method faster than this? On Sun, Aug 16, 2020 at 6:42 PM adrianv <[hidden email]> wrote: I'm not familiar with this "sketch" feature. What is it? How does it work? _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
I'm not sure who you're addressing here, or which method, exactly. Creating
a rounded cube by hulling spheres is a good method, and perhaps the fastest way to do that job. I haven't done any time testing on this. You don't need sophisticated rounding if you want to create a rounded cube. The intention of my rounding library (and the other one mentioned) is to apply rounding in more sophisticated ways, to more complex objects. What if you want only parts of the cube rounded? (Probably your approach still works...in some form...but it begins to get complicated.) What if you want a concave object with rounding? You cannot round a concave polygon with hull. What if you want a cube that is rounded at one end and flared out at the other end for a smooth transition onto a plane? I actually implemented a large polyhedron library that will compute all of the platonic, archimedean and catalan solids. And I could not figure out a correct way to round these solidsthe method I implemented fails on the catalan solids. Doing this as a hull of spheres is difficult because it's hard to figure out where to put the spheres. drxenocide wrote > I do rounding for cubes by hull()ing around spheres placed at the corners > (pulled in by the rounding radius, so my rounded cube has coplanar faces > with a regular cube). > > Is your method faster than this? > > On Sun, Aug 16, 2020 at 6:42 PM adrianv < > avm4@ > > wrote: > >> I'm not familiar with this "sketch" feature. What is it? How does it >> work? >> >> >> OpenSCAD mailing list2 wrote >> > I don't have anything in mind that's missing. >> > >> > Some times I wish the polygon could be used more like a "sketch" in >> other >> > cad packages, where you could add constrains instead of defining every >> > point, but that's got nothing to do with rounding. >> >> >> >> >> >>  >> Sent from: http://forum.openscad.org/ >> >> _______________________________________________ >> OpenSCAD mailing list >> > Discuss@.openscad >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by drxenocide
drxenocide, Your hulled sphere's sounds fine. Though I think it becomes
difficult for more complex shape is all. I'm not sure about speed. Adrianv, sketching is very common in cad packages. See this video from about 10s to 40s he makes a sketch https://www.youtube.com/watch?v=CbPIs4MzvzU. Basically a bunch of points and he adds constraints by adding dimensions, though not all are dimensions. At one point he selects two lines and constains them to be the same length. Other things that are common is defining a line to be vertical or horizontal, or constrain two lines to be parallel. tpv, not sure. I did play with an experimental API like this <http://forum.openscad.org/file/t1892/experimental.png> Where "L" means take the value from the previous point, and the last line of the polygon is defining that's it's supposed to be 45 from the Y axis and each letter of "ayra" means something, maybe like absolute y . . I can't remember. Obviously it could be cleaned up but I figure it a) doesn't shine a light on normal sketches and b) is cumbersome. Ultimately sketching is a GUI tool and not sure it can be translated to code in an intuitive way.  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
OpenSCAD mailing list2 wrote
> Adrianv, sketching is very common in cad packages. See this video from > about > 10s to 40s he makes a sketch https://www.youtube.com/watch?v=CbPIs4MzvzU. > Basically a bunch of points and he adds constraints by adding dimensions, > though not all are dimensions. At one point he selects two lines and > constains them to be the same length. Other things that are common is > defining a line to be vertical or horizontal, or constrain two lines to be > parallel. This doesn't really fit the OpenSCAD framework at all. If you want to lines the same length...you define them to be the same length. I liked it when he just selected some edges and rounded them over. > tpv, not sure. I did play with an experimental API like this > <http://forum.openscad.org/file/t1892/experimental.png> > Where "L" means take the value from the previous point, and the last line > of > the polygon is defining that's it's supposed to be 45 from the Y axis and > each letter of "ayra" means something, maybe like absolute y . . I can't > remember. Obviously it could be cleaned up but I figure it a) doesn't > shine > a light on normal sketches and b) is cumbersome. Ultimately sketching is a > GUI tool and not sure it can be translated to code in an intuitive way. There is the concept of turtle graphics, like move forward 10, turn left 100 deg, move forward until y=3, etc. I implemented something like this and find it pretty useful.  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
[Sketch] One could imagine having a way to describe a figure and its constraints in the form of a data structure, and having a solver that would analyze the data structure to find a figure that satisfies the constraints. Something like: I think there are two solutions to those constraints: [0,0,0][10,0,0][10,20,0] and [0,0,0][10,0,0][10,20,0]. (Maybe only the Y one, if the ANGLE rule follows the righthandrule.)poly = solve([ [ ABS, 0, [0,0,0] ], // Point 0 is at the origin [ REL, 1, 0, [10,0,0]], // Point 1 is +10 X from point 0 [ LENGTH, [1,2], [0,1], 2], // The distance from point 1 to // point 2 is twice the distance // from point 0 to point 1. [ ANGLE, [0,1,2], 90 ], // The angle between points 0, 1, and 2 // is 90 degrees. [ ABS, 2, [undef,undef,0] ] // Point 2 is on the Z=0 plane. ]); I don't know how hard it is to create such a solver. (It would depend of course on what rules are allowed.) Probably too hard for me. I don't know whether anybody would really be interested in such a thing in OpenSCAD. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
That seems like a reasonable api JordanBrown, But yeah not sure if it suits
OpenScad.  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by JordanBrown
It seems like if you allow a specific limited class of rules that operate
sequentially then it is not hard to do this. The point basically is that for every rule you need to ask if you can solve the relevant equation it implies. This actually seems a lot like the turtle graphics concept but without the turtle state or order: at every step you create a new point based on a previous point using some kind of instruction. I am wondering whether this scheme is significantly more powerful than my turtle implementation. I think the main possible source of extra power in this system is the ability to refer back to previously generated points, but I can't tell if that really lets you do anything different. If you don't require a sequential process then it is going to get a lot harder, because the equations will form a large coupled nonlinear system. A general solver might be able to find a solution, but finding all solutions will be hard to do, and the process may not be robust. And of course there may be no solutions, or an infinite set of solutions. If someone gave me this capability as a black box, how would I use it? It seems likely that this is going to be hard to use as a practical tool for constructing shapes. JordanBrown wrote >> [Sketch] > > One could imagine having a way to describe a figure and its constraints > in the form of a data structure, and having a solver that would analyze > the data structure to find a figure that satisfies the constraints. > > Something like: > > poly = solve([ > [ ABS, 0, [0,0,0] ], // Point 0 is at the origin > [ REL, 1, 0, [10,0,0]], // Point 1 is +10 X from point 0 > [ LENGTH, [1,2], [0,1], 2], // The distance from point 1 to > // point 2 is twice the distance > // from point 0 to point 1. > [ ANGLE, [0,1,2], 90 ], // The angle between points 0, 1, and > 2 > // is 90 degrees. > [ ABS, 2, [undef,undef,0] ] // Point 2 is on the Z=0 plane. > ]); > > I think there are two solutions to those constraints: > [0,0,0][10,0,0][10,20,0] and [0,0,0][10,0,0][10,20,0]. (Maybe only > the Y one, if the ANGLE rule follows the righthandrule.) > > I don't know how hard it is to create such a solver. (It would depend > of course on what rules are allowed.) Probably too hard for me. > > I don't know whether anybody would really be interested in such a thing > in OpenSCAD. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
On 8/18/2020 6:03 AM, adrianv wrote:
It seems like if you allow a specific limited class of rules that operate sequentially then it is not hard to do this. The point basically is that for every rule you need to ask if you can solve the relevant equation it implies. This actually seems a lot like the turtle graphics concept but without the turtle state or order: at every step you create a new point based on a previous point using some kind of instruction. I am wondering whether this scheme is significantly more powerful than my turtle implementation. I think the main possible source of extra power in this system is the ability to refer back to previously generated points, but I can't tell if that really lets you do anything different. If you don't require a sequential process then it is going to get a lot harder, because the equations will form a large coupled nonlinear system. A general solver might be able to find a solution, but finding all solutions will be hard to do, and the process may not be robust. And of course there may be no solutions, or an infinite set of solutions. If someone gave me this capability as a black box, how would I use it? It seems likely that this is going to be hard to use as a practical tool for constructing shapes. What I was intending to describe  and what I *think* these tools do  is the latter. I wrote out the rules more or less sequentially, because that's how I was mentally constructing the figure, but the intent was that they were an unordered set of constraints on the various points. It's a very different way of thinking of design from the much more concrete "transform a shape" model that OpenSCAD uses. As I said, it's not clear to me that there would be an audience for it in the OpenSCAD context. I was just trying to describe how a tool like this could be carried over to an OpenSCAD environment. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
Free forum by Nabble  Edit this page 