Thursday, 20 June 2013

Parsing Inkscape SVG files to create g-code

Here's a screenshot of our first test - and it's all looking rather encouraging!


I actually got the generate g-code (after parsing the SVG file and applying modifiers) to match the positioning of the objects in Inkscape - in the example above, you can see that the x co-ordinate is the same in both the VB app and in Inkscape.

The y value is different but only because Inkscape insists on putting the origin (0,0) at the bottom left hand corner of the document, whereas most of us (and most other apps) expect it to be top-left. In fact, when I consider that my svg image is 99.5mm high, the numbers do stack up.

In my g-code I had the y axis value as 10.41 whereas Inkscape insisted it was 89.11.
However, subtract my 10.41 from 99.5 and you get....erm.... 89.01
So it looks like my outline is actually 99.52mm (so I was 0.02mm out!). I think this kind of tolerance is acceptable for a machine that has a 0.1mm accuracy.

All that remains now is to work out how many turns on our CNC we need to make to travel 1mm and get all that coded into the Mach3 interface. With a bit of luck we'll be able to drill some test boards (and hopefully actually print some PCBs) very, very soon!