SVG to G-code... "hello world" !

Today I wanted to print more with doing less work. Making the previous program took quite some time and concentration for making some straight lines. Nothing Fancy about that.

I wanted to have a program where you can print (plot) fancy work. In a way that drawings made by my kids (when they will do so in the future) can be plotted. I searched and found an Inkscape extension (I frequently use Inkscape). It didn't work for me.

What I actually wanted was to get all the points from a line and convert them to coordinates in G-code. Basically it means instructing a machine to go to point X... Y...

Here is how I came from this:

to this:

I needed to investigate the .svg file to see if I could easily change the coordinates. I opened Inkscape and first drew a simple line consisting of a few points. I found out that (0,0) is the upper left corner of the canvas. I drew the line in millimeters but the .svg file gives coordinates in 'px' (pixels). After some calculating I decided to scale the line in Inkscape so my coordinates would be in mm. (90 dpi (pixels per inch) gives 28,222 pixels per mm so the line needed to be scaled to 28,2222 percent of the original size)

What is x and y in Inkscape translates to y and x in the .svg file... good to know.

Now the file needs to be opened in a text editor. I highly recommend Sublime Text 2 for this since it is a very powerful editor (I'll come to that later on).

Here are the coordinates:

Delete the rest of the file since we don't need it. Also in my case the first coordinate was written as 0,-1.484375e-5. I changed it to 0,0

Now here's what is so shizzle about Sublime Text... Select one space, and with a shortcut you can select ALL spaces. If you then press "backspace" and after that "enter" and type "G1 Y" you have changed all spaces in "G1 Y"!!! Timesaver!!!

Select all spaces:

Change all spaces:

The same goes for the comma, select "," and change all to " X"

Finish the textfile (add other G-code for putting the pen on paper etc) and it is ready to use for printing...


Verbind de puntjes

Simon is gek op tekeningen waar hij puntjes moet verbinden. Ik maak ze ook voor hem. Hoe??? Een kleine tutorial, lees verder!

  1. Download en installeer Inkscape.
  2. Als je geen inspiratie hebt, zoek en vind dan een leuk plaatje (vraag de opdrachtgever naar zijn/haar mening).
  3. Open Inkscape.
  4. Als je een plaatje wilt overtrekken ga naar File -> Import.
  5. Pak de 'node' tool en teken als 1 doorgetrokken lijn dat wat de opdrachtgever moet maken.
  6. Selecteer de getrokken lijn.
  7. Da naar Extensions -> Visualize Path -> Number Nodes.
  8. Voila!
  9. Onderaan deze post staan al wat resultaten die je kunt downloaden.

De 'node' tool:
Drawing a line

Visualize nodes:
Visualize nodes of a line in Inkscape

connect the dots

Onderstaande heb ik al gemaakt voor Simon, ik ga echt niet vertellen wat het is, dat moet je zelf maar uitzoeken (p.s. de naam geeft een hint).

  1. locomotief
  2. ezel
  3. koe