Workshops/OpenSCAD
Jump to navigation
Jump to search
Contents
Hello World (a cube)
Make a solid
cube([10,20,30]);
- [ ] refers to cartesian coordinates
- if you're doing X,Y,Z use []
- for example:
- if you're doing X,Y,Z use []
cylinder(h=10,r=10);
- h and r are not cartesian coordinates. Do not use [ ] around them.
Apply a transformation
translate([0,-10,0]) cube([10,20,5]);
- translate applies to cube because there is no ; at the end
Relate solids
difference() { translate([0,-10,0]) cube([10,20,5]); cylinder(h=5,r=10); }
- Press F6 to compile the drawing
Done!
- You made a drawing! Congrats, but you did it wrong. Lets improve thigns.
More Stuff
- Take any of these, and repeat the same steps for Hello World
- Solids:
http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids
- Transformations:
http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations
- Relations: (CSG Modeling)
http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/CSG_Modelling
- Or, use this handy cheat sheet:
http://www.openscad.org/cheatsheet/
Variables
- Pretend we want to change the height of this halfpipe
- Change cube z to 10
difference() { translate([0,-10,0]) cube([10,20,10]); cylinder(h=5,r=10); }
More Details on OpenSCAD
- Stacking translates
- Translates can be stacked on top of each other
difference() { cylinder(h=5,r=10); translate([-3,-3,0]) cube([6,6,20]); }