Created
December 23, 2017 19:06
-
-
Save jbeuckm/53499afbebc4a5cdc484cce77b36abeb to your computer and use it in GitHub Desktop.
Toy to be 3D printed for my daughter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flatten(l) = [ for (a = l) for (b = a) b ]; | |
module star(r, points=6, thickness=4) { | |
outerRadius = r; | |
innerRadius = r/2; | |
step = 360 / points; | |
halfStep = step / 2; | |
starListPairs = [ for (i = [0 : step : 360]) [[outerRadius*cos(i), outerRadius*sin(i)], [innerRadius*cos(i+halfStep), innerRadius*sin(i+halfStep)]] ]; | |
starList = flatten(starListPairs); | |
difference(){ | |
linear_extrude(5) | |
offset(r=thickness/2) polygon(starList); | |
translate([0,0,-1]) linear_extrude(9) | |
offset(r=-thickness/2) polygon(starList); | |
} | |
} | |
star(40, 6); | |
translate([0,-20,2.5]) rotate([90,0,0]) cylinder(r=2.5, h=150, $fn=24); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment