Take our Daughters and Sons to Work Day 2016 – 3D Modeling with OpenJSCad

What follows here is an outline of activities we did for TODS Day 2016.

Hello World!

OpenJSCad 3D Modeling

  1. Open JS Cad is a programming environment that allows you to build 3D models that you can print.
  2. Controls:
    • Rotate XZ: Left Mouse
    • Pan: Middle Mouse or SHIFT + Left Mouse
    • Rotate XY: Right Mouse or ALT + Left Mouse
    • Zoom In/Out: Wheel Mouse or CTRL + Left Mouse
  3. Copy the following code into the program’s Coding Window:
  4. function main() {
    var word = vector_text(0,0,"HELLO WORLD!");

    var bagOfShapes = [];

    word.forEach(function(char) {
    bagOfShapes.push(rectangular_extrude(char, {w: 6, h: 6}));

    return union(bagOfShapes).translate([-100,0,0]).scale(0.5);

    Alternate Advanced Version

    function main() {
    var word = vector_text(0,0,"HELLOWORLD!");
    var ring = torus({ ri: 1.5 }).translate([-1.5,10,3]);
    var oval = sphere(1).scale([100,7.5,1.5]).translate([105,10,3]);

    var bagOfShapes = [ring, oval];
    word.forEach(function(char) {
    bagOfShapes.push(rectangular_extrude(char, {w: 6, h: 6}));

    return union(bagOfShapes).translate([-100,0,0]).scale(0.5);

  5. Render Code: SHIFT + RETURN.
  6. The “Generate STL” button creates a “Download STL” button where you can download a file of your creation that you can send to a 3D printer or open in other 3D modeling programs.
  7. Open JS Cad Documentation
  8. Other code examples for Open JS Cad
    • Click on the “Examples” link at OpenJSCAD.org
    • Cube:
    • function main() {
      return cube();

    • Sphere:
    • function main() {
      return sphere();

    • The .scale() and .translate() functions in the examples below use Cartesian Coordinates [x, y, z] (ie .scale([x,y,z]) increases the size of the shape along the x, y, and z axis):
    • Rectangle:
    • function main() {
      return cube().scale([2,6,4]).translate([0,0,20]);

    • Oval:
    • function main() {
      return sphere().scale([1,2,4]).translate([0,0,10]);

    • Loom: a knitting loom, the code is very well-written and easy to follow.
    • Parametric Cryptex: this one is neat because it adds a form to the screen where you can modify the variables instead of updating them in the code.
    • Rope Ring: I have no idea how this works, but it’s neat.
  9. Other 3D Modeling Tools:
    • OpenSCAD: the free open-source windows application on which OpenJSCAD was built. Uses very similar code, but with some syntax differences.
    • TinkerCad: very easy-to-use online tool for building 3D models.
    • Blender: very robust free open-source windows application that allows building complex models, 3D art, and animations.
  10. Where to Print Your Designs:
    • 3D Hubs: a network of people who own 3D printers and will print your models for a fee.
    • Shapeways: company based in New York that can print your models in a wide variety of high-quality materials.
    • The Great And Wonderful (TGAW) Vicky Somma: we are a 3D Hub, we live in Occoquan, can print your designs, and deliver them to your parents at work. Email me at ryan.somma[at]ascd.org
  11. Places to get models:
    • Thingiverse: lots of free models you can download and play with.
    • NASA: a growing collection of satelites, space ships, and astronomical features you can download and print.
    • Pinshape: another site with free models