Getting a custom board outline from an .svg file into KiCad

I recently stumbled upon a problem which I thought could be easily solved when I wanted to do design a PCB with an unusual board outline (e.g. a star-shaped board).

Since I am not such a great artist when it comes to painting or drawing, I downloaded an .svg file of the shape from Wikipedia and I thought it could be easily imported in KiCad. But this is apparently not possible using a direct approach (at least not up to version 4.0.3 at this time of writing). KiCad only supports .dxf files as of now. So you must first convert from .svg to .dxf.

After some searching on the internet and some frustrating experiences later (e.g. the shape dimensions were extremly off after importing), the following workflow seems to do the job:

  1. Open the .svg file in Inkscape and adjust the shape to your needs. That means cropping and more important scaling it to the size of the board outline. Use real dimensions like “mm” and not “px”. Set the dimensions in the document settings.
  2. Convert the object to a path (Inkscape: Path -> Object to path). I don’t know if this is really necessary in all cases.
  3. Save a copy of the file using the .eps file format (Encapsulated PostScript). Use the default settings.
  4. Get the nice little tool pstoedit.
  5. Convert the .eps file to a .dxf file using the following command line: pstoedit -dt -f “dxf:-polyaslines -mm” shape.eps shape.dxf where shape.eps is the source file from step 3.
  6. Finally you can import the newly generated shape.dxf file in KiCad’s Pcbnew.

This approach does not only apply to the board outline, but you can also use this technique to import shapes for example to the silkscreen. Just select the desired target layer in KiCad.

I hope someone finds this helpful, at least I think you can do a lot of cool things with custom shapes. 😉 Maybe some time later this post will become obsolete when KiCad eventually gets support of native .svg imports.

André

By André Heßling

I am an electronic engineer living in Voerde, Germany.

5 comments

  1. Thanks, I think it is very useful tip. Some boards need to have specific cuts to match the mounting place.

    1. There is now the following set of extension scripts for Inkscape to allow SVG path -> PCB layout track conversion:

      https://github.com/erichVK5/inkscape2pcb

      These can be added to your inkscape extensions folder, after which paths can be exported as a gEDA PCB / pcb-rnd compatible footprint, which Kicad can load without difficulty.

      Have fun,

      Erich.

  2. Hi,
    I had hopes this might work but I get the error below…

    C:\Users\Me\Documents\Inkscape>pstoedit -dt -f “dxf:-polyaslines -mm” shape.e
    ps shape.dxf
    pstoedit: version 3.70 / DLL interface 108 (built: Jan 1 2015 – release build –
    MS VC++ 1600 – 64-bit) : Copyright (C) 1993 – 2014 Wolfgang Glunz
    running-win command line: gswin32c -q -dDELAYBIND -dWRITESYSTEMDICT -dNODISPLAY
    -dNOEPS C:/Users/Chris/AppData/Local/Temp/psin4
    Interpreter failure: -1
    running-win command line: gswin32cgswin32c.exe -q -dDELAYBIND -dWRITESYSTEMDICT
    -dNODISPLAY -dNOEPS C:/Users/Chris/AppData/Local/Temp/psin4
    Interpreter failure: -1
    PostScript/PDF Interpreter finished. Return status -1 executed command : gswin32
    c -q -dDELAYBIND -dWRITESYSTEMDICT -dNODISPLAY -dNOEPS C:/Users/Chris/AppData/Lo
    cal/Temp/psin4
    The interpreter seems to have failed, cannot proceed!

    Have you seen this before? I am on Windows 7 64.
    Thank you for any help.

Leave a comment

Your email address will not be published. Required fields are marked *