User:NathanMinnick58/ENES-100/OpenSCAD Designs

OpenSCAD User Manual

OpenSCAD Cheatsheet

Donut shape


This design we learned to create in class. I learned the feature $fn can be used to smooth the edges of spheres and cylinders.

This is the code for this shape

rotate_extrude(convexity=10,$fn=100)

translate([2,0,0])

circle(r=1,$fn=100);

Simple Bridge
By design this simple bridge, I first made a base for the bridge and added two cube on the edge of the base to create a wall. I change this design after I practice using the difference feature to make the walls of the bridge. For the supports of the bridge I design by using three cylinders, two of the cylinders are the legs and the third cylinder is rotated 90 degree on the x axis and the z axis.

cube(size =[10,21,1],center=true);

translate([4.5,0,1])

cube(size =[1,21,1],center=true);

translate([-4.5,0,1])

cube(size =[1,21,1],center=true);

union{ translate ([4.5,9,-3])

cylinder(h=5, r=1, center=true, $fn=100);

translate ([-4.5,9,-3])

cylinder(h=5, r=1, center=true, $fn=100);

translate ([-5.5,9,-1.5])

rotate ([90,0,90]) cylinder (r=1, h=11,$fn=100);

}

union{

translate ([4.5,-9,-3])

cylinder(h=5, r=1, center=true, $fn=100);

translate ([-4.5,-9,-3])

cylinder(h=5, r=1, center=true, $fn=100);

translate ([-5.5,-9,-1.5])

rotate ([90,0,90]) cylinder (r=1, h=11,$fn=100);

}

Satellite puzzle
Working on the Satellite Puzzle I practice with rotating cylinders. I learned more of how to make a difference between two cylinder. I created this part by creating a cylinder of a radius of 5. than I removed the center of this cylinder by using a difference of a cylinder with a radius of 4. After that I copy the code and rotated the cylinder 90 degrees on the y axis. I copy the same copy from the first cylinder and rotated it 90 degrees on the x and y axis. After making the cylinders I worked on the rectangle prism that had a length of 11.5, a width of 1.5 and a height of 2. The code to for this design is located below.

difference{

cylinder(r=5,h=1,$fn=100,center=true);

cylinder(r=4,h=1,$fn=100,center=true);

}

difference{

rotate([0,90,0])

cylinder(r=5,h=1,$fn=100,center=true);

rotate([0,90,0])

cylinder(r=4,h=1,$fn=100,center=true);

}

difference{

rotate([90,90,0])

cylinder(r=5,h=1,$fn=100,center=true);

rotate([90,90,0])

cylinder(r=4,h=1,$fn=100,center=true);

}

cube([11.5,1.5,2],center=true);

cube([2,11.5,1.5],center=true);

rotate([0,90,0]) cube([11.5,2,1.5],center=true);

Cool Sphere Design


This design I was practicing different way to rotate an object on the x, y and z axis.

difference{

cylinder(r=5,h=1,$fn=100,center=true);

cylinder(r=4,h=1,$fn=100,center=true);

}

difference{

rotate([0,45,0]) cylinder(r=5,h=1,$fn=100,center=true);

rotate([0,45,0]) cylinder(r=4,h=1,$fn=100,center=true);

}

difference{

rotate([0,135,0]) cylinder(r=5,h=1,$fn=100,center=true);

rotate([0,135,0]) cylinder(r=4,h=1,$fn=100,center=true);

}

difference{

rotate([0,90,0]) cylinder(r=5,h=1,$fn=100,center=true);

rotate([0,90,0]) cylinder(r=4,h=1,$fn=100,center=true);

}

difference{

rotate([90,90,0]) cylinder(r=5,h=1,$fn=100,center=true);

rotate([90,90,0]) cylinder(r=4,h=1,$fn=100,center=true);

}

difference{

rotate([45,90,0]) cylinder(r=5,h=1,$fn=100,center=true);

rotate([45,90,0]) cylinder(r=4,h=1,$fn=100,center=true);

}

difference{

rotate([135,90,0]) cylinder(r=5,h=1,$fn=100,center=true);

rotate([135,90,0]) cylinder(r=4,h=1,$fn=100,center=true);

}

R 2 D 2 CAD Design
I was planning to use this design of R2D2 from Star Wars for my CAD assignment Working on this design I learn the most about the feature that are used in openSCAD by practicing and experiment and researching different I did not know. While working on this design I practiced creating different parts in a new window and copied and place the code into file. By using the feature union which is an assembly of different shapes that is very easy to rotate and translate the union the part instead of changing all the numbers to translate all of the individual shapes.

