Extended Archimedean Spiral Module

While designing a pancake-primary mounting fixture for a Musical Tesla Coil, I needed to generate an Archimedean Spiral to simulate the location of the primary wire in the fixture. I found the Archimedean Spiral Module here on Thingiverse and it was a great starting point. However, it only starts at an initial radius of 0 and only lets you specify the final radius, which led to wrong spacing and positioning for my application.
Instead, I needed to be able to give a starting radius and a spacing for the spirals, and add an arbitrary start angle to rotate it to the correct angle for the fixture. So I modified the module and created this Extended Archimedean Spiral Module.
This module contains the archimedean_spiral_ex()
function with the following parameters:spirals
= how many spirals (positive=CCW, negative=CW), can include partial spiralsthickness
= how thick you want the arms to bestartradius
= beginning radius positionspacing
= spacing between radial pointsstartangle
= angle to begin first sweepcenter
= 'true' centers the spiral arm thickness (default=true)
It incorporates the following changes from the original design:
- Arbitrary starting radius
- Specifying of the spiral spacing instead of final radius
- Arbitrary start angle
- Rounding of the end-points to the nearest
$fa
angle to allow for fractional rotations without drawing it weird - Centering option to center the specified thickness of the spiral arms
- Ability to draw the spiral clockwise or counterclockwise by using a signed number for the number of spirals
UPDATE (9-18-2018) : Changed the polygon start and end position by $fa
so polygon always starts on the correct $fa
angle boundary.