OpenSCAD Intermediates: Fixing Design Problems
In this OpenSCAD tutorial series so far we’ve covered the basics of the OpenSCAD interface, how to make 2D forms, how to make some basic 3D forms, how to position those forms in 3D space, the different ways to combine forms, how to create mashups of one or more existing STL’s and OpenSCAD forms, how to use modules to reuse your code to make your life easier, and how to extrude flat 2D forms into 3D forms. 1 Although I described the last four tutorials as “intermediate” levels, that’s really only because you learned the basics so quickly from the first few tutorials. With just the basics you can literally design anything you can imagine. The “intermediate” lessons will let you do a little more and make your life a lot easier.
Before we get started, the image is from punkerdood’s OpenSCAD tutorial homework. I’d like to include a picture of your homework next time. So, please practice making something in OpenSCAD, upload it to Thingiverse with an open license, and tag it with “openscadtutorial.”
- As with any 3D modeling program, you can sometimes get lost or disoriented in OpenSCAD. These things happen. Perhaps you accidentally zoomed out too far or in too close and you don’t know know what your point of view is in relation to the object you’re trying to create. Maybe you created a little object of some kind and can’t see where it is being rendered in the preview screen. Today’s tutorial is all about how to overcome those problems and get back to designing awesome things.
- Let’s start with a very simple module and see what happens as we manipulate it with these different methods.
- module funkybox()
- translate([0,0,100]) box();
- “*” or Disable command
- The Disable command, “*”, does pretty much as it promises. Just add that little asterisk before an object, and it will be disabled. You just won’t see it when previewing (F5) or rendering (F6) an object. This command will disable an entire subtree. Really all this means is that it will disable everything right up to the first semicolon.
- If you add the asterisk at line 3 above, you won’t see the cube.
- * cube(40);
- If you add it before line 4 above, you won’t see the sphere. If you add it before line 6, you won’t see either.
- If you can’t find an object you’ve designed, it’s easy to locate it by temporarily disabling other objects until you see where it is.
- “!” or Root command
- The Root command, “!”, forces OpenSCAD to ignore everything except the subtree following the root command.
- If you add the asterisk at line 3 above, you’ll only see the cube as if it were not in a module.
- ! cube(40);
- If you add it before line 4 above, you’ll only see the sphere, as if it were not in a module. If you add it before line 6, you’ll only see the one instance of the “funkybox();”.
- This is a good way to isolate just one feature out of an entire OpenSCAD file and focus on it.
- “%” or Background command
- The Background command, “%”, draws the subtree that follows it in transparent gray.
- If you add the percent sign before line 4 above, you’ll still see both instances of the cube, but both will also be a transparent gray.
- % cube(40);
- If you add it before line 4 above, you’ll see both instances of the sphere as transparent. If you add it before line 6, you’ll see one instance of the “funkybox();” as entirely transparent and the other as normal.
- This is really useful if you need to manipulate objects within other objects or need to see where two things really intersect.
- “#” or Debug command
- The Debug command, “#”, draws the subtree that follows it in a pinkish color.
- If you add the pound sign before line 4 above, you’ll see both instances of the cube in pink.
- # cube(40);
- If you add it before line 4 above, you’ll see both instances of the sphere as pink. If you add it before line 6, you’ll see one instance of the “funkybox();” as pink and the other as normal.
- This is useful if you need to identify just one object from within a lot of similar looking objects.
Now that you’ve learned how to fix design problems in OpenSCAD, how about showing everyone what you can do? Please leave a comment below about how you’ve been able to fix a problem using one of the techniques above or by using your own method. While you’re at it, how about designing something cool and uploading your OpenSCAD file and the STL to Thingiverse? As always, to make me extra proud be sure and tag it with “openscadtutorial.” As if basking in my affection wasn’t enough, I’ll pick one someone’s OpenSCAD homework and use their designs as part of the next tutorial.
Bonus Section 1: The Tutorials So Far
- OpenSCAD Basics: The Setup
- OpenSCAD Basics: 2D Forms
- OpenSCAD Basics: 3D Forms
- OpenSCAD Basics: Manipulating Forms
- OpenSCAD Intermediates: Combining Forms
- OpenSCAD Intermediates: Mashups
- OpenSCAD Intermediates: Modularity
- OpenSCAD Intermediates: Extruding 2D Objects
- OpenSCAD Intermediates: Fixing Design Problems
- OpenSCAD Intermediates: How to Make Organic Shapes
Bonus Section 2: Other sources
If you like reading ahead or want more information about OpenSCAD, I’ve found these websites to be very helpful.
- Official OpenSCAD website
- OpenSCAD User’s Manual
- OpenSCAD beginner’s tutorial
- OpenSCAD tutorial roundup on the Thingiverse blog
- Inkscape to OpenSCAD DXF tutorial
- Two New OpenSCAD Polygon Tools
- How to create a printable sign or logo (Inkscape and OpenSCAD)
- OpenSCAD screw libraries by syvwlch and aubenc
- Inkscape for OpenSCAD users
Bonus Section 3: What’s next???
The topic of the next tutorial is up to you. What would you like to learn next? Is there something you’d like to learn how to make? Is there something more you’d like to learn about some of the topics we’ve covered?
- If you’re wondering why it’s been a while since the last tutorial – it’s because I’m writing these things as I learn OpenSCAD myself. If you catch up to this tutorial, you’ve caught up with me too! [↩]