I learned about using polygons to plot points that would shape a 2D vision of a shape. I mostly used this shape for triangles and some of the details on the body of R2D2. I was able to extrude the 2D sketch. On the head of R2D2 has a grey shape that I made a sketch of and used rotate_extrude to make a cylinder shape. Some other features I used was hull that takes a sum of two shapes. I used the hull feature shape that is a navy blue color on the leg of R2D2. Minkowski takes the sum of two shapes. I mostly used Minkowski to round the edges of the lower leg of R2D2.

The feature that i use to design this CAD drawing of R2D2 in openSCAD.
 * 1) Union
 * 2) Difference
 * 3) color
 * 4) Translate
 * 5) Rotate
 * 6) Linear_extrude
 * 7) Rotate_extrude
 * 8) Mirror
 * 9) Hull
 * 10) Minkowski

Shapes that I used
 * 1) sphere
 * 2) cylinder
 * 3) cube
 * 4) polygon

//R2D2 Body//

union{ color("silver") difference{

translate([0,0,-4]) cylinder(r=7.5,h=15,$fn=100,center=true);

rotate([90,0,0]) cylinder(r=2,h=30,$fn=100,center=true); }

color("navy") translate([4.2,5,1.5]) rotate([0,180,90])

color("navy") union{

difference{

difference{

translate([5,4,-1]) cylinder(r=7.5,h=2,$fn=100);

difference{

translate([-2.75,-4,-2]) cube([15.5,3,4]);

translate([0,-1,0]) rotate([90,0,0]) linear_extrude(height=3.5)

union{ polygon(points=0,0],[0,0.5],[1.5,0.5],[2.5,1],[6.5,1],[6.5,0.5],[7,0.5],[8,1],[10,0.5],[10,0);

polygon(points=0,0],[0,-0.5],[1.5,-0.5],[2.5,-1],[6.5,-1],[6.5,-0.5],[7,-0.5],[8,-1],[10,-0.5],[10,-0); } } } translate([-2.5,-1.1,-3]) cube([15,15,5]); } }

color("navy") translate([4.2,-5,-1.5]) rotate([0,0,90])

color("navy") union{

difference{

difference{

translate([5,4,-1]) cylinder(r=7.5,h=2,$fn=100);

difference{

translate([-2.75,-4,-2]) cube([15.5,3,4]);

translate([0,-1,0]) rotate([90,0,0]) linear_extrude(height=3.5)

union{

polygon(points=0,0],[0,0.5],[1.5,0.5],[2.5,1],[6.5,1],[6.5,0.5],[7,0.5],[8,1],[10,0.5],[10,0);

polygon(points=0,0],[0,-0.5],[1.5,-0.5],[2.5,-1],[6.5,-1],[6.5,-0.5],[7,-0.5],[8,-1],[10,-0.5],[10,-0); } } } translate([-2.5,-1.1,-3]) cube([15,15,5]); } }

translate([0.1,0,-10]) color("gainsboro")

union{ difference{

cylinder(r=7.5,h=6,$fn=100);

translate([5,0,0.5])

difference{

translate([-1,-5,-1]) cube([5,10,7]);

translate([-2,0.5,0]) cube([8,4,5]);

translate([-2,-4.5,0]) cube([8,4,5]); }

translate([-8,-8,-0.5]) cube([14,16,7]); } } color("silver") translate([0,0,-12.5]) cylinder(r1=6.5,r2=7.5,h=2,center=true,$fn=100); }

//R2D2 Body//

//R2D2 Head// translate([0,0,-3.75]) union{ union{

union{ difference{ color("silver") translate([0,0,8.5]) sphere(r=7.5,$fn=100); translate([0,0,1.25]) cube([16,16,14],,center=true); } color("navy") translate([0,0,7.3]) cylinder(r=7.5,h=1,$fn=100); }

color("black") translate([5.5,0,12.1]) sphere(r=1.45,$fn=100);

color("navy") translate([6.1,-2,11]) rotate([60,0,90]) linear_extrude(height=2,center=true) polygon( points=0,0],[0.5,2.5],[3.5,2.5],[4,0);

color("navy") translate([0,0,8.7]) union{ difference{ sphere(r=7.4,$fn=100); difference{ translate([0,0,6.25]) cylinder(r=2.5,h=2,$fn=100); translate([0,0,6.25]) cylinder(r=1.5,h=1,$fn=100); } translate([0,4,5.8]) rotate([45,0,0]) cube([1,3,4],center=true);

translate([0,-4,5.8]) rotate([45,0,0]) cube([1,4,4],center=true);

translate([-4.5,2.6,7.2]) rotate([45,0,60]) cube([1,8,4],center=true);

translate([-4.5,-2.6,7.2]) rotate([-45,0,-60]) cube([1,8,4],center=true);

translate([4.5,-2.6,7.2]) rotate([-45,0,60]) cube([1,8,4],center=true);

translate([4.5,2.6,7.2]) rotate([45,0,-60]) cube([1,8,4],center=true);

translate([0,0,1]) cube([15,15,10],center=true);

translate([0,0,-6]) cube(14,center=true); } } color("navy") translate([0,0,15.5]) cylinder(r=1,h=1,center=true,$fn=100); }

