Guides/Inkscape for Laser Cutting

From London Hackspace Wiki
Jump to: navigation, search

TL;DR

How to deal with problem Inkscape files:

  • Per layer:
    • Select all
    • Path-> objects to paths
    • Object -> Fill and Stroke -> Set fill to None
    • Path -> Combine

Note that for complicated paths, it may also be necessary to use the "Unite curves" feature of the laser cutter software. Some engraving may not work at all unless this is used.

See also the alternative method.

Some laser cutter basics

Engrave vs cut

Engrave involves filling in the shapes. It is non trivial to decide if a point is inside or outside a shape and should be engraved or not.

In the laser cutter software it does it by taking a vertical line and and then seeing where it intersects with your shapes lines. The first line it comes to it switches the laser on, when it comes to another line it switches off.

This allows for unengraved things inside engraved sections. It also means that if you overlap two objects on the same engrave layer then it will not engrave twice but stop engraving.

This is also why the software complains if the sections that you are engraving aren't continous, it might find a section that is open and engrave for ever.

Cut is straightforward. It just follows the lines you have made. Joining the lines helps somewhat the crazy cut order it makes.

Inkscape basics

Why use Inkscape?

It can intersect and do path operations on curves and can trace bitmaps, which I haven't been able to do on qcad.

I do use qcad to check the files that are output by this method though.

Setting the scale

In the menubar choose mm instead of px. This sets the measurement of objects to millimetres. It has been fairly accurate, I did my laptop stand this way.

Important tools

Arrow (Object Selection)

This selects object, and allows you to then move them by clicking and dragging or scaling them with arrows around the edge. If you click the object again you can rotate or skew the object with the arrows on the side of the object.

Arrow and Curve(Object Editing)

If you want to do further editing of a path type object then select it and then alter the points.

Curves are specified by 3,4 points. There are two end points (which can be diamonds,squares or large circles) and 1-2 control points (small circles with lines connecting them to the end points). The control points tug at the curve, the further away they are from the straight line the more the curvy the curve becomes.

There are lots of useful tools in the tool bar. The first two are add and remove points (which are very useful for adding detail or clearing up a scan). To add a point select two (or more) connected end points and press the first button (+ with a square and line through it), deletion just requires the selection of an end point.

There are a few different types of end points. You can change the type by pressing the 7-10th buttons.

7th button: diamonds are corners: The control points for the curves are unconnected. So ou can have crazy angles. 8th button: The first square (smooth). The control points are 180 degrees away from each other. 9th button: The second square (symmetric). The control points are 180 degrees away from each other and they are the same distance away. 10th button: The circle (auto-smooth) The control points are set in such a way as to make it smooth. You can edit this after if you want.

The next two are fairly self explanatory (segment to line, segment to curve). Mousing over is recommended.

Creating objects

I'm not going to spend too much time on this as there are plenty of tutorials on the web for this sort of thing. Experimentation is good!

Changing objects into paths

DXF files do not have some of the primitives in svg like text or the curvy edged boxes that Inkscape generates. This means you need to convert these objects into things the DXF format understands.

This can be done with object to path.

Path -> Object to Path (Shift-Ctrl-C)

Fill and stroke

If you want to visually distinguish different objects.

Object -> fill and stroke

