Convert G-code to SVG
This question is a bit of an edge case for what 3D Printing SE covers, but it has to do with topics most closely related to 3D printing.
I've found a plethora of ways to convert SVG (vector graphics) into G-code, but I can't seem to find any way to take a series of G-code movements and convert them into lines as a vector graphic.
Why would I want to do this, you ask?
I have a Silhouette, which can cut paper, or draw on paper, depending on if you insert a knife tool or a pen tool.
I have a polar draw bot (Makelangelo) which doesn't want to behave... the motors keep losing steps when the number of steps/second is low, and thus positioning gets off.
I want to use the drawing algorithms in the Makelangelo software to create drawings using my Silhouette, but the Silhouette wants vector graphics, not G-code.
The simplest way in my mind to do this is to convert G-code generated in the Makelangelo software, convert it to a standard vector format (SVG), and import it into Silhouette's software suite.
Alternately, if there's a way to send G-code directly to my Silhouette and have it work, that'd be a much better solution.
Sort of. I am dealing with x, y, and "z", where z is lifting/lowering the pen. So 2D.
Did the answer (or its comments) help you at all? I noticed that the question still appears in the answered list. If the answer helped could you mark it as accepted? As a beta site we need to keep the number of unanswered questions down. Thanks.
There are a number of programs available which will convert g-code to DXF, a common drawing format. If your device does not support DXF directly, there are a number of programs to convert DXF to SVG. I would paste links but a quick search with your favorite search engine should give you useful results. The better conversion programs will allow you to eliminate movement g-code entries, which prevents connections between lines. I did not paste links, as my research shows such variety as to be overwhelming.
The conversion itself should be fairly easy using such tools, but most such tools will convert each gcode movement to a separate vector. So, for example, if your drawing was a circle you'd get an awful lot of tiny strokes, instead of a single SVG, DXF, or similar "circle" object. Some devices do have gcode "arc" commands, but they might or might be used in your files. That should work fine, so long as you don't need to edit or change anything....
I have run into that which you describe. It can make the result unpalatable, to be sure. I believe that the free program Inkscape, which reads vector files, has the ability to smooth such tiny strokes, but that turns a semi-automatic process into a much more manual one.
I've found a possible solution, but don't have a file suitable to test. The web site https://makeprintable.com/ will accept g-code files (extension .gcode) and convert to an STL file. In the test I attempted, the gcode was for an outline of a rectangular block and the stl created was vertical. I used Meshmixer (free) to rotate it to the horizontal, then used Slic3r (free) to slice to SVG. When opened in Inkscape (free) it appeared damaged, but the paths were there when clicked. When opened in Illustrator, same result. The paths exist and need to be colored?
License under CC-BY-SA with attribution
Content dated before 7/24/2021 11:53 AM
tbm0115 7 years ago
I've converted gcode into an XYZ format before. With a couple Regular Expressions, you can reverse engineer a gcode file relatively back into 3D model. Is this kind of what you're looking for?