7 Comments

Atoms from Bits: Programming OpenSCAD for Laser Cutting

nodebots-day-ann-arbor International Nodebots Day 2015 is July 25. I’m helping with an event in Ann Arbor and we needed over 40 robot kits for people to play with. What better time to learn how to use a new CAD package?

OpenSCAD is a great introduction to CAD for programmers that’s fun to use and easy to learn. It’s definitely not a replacement for a commercial CAD system such as Inventor or SOLIDWORKS, but I was able to create fully parametric wheel designs much quicker and easier than if I tried to use a 2D drawing program.

OpenSCAD

If you’ve ever seen CAD software before, OpenSCAD is a little shocking. The programming area is larger than the graphics display!

simple-wheel_scad

Chris Farber wrote about OpenSCAD in 2013. The software has seen many improvements since then, but has kept true to the idea of a simple, programmable solid modeling system.

You can see in the screen shot above that OpenSCAD creates things by running a program. It’s actually impossible to draw anything by clicking in the graphics display. I defined one main module to create the wheel geometry and a helper module to create the servo motor mounting holes for attaching a wheel to a motor.

OpenSCAD uses a custom language, but the syntax and features will feel familiar to most programmers. Constructive solid geometry will be a brand new idea to many programmers, but it has so many similarities to set operations that it too will probably be quickly learned.

Generating SVG

OpenSCAD_Model OpenSCAD definitely works best when creating solid models for 3D printing, but simple models can be laser cut if you can live with two limitations: you must design flat parts, and you must allow for the cutting tool in your dimensions. OpenSCAD does not have any concept of a cutting tool’s kerf. Most laser cutters can generate a decent tool path from a simple vector drawing, but none cut narrow enough kerfs. You will definitely have to plan for your specific laser when cutting accurate parts.

The laser I used cut a kerf about 0.5mm at best focus. The only critical tolerance is the mating holes to the servo motors, and I just tweaked the geometry through trial and error. The final wheels are about 1mm narrower in all dimensions. They will still make fun nodebots.

Once you have finished the design in OpenSCAD, press the “Render” button to project the geometry onto the XY plane, then export an SVG. There aren’t any options to control the SVG, so you’ll probably have to do some data cleanup. Even though my wheels are fully parametric and I could generate all the variations in one run, I rendered and exported each wheel separately to give me the flexibility in cleaning up the SVG.

All of the CAD files and SVG exports that I cut can be found in my github nodebots repo.

Laser Cutting

The SVG can’t be printed directly because my laser only cuts hairline (0 width) vectors. You can see in the SVG above that OpenSCAD exported vectors with 0.5pt and filled polygons. This needs to be cleaned up in a vector editing program. I used Corel Draw, but Inkscape and other vector editors work fine.

One oddity of OpenSCAD is that it creates unitless geometry. I treated all dimensions as mm, but when importing the SVG into Corel, the sizes were wrong. I just selected the piece and manually set the dimensions of the wheel. If your vector editor doesn’t support setting accurate physical dimensions, you’ll have a very hard time getting accurate cuts.

My final wheels were cut from 5mm Launan plywood. It is inexpensive, light, and strong. The front and back are clear wood, but I painted it anyway to seal the charred edges–laser cut wood will smudge forever regardless of how well you try to remove the char. The wheels were cut on an Epilog 50W laser cutter at Maker Works, a fantastic maker space in Ann Arbor. Launan cuts well on the laser at 10% speed and 100% power. 24 inch by 12 inch sheets of 40 wheels took 35 minutes to cut.

simple-wheel_cut