I just spent the afternoon implementing OpenSCAD 2D path/pathlist function builtins for:
I have those done, and they are all implemented with ClipperUtils. They all can take a 2D path or a region made up of a list of 2D paths for any of the pathlist arguments. And they will all reject malformed paths/regions. I avoided naming them the same as their geometry equivalents to avoid confusion.
I'm currently working on offset_paths(), and I've run into an odd little quirk of functions in OpenSCAD:
Every single function builtin uses positional args instead of named args. Every Single One. This means that in search(), the num_returns_per_match= must always be the 3rd argument, and index_col_num= must always be the 4th.
For offset_paths(), I want to be able to specify r= or delta= and chamfer=. In builtin modules, it looks like it sets up a ContextHandle<Context> to use lookup_variable() to get named args, but it is unclear to me if this is allowed in a builtin function. IS that how it would be done?
Okay, I got the boolean paths built-ins all working in a couple afternoons of
work. Most of my time was trying to get OpenSCAD to compile on my OS X
system. I gave up, created a Linux VM, and set up a build environment
there. That was far, far easier.
Anyways, I made a PR for it at
https://github.com/openscad/openscad/pull/3288
--
Sent from: http://forum.openscad.org/