OpenSCAD to Laser Cutter

From Richmond Maker Labs
Jump to navigation Jump to search

OpenSCAD, although normally used for 3D modelling, can be used for 2D modelling for laser cutting. It can render 2D geometry directly and export to .dxf, suitable for RDWorks import, or you can use the projection() module to slice or flatten 3D geometry to get 2D geometry to render for export.

Known issues

OpenSCAD does not generate curves as arcs, so they are always built up of straight line segments. RDWorks does not like curves built of excessively short straight line segments, and thus will not cut holes that have been rendered at too high a resolution. If you zoom in in RDWorks you'll see the problematic holes have a dashed or broken outline. If your design has small circular holes, check the job in RDWorks Preview mode - problem holes will be shown with a very thick outline and will be partially or completely skipped when you run the simulation. Increasing the minimum arc segment length in OpenSCAD, either directly or by reducing the number of segments will resolve the issue. If you need the higher resolution elsewhere, simply override your global $fn or $fs for the problematic holes.

Hints & Tips

Kerf (cut width) compensation

You can easily extend the outline of objects and reduce hole sizes to (partially) compensate for the width of the laser cutting beam. Note that the kerf (cut width) is not uniform from top to bottom and will vary slightly with position on the laser cutter bed, material and cutting parameters, and focus. To do so, measure or estimate the kerf, and in OpenSCAD do:

$kerf=0.15; //Edit in your measured kerf here!

      //2D geometry goes here
   circle(d=$kerf/2, $fn=16);  // move edge cuts out and hole cuts in by half beam width

Kerf Measurement Jig

Kerf measurement jig

This jig consists of nine rectangular tiles in a frame to let you average the measurement over the ten parallel cuts. Four of the tiles are drawn as such, but the other five are generated as the gaps between them, which guarantees there is only one cut line separating them.

To measure the kerf, cut this jig from some scrap of the same material as your work, in approximately the same position on the laser cutter bed. Next, carefully transfer to a flat surface without rearranging or flipping any tiles or the frame (masking tape helps!), and mark the frame and all the tiles with a continuous diagonal pencil or marker line so you can subsequently be certain none have been inadvertently flipped or rotated.

The actual measurement is taken by sliding all the tiles towards one end and measuring the narrowest part of the resulting gap with a set of feeler gauges, then dividing the result by ten. The result is the kerf at the narrowest depth of the cut (usually the bottom). Assuming the cut has a wedge shaped cross-section (usually more or less true for surface focused single pass cuts, with enough power / low enough speed to cut through cleanly with no hanging fibres), you can approximately measure the widest part of the cut by flipping every other tile starting from one end and re-measuring as above.

File:Lasercut Kerf including .dxf and .rld formats for non-OpenSCAD users

Recommended Libraries for laser cutting - B. M. Sleight's Lasercut library handles extracting 2D geometry from components of a 3D model generated using its modules, and 'plating' the result for laser cutting. Has limited kerf compensation. It also can generate various types of interlocking joints, ranging from simple matching tabs and slots, up to complex twist into place locking joints, + notched slots for captive nuts. Unfortunately it doesn't make it easy to do finger to mid-sheet T joints. Requires Python 3. If you are an OpenSCAD power user, you may well find it easier *NOT* to use it for simple finger to T joints, but instead to add code to 2D 'plate' your own 3D models sheet sides.

As OpenSCAD has no provision to interrogate the geometry of the object it is rendering, Lasercut has to work by getting the panels comprising the object to output their own 2D geometry as they are constructed, then parsing the console output with a clever script to generate the required 2D vector or openSCAD file. That means that parts generated or modified by 'vanilla' or BOSL2 OpenSCAD wont be rendered in the script's output, which although a limitation, can also occasionally be an advantage if you are constructing an assembly of laser-cut and 3D printed (or bought) parts.

Also see the Hackaday article about it: