OpenSCAD to Laser Cutter

From richmondmakerlabs.uk
Jump to navigation Jump to search

The RML Laser cutter

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

Missing small holes

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.

Missing engraved text characters

Engraving OpenSCAD text can be problematic - depending on the font and character size, some characters may have parts of their outline rendered with excessively short lines that RDworks fails to import. If a character fails to scan in RDworks preview, zoom in on it in the main window and check its outline for small gaps. If found, you should be able to fix them with the RDworks Curve Auto Close tool followed by Delete Overlaps.

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!

offset(delta=$kerf/2)){// move edge cuts out and hole cuts in by half beam width
      //2D geometry goes here
}

offset(delta) is a bit more computationally efficient than minkowski() with a circle as it doesn't round corners.

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 Calibration.zip including .dxf and .rld formats for non-OpenSCAD users

Engraving and Cutting together

As OpenSCAD cant export a multi-colour DXF, the workflow for combining cuts and scanned engraving is a little awkward. Both the cut and scan DXFs need a rendered bounding box object of exactly the same size so they will import in RDworks exactly on top of each other. Leave a decent clearance between the cut work and the bounding box so its easy to select and delete. You'll need to do two renders and export to DXF, one for the cuts and the other for the scan.

In RDworks, first import the scan DXF, select the scan artwork but *NOT* the bounding box and change its colour to make a new layer. Avoid Red it can be confused with selected objects! In the Work tab set the layer's priority to 1 so it gets done first, and set the mode to Scan. Then use the colour toolbar to select Black for new objects and import your cut DXF. Select all, and use the Delete Overlap Lines tool to simplify the bounding box. Next, select the bounding box and delete it. Depending on the bounding box thickness, you may have to delete it twice! You can now check your laser settings, preview the work then send it to the laser.

Recommended Libraries for laser cutting

https://github.com/bmsleight/lasercut - 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: https://hackaday.com/2022/01/02/an-openscad-library-for-all-your-cnc-cutting-needs/