This allows you to change the appearance of the object. Fill is the colour inside the line. Stroke is what colour the line is (and a various other things that aren't useful for laser cutting).

Custom Palette for making cut lines appear as layers in LaserCut v5.3

Nottingham Hackspace have made a custom Palette for Inkscape, both with the seven colours that appear to survive the DXF export process and all the colours from the LaserCut v5.3 software:

https://wiki.nottinghack.org.uk/wiki/Laser_cutter/Inkscape#Custom_Colour_Palette

Inkscape's manual has this to say about custom palettes:

Inkscape has a variety of built-in palettes (some copied from Gimp). More palettes can be added by installing palette files in the directory share/palettes. The files use the Gimp palette file structure where colors are defined in terms of a triplet of numbers in a RGB format.

Instructions for install are also on the Nottingham Hackspace wiki (linked to above).

Useful things for laser cutting

Scanning a bitmap

File -> Import

Select the bitmap you want to import in the file dialog. And chose embed. Then select the bitmap and trace it using.

Path -> Trace Bitmap (Shift-Alt-B)

This brings up a dialog box. You can try to scan it with the default settings. This will work if it is a high contrast image. For lower contrast images fiddle with the threshold, updating to see how it changes. You might want to scan multiple colours. If so use the multiple scana. Turn off smoothing and stack scans unless you want to be stacking engraving on top of engraving.

Alternative Trace

Using the above method provides an outline of the bitmap. For tracing letters or line art, AutoTrace provides a centerline trace option.

Available as an open source command line Java tool, or online.

For a black and white bitmap, something like: autotrace -centerline -color-count 2 -input-format bmp -output-file file.svg -output-format svg file.bmp

Read the manual for full details.

Layers and Ordering

Layers are ways of separating out objects in Inkscape. However these are not supported exporting to dxf and importing into the Lasercut software. Colours are supported, if the same pallette of colours are used that the LaserCut software uses. Black (0,0,0), Red (255,0,0), Blue (0,0,255) and Green (0,255,0) correspond to automatically creating layers in LaserCut, allowing you to select which coloured layer is a cut or an engrave and reducing setup time.

Hiding layers also seems to be unsupported, with hidden layers being saved into the dfx. Better to prepare a duplicate (copy, new, paste) of your design with nothing but the design in (no empty layers or guides) before an export.

Once imported into the Laser software menu:

  • Go to 'Tools/Unite lines' and accept the defaults.
  • Then manually select each segement, and "colour" it to the appropriate layer.

As an alternative for complicated layers

  • Create a rectangle around the whole design
  • Save as svg
    • open original svg
    • delete all but one layer, and the bounding rectangle
    • save as dfx
      • repeat until all layers are available
  • Open lasercut software
    • Import a dxf file
    • Go to 'Tools/Unite lines' and accept the defaults
    • "colour" it to the appropriate layer
    • Align bounding rectangle
      • Repeat until all layers imported
  • Delete bounding rectangles

Path operations

They can mainly be found here. I'll cover the laser cutting view of things.

http://kalaalog.com/2007/11/01/Inkscape-path-operations-basic-tutorial/

Path -> Union

Joins the paths together. This is very useful for building up shapes all to be cut the same way.

Path -> Difference

Removes the higher one from the lower one (in layer terms). This is good for cutting out shapes, like a bite from an apple.

Path -> Cut Path

This is useful if you are cutting shallow lines in an object and you don't want to do it twice.

Path -> Combine

This is useful as it can fix problems exporting rotated or translated objects (as dxfs don't store transformations). Combining all the pieces into one object solves this problem because it transforms the points of the object and no transformation is stored for the whole object ( as there were two initial objects it would be hard to know how they were transformed). If you want to have multiple layers, combining them all removes all that information. So create dummy objects on each layer and combine them with you desired layer and then remove the points. If you are having problems with combining objects set all their fills to 0.

Alternative method

According to the OpenSCAD manual, you can get sensible DXFs from SVGs by doing this on the command line:

Inkscape -E somefile.eps somefile.svg
pstoedit -dt -f dxf:-polyaslines somefile.eps somefile.dxf

Or in a single line:

Inkscape -E /dev/stdout somefile.svg | pstoedit -dt -f dxf:-polyaslines - somefile.dxf

This is tested and working. Colours from the original SVG file persist through the conversion process, so this can be an easy way to set up layers for the laser cutter software.

Note that for this to work you might have to save the SVG file as a 'standard svg' file in Inkscape first, rather than an the default, which is an 'Inkscape SVG' file Oskar Pearson

The imported DXF will end up being tiny (something like 1/10 of its Inkscape size), and will also be positioned a long way off the left and bottom of the on-screen laser bed. The size *might* be fixable by using the -mm argument:

pstoedit -dt -f 'dxf:-polyaslines -mm' somefile.eps somefile.dxf

this is tested and works well. There are also arguments for rotating, translating, and scaling the output of pstoedit, but those need further experimentation.

Useful Plugins

Vector Fonts

Hershey Text renders text as a vector line. This allows for a faster "cut" than engraving our outlining a raster font.

More information

Cambridge Makerspace has some tips for Inkscape for laser cutter design.

Vauxhall's Cut Laser Cut has some tips on using Inkscape for laser cutter designs, but stops before .DFX export