Splines for OpenSCAD

Splines for OpenSCAD

cults3d

I was working on a project in OpenSCAD that needed smooth curves. I was excited to find some Bezier curve libraries, but as I used them I remembered why awkward thing about Bezier curves: they're hard to design with if you want precise control. You move a control point, and it pulls the curve one way, but it also affects other areas of the curve, so you have to nudge adjacent control points the other way to compensate, and then repeat forever. What I wanted was to tell OpenSCAD exactly where I wanted the curve to go, with a few points, and have it make a smooth curve passing between those points. That's a spline. I couldn't find any spline libraries for OpenSCAD. So I made this one. The main module, spline.scad, is directly usable with no other dependencies. Grab the zip file instead if you want to look at the examples, as they're dependent on a couple of other modules. Functionality included: spline ribbons - a 2D splined line with a given width spline walls - like a ribbon, but extruded to a given height Several varieties of spline noodles - shapes extruded along a splined path, including ramen (circular cross-section), udon (square cross-section), and sausage (OK, that's not a noodle, but it's a ramen noodle with rounded ends), plus a hose which knocks out the center of a ramen noodle to a predefined width. Both a regular lathed spline and a lathed pot, which is handy for making a thin-walled lathed object that must fit around something else (the initial motivation). Open and closed versions of most things - for open-ended curvy lines or closed loops. Several examples, pictured here. Limitations Sadly, the noodles look pretty great in the preview, much of the time, but the current OpenSCAD code chokes on them while rending with internal assertion failures, especially if you do Boolean operations with other shapes. The other shapes compile fine, though, and reasonably quickly. Also, the approach to cross-section orientation I'm using in the lofting algorithm sometimes breaks at sharp transitions. Some of this could be fixable without changing the interface; some of it may require manually specifying normal vectors at each path point. I'll work more on that. I welcome your input if you want to work on these problems. Feel free to fork the code from my GitHub. Also: I developed this using OpenSCAD 2016.02.09 and it uses some recent features, so it won't be compatible with older versions. OpenSCAD has been backward-compatible in my experience; if anyone has a reason to prefer an older version, I'd like to hear about it.

Download Model from cults3d

With this file you will be able to print Splines for OpenSCAD with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Splines for OpenSCAD.