TOP SEARCH TERMS
CANCEL
TOP SEARCH TERMS

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 forms1  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.
    1. module funkybox()
    2. {
    3. cube(40);
    4. sphere(15);
    5. }
    6. box();
    7. 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.
      1. * 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.
      1. ! 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.
      1. % 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.
      1. # 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.

Homework assignment

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

 

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.

  1. Official OpenSCAD website
  2. OpenSCAD User’s Manual
  3. OpenSCAD beginner’s tutorial
  4. OpenSCAD tutorial roundup on the Thingiverse blog
  5. Inkscape to OpenSCAD DXF tutorial
  6. Two New OpenSCAD Polygon Tools
  7. How to create a printable sign or logo (Inkscape and OpenSCAD)
  8. OpenSCAD screw libraries by syvwlch and aubenc
  9. 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?

  1. 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! []
Tagged with , , , , , 2 comments
 

2 Comments so far

  • sxt173
    August 2, 2011 at 2:55 pm
     

    These are awesome tutorials, please keep them coming! I can say that I have made pretty colorful models using the background, disable and difference commands. Pink, grey and orange anyone?

    Idea for next lesson:
    – (if here is a simpler way than using polygons): nut holes, e.g. hexagon shapes
    – Design a screw

     
  • sxt173
    August 2, 2011 at 2:59 pm
     

    Oh yeah, whatever a “polyhedron” is. It sounds like a magical impossible shape.

     
 

Leave your comment

 
 
 

xhtml: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 

 
 
Chat
What can we help you with today?
I want to chat with Sales.
I have a question about an existing order.
I have a technical question about my device.
Continue
Existing Orders
For faster service, enter your order number
(found in your confirmation e-mail)
Skip
Submit