Making NC drill files and GCode from a PDF (via In. ![]() Parsing Inkscape SVG files to create g-code.Making a digital board game from paper and copper.So the easiest solution we can think of is to place a dot at 0,0 and give it it's own unique special colouring (we're thinking black for now).Īfter parsing the entire document, we should have a set of co-ordinates for our black dot (the origin) which we can then add/subtract from every other dot on the board, to get the correct, absolute position for all our drills holes. Now we've no idea if this is going to be consistent for all shapes drawn in future, or what happens if the user were to copy and paste, then rotate or flip their image before exporting as svg. If we read the path co-ordinates that follow the m command in the svg attribute, it looks like the path is being drawn from the right-most side of the path, to the left (the x-part of each of the first few curve points is negative, suggesting the path is being drawn from right-to-left). Our first drill hole should be a 0,0 but the x-axis value is 1mm.Įven applying the "master translation" doesn't fix this, since the x-part of the command translate(0,-962.35975) is zero. Saving the file as a plain svg seems to fix the problem: every drill hole is now a path and there are no nasty inline transformations to deal withĪs you can see from the svg snippet above, the holes are now correctly spaced (the difference between x values is 12.54-3.54 = 9 pixels and at 90dpi, 9 pixels = 9*25.4/90 = 2.54mm or 0.1") but their absolute location is still incorrect (3.54 pixels = 3.54*24.5/90 = 1mm). So for now, we just use the Inkscape menu - Path -> Object to path - and turn all our circles into paths. But then we're in danger of spending more time building our tools instead of getting something working to enable us to drill some copper boards and - ultimately - make batches of PCBs. Now what we really should be doing is updating our g-code generator to parse all different types of svg files. Users who use this extension to generate G-Code for a machine other than a MakerBot CupCake CNC with a Unicorn Pen Plotter attachment do so at their own risk. In this file, we had "circle objects" rather than paths and it was each of these objects that had an inline transformation. This is an Inkscape extension that allows you to save your Inkscape drawings as G-Code files suitable for plotting with the MakerBot Unicorn Pen Plotter. In the PDF, every shape was a "path" - even the circles that made up our drill holes. Now it's worth noting that our PCB svg (generated by loading a PDF, generated by CutePDF from inside ExpressPCB) is noticeably different to this latest file: this file we created by drawing a circle then copy-and-pasting the dot(s) repeatedly until we had a grid of 6圆 drill holes.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |