Select the paths representing the contour toolpaths.From the Fill and Stroke (Ctrl-Shift-F) dialog, turn off the fill and set the stroke width to a small value.On the Path menu, choose Union (Ctl-+) to turn your selection into an object with the pocket’s shape.On the Path menu, choose Stroke to Path (Ctrl-Alt-C) to convert the stroke to a filled closed curve.From the Fill and Stroke (Ctrl-Shift-F) dialog, change the stroke width to your tool diameter.Select the set of paths representing the pocket’s toolpaths.Unlike V-carves, there’s a bit more involved when reconsituting geometry from G-code. If you import with labeled groups and end up with a huge stack of labels, your file likely was 3D or had ramping.For some G-code files, grouping by Z (with or without labels) can be a convenient way to separate pockets from profiles, et cetera.Ignoring Z often gives the cleanest results, and it is all but necessary if the G-code ramps between Z depths.Choose what to do, if anything, with Z.If you’re importing a very basic G-code file, using the actual tool diameter may save you steps.If you’re going to be working with pockets and such, it’s often easier to choose a small value so your imported paths show up as lines and are easier to distinguish.
On the Path menu, choose Union (Ctl-+) to merge the pieces into one outline.For V-carves, this is actually quite easy. Now you need to turn it back into something resembling the original geometery. The arcs will be broken up into line segments so they can be converted into SVG path data. If your V-carve G-code has G2/G3 arcs (you can open it in Notepad++ and just search for G2 and G3), you’ll need to choose a curve interpolation step size.Generally, this is zero, but if the G-code is zeroed to the table not the top of the stock, you’ll need to enter that. Choose the right value for the top of your stock.Using too small an angle will make everything deflate, and you’ll end up with spikes instead of corners.Using too large an angle will make everything inflate and break, and you may even get a message if it breaks the math.This is the included (full) angle, so if the tip cuts a 90-degree V, enter 90, not 45. Turning it back into something worthwhile may be a bit more work, but in many cases a good result can be reached without too considerable an effort. In “Laser Mode”, moves without the spindle on and at non-zero speed are ignored.If any arcs have a K parameter, that’s between them and their creator.In any other mode, all moves are interpreted as being at constant Z.In V-carve mode, Z-axis data is used to regenerate the geometry.SVG is inherently two-dimensional, so importing a fully 3D carve is unlikely to give any useful result.This cannot be helped, at least within the rules of this universe. sharp inside corners) in the original design may not be reflected in the G-code. G-code can be imported, but some manipulation will be required in order to achieve cromulence.
Importing G-code made for 3D printing is not an intended use of this extension and will likely not give cromulent results.This is intended to enable hobby CNC users to recover geometry from G-code files in order to reconstitute SVG design files.I especially would like to have some V-carving files with G2/G3 arc moves, as I had none of those to test with… except a lumpy folder graphic I bodged by hand.Īn Inkscape input extension to add support for some G-code files to the File/Import… dialog.
And if you’d like to donate some G-code files to fill in my testing set, I would be grateful. Grab it, try it, and report on your results. The extension is now hosted on GitHub: ImportGCodeĪnd just for convenience and safe keeping: ImportGCode.zip (10.3 KB) I’ve been working on this extension for a bit now, and I’m quite surprised by how much geometry you can reconstitute from many G-code files with only minor effort (and V-carves can give results practically indistinguishable from the originals). sharp inside corners) cannot ever be represented fully by the output. Okay, I don’t imagine I’m perfect, and I still don’t have a good, complete set of G-code files to throw at it for testing, but it looks like I’ve reached the point of being able to throw an initial public release of my new Inkscape input extension up on GitHub.Ĭreating G-code from a design is a transformative event, and depending on geometry and exactly what you’re doing, some details (e.g.