difference{ color("navy") translate([6.5,0.5,9.5]) rotate([0,-10,1]) cube([2,3,1.75],center=true); color("red") translate([7.4,1,9.6]) rotate([0,80,0]) cylinder(r=0.5,h=0.5,$fn=100); }

color("grey") translate([5,2.5,9]) rotate([210,245,0]) rotate_extrude($fn=200) polygon( points=0,0],[0.75,0],[0.75,2.75],[0.50,3],[0,2.80);

color("navy") difference{

translate([0,0,8.5]) sphere(r=7.55,$fn=100);

translate([0,0,1.25]) cube([16,16,14],,center=true);

translate([0,0,19]) cube([16,16,14],,center=true);

translate([8,1,10]) cube(7.5,center=true);

translate([0,0,7.5]) cylinder(r=6,h=5,$fn=100);

translate([3,5,9]) rotate([0,0,60]) cube([3,0.5,3.5]);

translate([1,5.5,9]) rotate([0,0,80]) cube([3,0.5,3.5]);

translate([-2,8,9]) rotate([0,0,-80]) cube([3,0.5,3.5]); translate([-8,3,9]) rotate([0,0,-25]) cube([3,0.5,3.5]); translate([3,-5,9]) rotate([0,0,-60]) cube([3,0.5,3.5]);

translate([4,-4,9]) rotate([0,0,-40]) cube([3,0.5,3.5]);

translate([1,-5,9]) rotate([0,0,-80]) cube([3,0.5,3.5]);

translate([-3,-8,9]) rotate([0,0,80]) cube([3,0.5,3.5]);

translate([0,0,7.6]) cylinder(r=8,h=3,$fn=100,center=true);

translate([-5.5,-2.2,10]) cube([5,9.5,5],center=true);

translate([4.8,5.3,10]) rotate([0,0,45]) cube([3,3,5],center=true);

translate([4.5,-2.5,9]) rotate([0,0,-20]) cube([3,1,3.5]);

} }

//R2D2 Head//

//R2D2 arm left//

translate([0,-5.75,0]) union{ //R2D2 arm part 1// difference{ union{ color("silver") rotate([90,0,0]) cylinder(r=2,h=2,$fn=100);

color("silver") hull{ rotate([90,0,0]) translate([0,0,2]) cylinder(r=3,h=2,$fn=100);

translate([0,-3,-4]) cube([6,2,4],center=true); }

color("silver") rotate([90,180,0]) translate([2,6,3]) linear_extrude( height=2, center = true) polygon(points=0,0],[1,0],[0,1);

color("silver") rotate([90,-270,0]) translate([6,2,3]) linear_extrude( height=2, center = true) polygon(points=0,0],[1,0],[0,1);

color("navy") hull{ translate([0,-3.5,-4]) cube([4,1.5,6],center=true);

rotate([90,0,0]) translate([0,0,3.5]) cylinder(r=2,h=1.5,center=true,$fn=100); }

color("navy") rotate([90,180,0]) translate([1.5,7,3.25]) linear_extrude( height=2, center = true) polygon(points=0,0],[0.5,0],[0,0.5);

color("navy") rotate([90,-270,0]) translate([7,1.5,3.25]) linear_extrude( height=2, center = true) polygon(points=0,0],[0.5,0],[0,0.5);

color("navy") translate([0,-3.5,-7]) cube([3,1.5,1],center=true);

color("Silver") translate([0,-2.75,-6]) cube([4,1.5,1],center=true);

color("white") translate([0,-4.1,-4]) cylinder(r=0.25,h=7.1,center=true,$fn=100); } color("white") rotate([90,0,0]) translate([0,0,4]) cylinder(r=1,h=1.5,center=true,$fn=100);

} //R2D2 arm part 1//

//R2D2 arm part 2// difference{ union{ translate([-2,-2.25,-12]) union{ color("silver") minkowski{ hull{ translate([0,0,2]) cube([3,2,6],center=true); translate([0,0,-1.5]) rotate([90,0,0]) cylinder(r=1.5,h=2,center=true,$fn=100); } translate([2,0,0]) cylinder(r=0.5,h=1,center=true,$fn=100); } } color("navy") hull{ translate([0,-3.75,-9]) cube([3,0.5,6],center=true); translate([0,-2.5,-13.5]) rotate([90,0,0]) cylinder(r=1.5,h=1.5,$fn=100); }

color("white") rotate([90,0,0]) translate([0,-13.5,3.5]) cylinder(r=0.5,h=1.5,center=true,$fn=100); color("white") translate([0,-4.1,-10.5]) cylinder(r=0.15,h=6,center=true,$fn=100); }

