Last active
April 11, 2018 02:40
-
-
Save brendandawes/4607642 to your computer and use it in GitHub Desktop.
OpenSCAD file for the Toy Rocket Construction Kit
This file contains 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
/* | |
Toy Rocket Construction Kit by Brendan Dawes | |
brendandawes.com | |
Nose cone isn't great but it suffices for now! | |
*/ | |
rocketRadius = 20; | |
connectorHeight = 5; | |
body(30); // height | |
//bodyWithWings(20,5,3); //height,number of wings, depth | |
//bodyWithScrews(10,10); //height, number of screws | |
//bodyWithRockets(30,5); //height, number of rockets | |
//bodyWithFueltanks(20,5); // height, number of fuel tanks | |
//bodyWithPortholes(20,3); // height, number of portholes | |
//noseCone(30); // height | |
module body(height) { | |
difference() { | |
union() { | |
cylinder(height,rocketRadius,rocketRadius,true); | |
translate([0,0,(height/2)+(connectorHeight/2)]) { | |
maleConnector(); | |
} | |
} | |
translate([0,0,-(height/2)+(connectorHeight/2)]) { | |
#femaleConnector(); | |
} | |
} | |
} | |
module bodyWithWings(height,depth,amount) { | |
body(height); | |
depth = min(height,depth); | |
multipleWings(amount,height,depth); | |
} | |
module bodyWithPortholes(height,amount) { | |
body(height); | |
difference() { | |
union() { | |
portholes(amount); | |
} | |
translate([0,0,-(height/2)+(connectorHeight/2)]) { | |
#femaleConnector(); | |
} | |
} | |
} | |
module bodyWithRockets(height,amount) { | |
difference() { | |
union() { | |
body(height); | |
rockets(height,amount); | |
} | |
translate([0,0,-(height/2)+(connectorHeight/2)]) { | |
#femaleConnector(); | |
} | |
} | |
} | |
module bodyWithFueltanks(height,amount) { | |
body(height); | |
fueltanks(height,amount); | |
} | |
module bodyWithScrews(height,amount) { | |
body(height); | |
screws(amount); | |
} | |
module noseCone(height) { | |
difference() { | |
union() { | |
cylinder(height,rocketRadius,1,true); | |
} | |
translate([0,0,-(height/2)+(connectorHeight/2)]) { | |
#femaleConnector(); | |
} | |
} | |
} | |
// HELPERS | |
module roundedWing(h,depth) { | |
linear_extrude(height=5) | |
hull() | |
{ | |
translate([0,h-3,0]) #circle(3); | |
translate([depth,h-3,0]) circle(3); | |
translate([0,3,0])circle(3); | |
} | |
} | |
module rockets(height,amount) { | |
for (i = [0:amount]){ | |
rotate([0,0,i*360/amount])translate([-rocketRadius,0,0]){ | |
cylinder(height,10,5,true); | |
} | |
} | |
} | |
module fueltanks(height,amount) { | |
for (i = [0:amount]){ | |
rotate([0,0,i*360/amount])translate([-rocketRadius,0,0]){ | |
cylinder(height,5,5,true); | |
} | |
} | |
} | |
module screws(amount) { | |
for (i = [0:amount]){ | |
rotate([0,0,i*360/amount])translate([-rocketRadius,0,0]){ | |
difference() { | |
union() { | |
sphere(3); | |
} | |
translate([-6,-3.5,-0.5]) { | |
#cube([5,7,1]); | |
rotate([90,0,0]) | |
translate([0,-3.5,-4]) | |
#cube([5,7,1]); | |
} | |
} | |
} | |
} | |
} | |
module portholes(amount) { | |
for (i = [0:amount]){ | |
rotate([0,0,i*360/amount])translate([-rocketRadius,0,0]){ | |
rotate([0,90,0]) { | |
difference() { | |
union() { | |
cylinder(3,8,8,true); | |
translate([0,0,4]) | |
sphere(8); | |
} | |
#cylinder(3,5,5,true); | |
} | |
} | |
} | |
} | |
} | |
module vents(height,amount) { | |
for (i = [0:amount]){ | |
rotate([0,0,i*360/amount])translate([-rocketRadius,0,0]){ | |
translate([0,0,-height/2]) | |
cube([5,10,height]); | |
} | |
} | |
} | |
module maleConnector() { | |
cylinder(5,rocketRadius-5.5,rocketRadius-5.5,true); | |
} | |
module femaleConnector() { | |
cylinder(5,rocketRadius-5.3,rocketRadius-5.3,true); | |
} | |
module multipleWings(amount,height,depth) { | |
for (i = [0:amount]){ | |
rotate([0,0,i*360/amount])translate([-rocketRadius,0,0]){ | |
translate([1,2.5,(height/2)]) { | |
rotate(a=[90,180,0]) { | |
roundedWing(height,depth); | |
} | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment