cone.scad
1 /** 2 * cone.scad 3 * 4 * @copyright Justin Lin, 2019 5 * @license https://opensource.org/licenses/lgpl-3.0.html 6 * 7 * @see https://openhome.cc/eGossip/OpenSCAD/lib3x-cone.html 8 * 9 **/ 10 11 module cone(radius, length = 0, spacing = 0.5, angle = 50, void = false, ends = false) { 12 module base(r) { 13 rotate_extrude() { 14 if(length != 0) { 15 square([r, length]); 16 } 17 polygon([ 18 [0, length], [r, length], [0, r * tan(angle) + length] 19 ]); 20 } 21 22 } 23 24 module head() { 25 if(void) { 26 base(radius + spacing); 27 } 28 else { 29 base(radius); 30 } 31 } 32 33 if(ends) { 34 head(); 35 mirror([0, 0, 1]) head(); 36 } 37 else { 38 head(); 39 } 40 }