One Simple Trick Can Save You 30 Minutes…

After mentioning long render times on my machine, @raster suggested switching to the manifold 3D rendering backend.  Depending on your OpenSCAD version, you might need to poke around to find how to enable this option.  It’s absolutely worth your time and should really be enabled by default.

If you dig into this option a little, and you’re a 3D printing old timer, you might recognize the creator of this library as none other than Emmett Lalish!!!  Emmett was an early 3D printing adopter, from back in the MakerBot Thing-O-Matic days, creator of the original hear gears, and just all around incredible engineer. ((Emmett even wrote a guest post on this very blog about… 14 years ago?!?!))

Emmett’s manifold library dropped the render time for one of my designs from 300 seconds to… under 8 seconds.  I literally used to avoid hitting F5 on more complex designs or avoid cranking up the facets so I didn’t have to wait for long renders.  A single comment from a friend, telling me about an option written by another friend, has completely and permanently changed how quickly I’m able to iterate and design objects forever.

Here’s how you can instantly save tons of time with your OpenSCAD designs:

"Manifold (new/fast)"

“Manifold (new/fast)”

#OpenSCADClub
  1. OpenSCAD 3D Printed Spring
  2. OpenSCADClub Week 2: Directional Pad
  3. OpenSCAD Render Times
  4. One Simple Trick Can Save You 30 Minutes…

OpenSCAD Render Times

Thanks to @raster, I’m going to do a side-by-side taste test of several different flavors of OpenSCAD.1 To give each one a similar test, I’m trying out my D-Pad design from … uh, earlier this morning.2

Version Release F5 Preview F6 Render Notes
2021.01 Stable 09:50.220 2.302 Best place to start
2024.01.13 Current 04:37.763 0.948 I’ve been running this one for a while
2025.04.04 Latest 04:36.593 0.483 Latest snapshot

Obviously, the good folks working on OpenSCAD have dramatically improved preview/render times over the last four years.  The speed boost in using a later snapshot is pretty significant if you’re doing any kind of complex designs.  They must be using some kind of cache system to make the render times so fast.

The speed differential between 2024.01.13 and the latest snapshot is so slight, I’m not going to switch things up unless I bump into a design that struggles with rendering some complex feature.

#OpenSCADClub
  1. OpenSCAD 3D Printed Spring
  2. OpenSCADClub Week 2: Directional Pad
  3. OpenSCAD Render Times
  4. One Simple Trick Can Save You 30 Minutes…

 

 

  1. *I’m not avoiding work!* YOU’RE avoiding work! []
  2. Like, way earlier…  midnight or so… []

OpenSCADClub Week 2: Directional Pad

This week’s topic related to @deshipu’s directional keypad designs.  The directional pad is clearly the most complicated part of the design.  The four buttons are basically just cylinders that can be created in several different ways.

@deshipu's D Pad Design

@deshipu’s D Pad Design

Brian published his designs to Github.

@beerriot's designs

@beerriot’s designs

After staring at the design a little longer, I changed from my original design idea to creating a 2D cross, extruding that, subtracting out the curved area described by a sphere (a homebrew hack I’ll describe below), using the minkowski function to surround the entire surface with a small sphere to give it a rounded look, then cutting the bottom off to ensure it is flat.  I didn’t include a flat cylinder as in the original design above, but that’s a trivial addition.  The downside?  This is a 5 minute render on my machine, largely due to the minkowski function.

//  Settings
    fn = pow(2,5);
//  Measurements
    pad = [10,30,1,3];
    corner = 1;

dpad();

module dpad()
    {
    difference()
        {
        minkowski()
            {
            difference()
                {
                linear_extrude(height=pad[3], center=false)
                    offset(r=-corner/2, $fn=fn)
                    for (i=[0:1])
                        rotate([0,0,90*i])
                        square([pad[0],pad[1]], center=true);
                translate([0,0,pad[3]])
                    scale([pad[1]*1.03,pad[1]*1.03,pad[3]-pad[2]])
                        sphere(r=0.5, $fn=fn);
                }
            sphere(r=corner/2, $fn=pow(2,4));
            }
        mirror([0,0,1])
            cylinder(r=pad[1], h=pad[1], center=false);
        }
    }

Renders to:

MakerBlock's design

MakerBlock’s design

Hacks:

  1. You’ll notice I use “offset” to reduce the size of the directional pad, because I knew I was going to round it all with the minkowski function in a few lines.
  2. The directional pad is actually just a rectangle, run through a for loop once to rotated it by 90 degrees, before being extruded to the specified height.
  3. The last two lines of code are used to create a large cylinder, larger than what I knew the pad would be, then mirrored in the Z axis to cut everything below the XY plane.
  4. As in prior designs, I pre-define “fn” to be a “pow(2,5)” so that I can use a low exponent to iterate designs quickly, then crank it up for a detailed design.
  5. The hack I use the most often here, and the one I’m the most proud of, is where I make a sphere like “sphere(r=0.5)” and then scale it by whatever I need.  Since the sphere has a diameter of “0.5” mm, the actual sphere is 1mm in diameter – so when I scale it in the XY by 30 and in the Z by 2 (since the edges of the keypad are 3mm tall and the center is 1mm tall), the diameter is now 30mm and the height is 2mm.  This little trick, of being able to scale a sphere to the exact size I need has come in handy countless times.

I’m not the best programmer, not the best at OpenSCAD, but I’m kinda happy that I was able to build this in about 31 lines of code.  :)

#OpenSCADClub
  1. OpenSCAD 3D Printed Spring
  2. OpenSCADClub Week 2: Directional Pad
  3. OpenSCAD Render Times
  4. One Simple Trick Can Save You 30 Minutes…