I once had a problem with OpenSCAD when I needed to sort - within model - objects of different kinds. The example sorting algorithm (a quicksort) is shown in the documentation, but it was working only with a particular kind of objects.
Long story short, OpenSCAD turned out to be powerful enough to have a Lisp written in it. Lisp manipulated strings and allowed factoring out the sorting algorithm and applying it with different comparison algorithms, supplied as parameters. Given Lisp, I think it's possible that a lot of things can be done in an OpenSCAD script.
I once had a problem with OpenSCAD when I needed to sort - within model - objects of different kinds. The example sorting algorithm (a quicksort) is shown in the documentation, but it was working only with a particular kind of objects.
Long story short, OpenSCAD turned out to be powerful enough to have a Lisp written in it. Lisp manipulated strings and allowed factoring out the sorting algorithm and applying it with different comparison algorithms, supplied as parameters. Given Lisp, I think it's possible that a lot of things can be done in an OpenSCAD script.