Nabble removed Mailing-list integration from the Forum.
This killed the Forum. This is now an ARCHIVE.
It is likely Nabble will shutdown in the future.

So basically the Forum is now out of date, we are looking into migrating the history.

OpenSCAD support is now provided by the Mailing List.
See the first pinned post here for instructions on subscribing to the mailing list.

path construction

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

path construction

dinther
I have made several attempts to build some generic code that makes it easier to construct 2D shapes. Mostly guided by the SVG path syntax.

Such a syntax is a sequence and therefore order and tracking state is essential, exactly something openSCAD is designed NOT to do unless you wish to burn out your braincells with recursive logic. That is not an option anyway because the code would look horrible.

Is there any way, any suggestion how I can cleanly create a 2D path involving fillets, arcs, straight segments and splines using nice clean code that doesn't involve boolean shape operations?

What I want is pseudo code like this:

startPath(20,20); //starts empty point array
h(10); //relative 10 units along x axis
V(10); //absolute 10 units along y axis
a(r=10, to=[0,-20]); // arc with a radius of 10 ending at relative x 0 and y -20
points = end();
polygon(points);

//creates a rivet outline with a rounded head

I know there are many purists driving openSCAD along and I respect and appreciate the energy you put into this. But if I can't use programming logic I used for decades, or at least do stuff like this somehow, I am outta here because I spend way too much time wrangling code to do want I want it to do.

Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: path construction

RevarBat
Sounds like turtle() in BOSL2. Or maybe the bezier path construction functions. 


-Revar


On Apr 3, 2021, at 7:53 PM, dinther <[hidden email]> wrote:

I have made several attempts to build some generic code that makes it easier to construct 2D shapes. Mostly guided by the SVG path syntax.

Such a syntax is a sequence and therefore order and tracking state is essential, exactly something openSCAD is designed NOT to do unless you wish to burn out your braincells with recursive logic. That is not an option anyway because the code would look horrible.

Is there any way, any suggestion how I can cleanly create a 2D path involving fillets, arcs, straight segments and splines using nice clean code that doesn't involve boolean shape operations?

What I want is pseudo code like this:

startPath(20,20); //starts empty point array
h(10); //relative 10 units along x axis
V(10); //absolute 10 units along y axis
a(r=10, to=[0,-20]); // arc with a radius of 10 ending at relative x 0 and y -20
points = end();
polygon(points);

//creates a rivet outline with a rounded head

I know there are many purists driving openSCAD along and I respect and appreciate the energy you put into this. But if I can't use programming logic I used for decades, or at least do stuff like this somehow, I am outta here because I spend way too much time wrangling code to do want I want it to do.

Sent from the OpenSCAD mailing list archive at Nabble.com.
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: path construction

dinther
Yeah, I had seen turtle. I am all for clean robust code but looking at the turtle syntax that really looks like a kludge due to the way the language works.

The bezier example looks intriguing but it is still array based.

Practically everything I build is based on extruded polygons joined together with a bunch of boolean operations.

I think the functional language is holding OpenSCAD back and that is a real pity. I am going to see how openjscad hangs together and make that work for me by writing a library for it. (Strange incidentally that openjscad.org site has vanished.)



Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]