178.

spiral_extrude() by AKADAP

www.thingiverse.com/thing:1958354

This is a library function that fits between linear_extrude() and rotate_extrude(). It takes a 2D object and extrudes it in a spiral. Unlike linear_extrude, the 2D object is perpendicular to the path of the extrusion.This would have been much easier if OpenSCAD would allow me to access the points that make up the 2D objects the function is operating on.Comment out the example before using this as a library. I left it uncommented so that Thingiverse would show a picture of the example.Update: I found a bug where when the radius was less than 20, it would fail to generate anything. I found that the calculation inside the asin() function was resulting in 1+1e-14 which is not allowed for the asin() function, so it was returning nan. I have limited the result to a range of -1 to 1 to fix the problem.Update 2: Adjusted the size of the spiral segments so the segments slightly overlap (eliminates gaps in spiral). Added render() to segment because OpenSCAD was complaining of too many objects, and getting slow. Changed atan() to atan2() to avoid potential divide by zero. Added version number to file. (this version is 1.2).Update 3: I added the capability of doing flat spirals. I also found that the Starts variable was not working. I got that fixed. This is version 2.0The tapered spirals are not as smooth as I'd like.I'm also thinking of re-implementing this in a more generic way.I recorded a screen capture as I updated the file: videoThe image and STL file are the test objects in the library. If you import the library with the "use" function, these test objects will not be included.Update 4: I can't seem to leave this one alone. I re-implemented the spiral extrusion as extrude_spiral() and made a wrapper function named spiral_extrude() that calls extrude_spiral() for backswords compatibility. I did this because the previous design did not handle the equivalent of rotate_extrude() (the way it is documented with the Angle parameter instead of the existing function that only does complete circles). I also fixed a bug where the spiral was always an integer number of segments and ended up taller than requested.Update 5: Updated to version 3.1. I found and fixed a bug where the extruded object would extrude one more step than requested. From this point forward, extrude_spiral() is the preferred format, and spiral_extrude() remains as a wrapper of extrude_spiral for backwards compatibility. I hope I am done with this, and that this becomes obsolete when the next version of OpenSCAD is finally released.