Saturday, July 28, 2012

Day 2 - Toy Train

Second model - a toy train. I get the feeling I'm going to end up modeling a lot of my kid's toys, as they have interesting, simple shapes. And I can easily take them on the train.

This is basically a rectangular prism with some bits shaved off with a cylinder. For the nose part, I put the cylinder with another rectangular prism first so I could union with the main one without shaving the rest of the original off.

One thing I found hard with this was getting the nose at the right angle. I must have done my calc wrong, because when I first did it, just didn't look right. As far as I can tell, there aren't rulers in OpenSCAD yet. So it was hard to just measure where things ought to be. So I did a poor-man's ruler and just put some colored cubes on the screen for my measurements.

So, with my cubes in place and eyeballing everything, I managed to get the nose pretty close to my measurements. Here is the result (sans wheels - will get to those later):

and here is the code
//Dimensions in mm
$fn = 200;
intersection() {
  cube([70, 20, 28]);
  translate([0, 10, 8]) rotate([0, 90, 0])  cylinder(h = 70, r = 20);
  union() {
    cube([40, 20, 28]);
    translate([30, 10, 11]) rotate([0, 114, 0])  cylinder(h =70, r = 20);
//These are what I used for measurements
//color("red") translate([70, 10, 0]) cube(15);
//color("blue") cube([40, 20, 28]); 

No comments:

Post a Comment