Skip to content

RobotGarden/openscad-intro

Repository files navigation

openscad-class

Materials for a class in using OpenSCAD to create 3D models.

License

All the materials in this repository are protected under the MIT license. See LICENSE for details.

Outline

  1. Overview of OpenSCAD

  2. Installing OpenSCAD

  3. First part: sizing a cube, adjusting the view (right-hand rule), centering

  4. Manipulating a part: translating, rotating (right-hand rule), scaling

Order of Topics

This order has been chosen because of the fact that we have to explain about the special variables to control arc quality. Thus, we will talk about variables first in the context of purely rectilinear objects.

  1. Drawing a cube. Objects (actions?) and parameters, semicolons

  2. Sizing the cube, various ways (cube(size=5), cube(5), cube(size=[10, 5, 2]), cube([10, 5, 2]))

  3. Aside about numbers and vectors

  4. Adjusting the view.

  5. Modules and parameters, named parameters and positional parameters

  6. Centering a cube, and more about named and positional parameters (cube(5, center) vs. cube(center=true, size=5))

  7. Aside about coordinates and printing: unitless, and can place later when printing, so origin doesn’t matter. First lab, drawing a cube and manipulating the view.

  8. Manipulating the cube: translation, omitting parameter names when there is only one parameter, translation vs. centering, braces to group a module

  9. Getting help: OpenSCAD cheat sheet and manual

  10. Drawing multiple cubes, union is default, first lab: drawing an arch

  11. Getting rid of magic numbers: variables, DRY, comments, assignment as constant vs. modifier

  12. Manipulating the cube: operators, rotation, order of manipulations, using multiple rotations

  13. More 3D objects: cylinders and spheres (and cones)

  14. Special variables for curve quality: $fs, $fa, $fn, suggest using $fs and $fa at top of file

  15. Scaling objects, cube(size=[10, 5, 2]) and scale([10, 5, 2]) cube(), scale([10, 5, 2]) sphere()

  16. Coloring objects, hiding them, highlighting them, and making them transparent: color(), *, #, and %

  17. Omitting all other objects with !

Other Topics

  • Using an External Editor

  • Comments

  • Boolean operations: union, intersection, difference, and danger of difference with overlapping edges

  • Extrusion

  • Convex hull

  • Minkowski sum

  • Importing an STL file

  • Using DXF files from Inkscape (need to position at (0,0) in Inkscape, and no splines)

  • MCAD library

  • Loops

  • List comprehensions

  • Use of braces and semicolons

  • resize(), for use in modules that can’t figure out a scale?

  • inf and nan, x==undef vs. x!=x for x is NaN

  • boolean values

  • Animation (perhaps toyEngine.scad)

Notes to Consider

  • Use scale() only with spheres or when scaling a completed part or design.

  • When writing modules, follow the origin conventions: be either like a cube, a cylinder, or a sphere, and also consider supporting a center parameter.

  • Local variables

  • import and use

  • Don’t abut objects at edges. (Same problem as holes that abut at a face or edge.)

  • Accuracy of circular objects: inscribed polygons

  • Must use “convexity” when using linear_extrude and other operators

About

An introduction to OpenSCAD.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published