color("silver") translate([0,-1,-11]) cube([4.5,2,10],center=true); }

//R2D2 arm part 2//

//R2D2 arm part 3 Foot//

color("silver") translate([-0.25,0.5,-4]) union{

translate([-2.5,-3,-14]) rotate([90,0,0]) linear_extrude(height=2,center=true) polygon( points=0,0],[1,2.5],[4.5,2.5],[5.5,0);

difference{ translate([3,-4.5,-14]) rotate([90,0,180]) linear_extrude(height=1,center=true) polygon( points=0,0],[1,2.5],[4.5,2.5],[5.5,0);

rotate([270,180,-90]) translate([-5.3,-14,0]) linear_extrude(height=6,center=true) polygon( points=0,0],[0,3],[1.1,3],[0.25,0); }

} color("silver") difference{ translate([0,-3.90,-17.25]) rotate([90,0,0]) cylinder(r=1.5,h=1,$fn=100,center=true); color("silver") translate([0,-3.90,-19]) cube([4,2,2],center=true); }

//R2D2 arm part 3 Foot//

} //R2D2 arm left//

//R2D2 arm right// translate([0,5.75,0]) rotate([0,0,180]) union{ //R2D2 arm part 1// difference{ union{ color("silver") rotate([90,0,0]) cylinder(r=2,h=2,$fn=100);

color("silver") hull{ rotate([90,0,0]) translate([0,0,2]) cylinder(r=3,h=2,$fn=100);

translate([0,-3,-4]) cube([6,2,4],center=true); }

color("silver") rotate([90,180,0]) translate([2,6,3]) linear_extrude( height=2, center = true) polygon(points=0,0],[1,0],[0,1);

color("silver") rotate([90,-270,0]) translate([6,2,3]) linear_extrude( height=2, center = true) polygon(points=0,0],[1,0],[0,1);

color("navy") hull{ translate([0,-3.5,-4]) cube([4,1.5,6],center=true);

rotate([90,0,0]) translate([0,0,3.5]) cylinder(r=2,h=1.5,center=true,$fn=100); }

color("navy") rotate([90,180,0]) translate([1.5,7,3.25]) linear_extrude( height=2, center = true) polygon(points=0,0],[0.5,0],[0,0.5);

color("navy") rotate([90,-270,0]) translate([7,1.5,3.25]) linear_extrude( height=2, center = true) polygon(points=0,0],[0.5,0],[0,0.5);

color("navy") translate([0,-3.5,-7]) cube([3,1.5,1],center=true);

color("Silver") translate([0,-2.75,-6]) cube([4,1.5,1],center=true);

color("white") translate([0,-4.1,-4]) cylinder(r=0.25,h=7.1,center=true,$fn=100); } color("white") rotate([90,0,0]) translate([0,0,4]) cylinder(r=1,h=1.5,center=true,$fn=100);

} //R2D2 arm part 1//

//R2D2 arm part 2// difference{ union{ translate([-2,-2.25,-12]) union{ color("silver") minkowski{ hull{ translate([0,0,2]) cube([3,2,6],center=true); translate([0,0,-1.5]) rotate([90,0,0]) cylinder(r=1.5,h=2,center=true,$fn=100); } translate([2,0,0]) cylinder(r=0.5,h=1,center=true,$fn=100); } } color("navy") hull{ translate([0,-3.75,-9]) cube([3,0.5,6],center=true); translate([0,-2.5,-13.5]) rotate([90,0,0]) cylinder(r=1.5,h=1.5,$fn=100); }

color("white") rotate([90,0,0]) translate([0,-13.5,3.5]) cylinder(r=0.5,h=1.5,center=true,$fn=100); color("white") translate([0,-4.1,-10.5]) cylinder(r=0.15,h=6,center=true,$fn=100); }

color("silver") translate([0,-1,-11]) cube([4.5,2,10],center=true); }

//R2D2 arm part 2//

//R2D2 arm part 3 Foot//

color("silver") translate([-0.25,0.5,-4]) union{

translate([-2.5,-3,-14]) rotate([90,0,0]) linear_extrude(height=2,center=true) polygon( points=0,0],[1,2.5],[4.5,2.5],[5.5,0);

difference{ translate([3,-4.5,-14]) rotate([90,0,180]) linear_extrude(height=1,center=true) polygon( points=0,0],[1,2.5],[4.5,2.5],[5.5,0);

rotate([270,180,-90]) translate([-5.3,-14,0]) linear_extrude(height=6,center=true) polygon( points=0,0],[0,3],[1.1,3],[0.25,0); }

} color("silver") difference{ translate([0,-3.90,-17.25]) rotate([90,0,0]) cylinder(r=1.5,h=1,$fn=100,center=true); color("silver") translate([0,-3.90,-19]) cube([4,2,2],center=true); }

//R2D2 arm part 3 Foot//

}