Guides/Inkscape for Laser Cutting: Difference between revisions

From London Hackspace Wiki
m (Added comment about saving the SVG as an 'Standard SVG' file first, rather than as an 'Inkscape SVG' file)
Line 152: Line 152:
   pstoedit -dt -f 'dxf:-polyaslines -mm' somefile.eps somefile.dxf
   pstoedit -dt -f 'dxf:-polyaslines -mm' somefile.eps somefile.dxf


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




[[Category:Guides]]
[[Category:Guides]]

Revision as of 13:37, 27 November 2012

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

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.


Getting Gcode straight from Inkscape

Gcodetools is a specialized extension that can export path's to Gcode straight from Inkscape. It works on Windows, Linux and MacOS and is licensed under GNU GPL. Gcodetools has additional functions to fill the path's area to make laser engraving, powerful scaling, position and orientation systems, tools library, etc.

To install it unpack the archive into ~/home/.config/inkscape/extensions on Linux and Program Files\Inkscape\share\extensions\ on Windows.

Extension, source codes, helps and tutorials available at the from Gcodetools developer's site

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 color inside the line. Stroke is what colour the line is (and a various other things that aren't useful for laser cutting).

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.


Layers and Ordering

There are two different ways putting one thing in front of another, or at least sound like they are about that. Layers are ways of separating out objects. They can be exported to dxfs and these carry over when imported into lasercut.

Front and back refer to which object will be visible in front of each other. You cannot rely on this visibility in laser cutting (it always draws the lines), so we need to know how to do operations on paths to cut them and modify them. This involves moving things to the front and back, which is why I have covered it.

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.