Carving Pumpkins with OpenSCAD


Type: Investigation

Theme: Coding

Grades: 5, 6, 7, 8, 9, 10

Learning Target: Students will use boolean functions in OpenSCAD to add and subtract shapes to carve a digital 3D pumpkin.

Instructions

This is an individual project. Sharing code is OK, if you significantly modify it from the original. Submit a PowerPoint or Word document. 

  1. Plan your project. Create three annotated sketches of your pumpkin. Digital ink is OK.
  2. Select one design.
  3. Obtain two and provide one Peer Review.
  4. Build your OpenSCAD design. Use inline comments to annotate your code.
  5. Code should include the following:
    1. Two boolean operations (and, or, not), including a hollow pumpkin
    2. For loop
    3. Three different types of 3D objects (sphere, cube, cylinder, polyhedron, linear extrude, rotate extrude)
    4. Minimum of two colors
  6. Make sure your pumpkin sits on the z=0 plane.
  7. Submission:
    1. Three sketches.
    2. Large screenshot with x-y-x axis turned off. Crop as art only.
    3. Code in text format (no screenshots) or OpenSCAD document.
    4. Peer review.

OpenSCAD

OpenSCAD Example Code:

difference() {
    //pumpkin part
    createPumpkin();
    //cut out parts
    union(){
        translate([6,-15,5])rotate([90,60,0])rotate([0,0,22])sphere(7, $fn=3);
        translate([-6,-15,5])rotate([90,60,0])   rotate([0,0,38])sphere(6, $fn=3);
        color("white")sphere(15,$fn=100);
        difference() {
             translate([0,-15,2])rotate([90,60,0])rotate([0,0,38])cylinder(  20,   10, 10,true);
             translate([0,-15,12])rotate([90,60,0])rotate([0,0,38])cylinder(  25,   15, 15,true);
        }  
    }
}

module createPumpkin()  {
    union(){
        //pumpkin
        for(i=[1:30:180]){
            color("orange")rotate([0,0,i])scale([1,2,2])sphere(10,$fn=50);
        }
         //stem
        rotate([2,2,0])translate([0,0,18])for(i=[1:60:180]){
            color("green")rotate([8,0,i])scale([.5,1,1])cylinder(7, 2, 2,$fn=10);
        }
    }
}

Resources

Exit Ticket
CCSS Math Practice
  • I can model with mathematics.
NGSS Crosscutting Concepts
  • Scale, Proportion, and Quantity
Active
No

Samples