Last active
October 22, 2019 02:30
-
-
Save tinkerology/4a56b174b190655b2797988c56d2c5ed to your computer and use it in GitHub Desktop.
Fully 3D printable pinewood derby car body #ERRF2019
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
$fn=15; | |
MM_PER_INCH=25.4; | |
function calcScale(scaleFactors, count, iteration) = | |
scaleFactors[0] + | |
(( scaleFactors[1]-scaleFactors[0]))*iteration/count; | |
// General routine to make organic shapes by rotating, | |
// scaling and translating the child objects iteratively. | |
module hullSweep(steps, rotation, offsetTo, scaleFactors) | |
{ | |
for ( i= [0:steps-2] ) | |
{ | |
scaleAmt1 = calcScale(scaleFactors, steps, i); | |
scaleAmt2 = calcScale(scaleFactors, steps, i+1); | |
hull() | |
{ | |
rotate(rotation*i) | |
translate(offsetTo*i) | |
scale([scaleAmt1,scaleAmt1,scaleAmt1]) | |
children(); | |
rotate(rotation*(i+1)) | |
translate(offsetTo*(i+1)) | |
scale([scaleAmt2,scaleAmt2,scaleAmt2]) | |
children(); | |
} | |
} | |
} | |
// Flatten the children of this module at the | |
// given Z height. | |
module flatten(zHeight) | |
{ | |
intersection() | |
{ | |
children(); | |
translate([-500,-500,-1000+zHeight]) | |
cube([1000,1000,1000], center=false); | |
} | |
} | |
// Make a simple one twist horn | |
module hornOneTwist() | |
{ | |
hullSweep(200,[0,0,2],[.03,.03,.15],[5,1]) | |
scale([1,2,1]) | |
sphere(1); | |
} | |
// raptor claw | |
module clawRaptor() | |
{ | |
flatten() | |
rotate([45,0,0]) | |
translate([100,0,0]) | |
hullSweep(40,[0,0,3],[1,0,1.5],[10,0]) | |
union() | |
{ | |
sphere(1); | |
translate([4,0,0]) | |
sphere(1.5); | |
} | |
} | |
// Make a shadow box that shows the official dimensions | |
// of a pinewood derby car | |
module drawPinewoodShadow() | |
{ | |
CAR_BODY_LENGTH = 7 * MM_PER_INCH; | |
CAR_BODY_WIDTH = 1.75 * MM_PER_INCH; | |
CAR_HEIGHT = 5 * MM_PER_INCH; | |
#cube([CAR_BODY_LENGTH,CAR_BODY_WIDTH,CAR_HEIGHT]); | |
} | |
// Make two claws that mirror each other. | |
// These will be scaled and positioned later. | |
module drawPinewoodClaw() | |
{ | |
rotate([0,0,45]) | |
scale([0.1,0.1,0.1]) | |
render() | |
{ | |
rotate([0,0,-25]) | |
clawRaptor(); | |
mirror([1,1,0]) | |
rotate([0,0,-25]) | |
clawRaptor(); | |
} | |
} | |
// Make 4 pairs of claws | |
module drawClaws() | |
{ | |
render() | |
{ | |
translate([1,0,0]) | |
scale([0.9,0.9,0.9]) | |
drawPinewoodClaw(); | |
translate([4,0,0]) | |
scale([1.2,1.2,1.2]) | |
drawPinewoodClaw(); | |
translate([12,0,0]) | |
scale([1.4,1.4,1.4]) | |
drawPinewoodClaw(); | |
translate([15,0,0]) | |
scale([1.6,1.6,1.6]) | |
drawPinewoodClaw(); | |
} | |
} | |
// Make the base body | |
module pinewoodCar() | |
{ | |
// Make two sets of claws that overlap | |
translate([-12,0,0]) | |
{ | |
scale([1.6,1,1]) | |
drawClaws(); | |
scale([1.25,1,1]) | |
drawClaws(); | |
} | |
// Make the body by hulling 4 claws | |
// at the corners | |
hull() | |
{ | |
translate([-10,0,-3]) | |
scale([0.8,1.8,0.8]) | |
drawPinewoodClaw(); | |
translate([50,0,-3]) | |
scale([1.1,1.8,1.1]) | |
drawPinewoodClaw(); | |
} | |
} | |
module drawPrintablePinewoodCar() | |
{ | |
// Align the body to add the horns to | |
translate([10,22,10]) | |
scale([2.5,1.9,3.5]) | |
pinewoodCar(); | |
// Horn #1 | |
translate([140,15,12.5]) | |
scale([1.3,1.3,2]) | |
rotate([30,0,0]) | |
hornOneTwist(); | |
// Horn #2 mirrored from horn #1 | |
translate([140,30,12.5]) | |
scale([1.3,1.3,2]) | |
rotate([-30,0,0]) | |
mirror([0,1,0]) | |
hornOneTwist(); | |
} | |
// Make the body without the | |
module drawPrintablePinewoodCarWithAxleHoles() | |
{ | |
difference() | |
{ | |
drawPrintablePinewoodCar(); | |
// Front axle | |
translate([20,75,5]) | |
rotate([90,0,0]) | |
cylinder(100,1,1); | |
// Rear axle | |
translate([150,75,5]) | |
rotate([90,0,0]) | |
cylinder(100,1,1); | |
// Make a space to hold weights | |
translate([135,22.5,12]) | |
rotate([0,70,0]) | |
cylinder(35,3,3,$fn=40); | |
} | |
} | |
//drawPinewoodShadow(); | |
drawPrintablePinewoodCarWithAxleHoles(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment