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:
- 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.
- Convert the object to a path (Inkscape: Path -> Object to path). I don’t know if this is really necessary in all cases.
- Save a copy of the file using the .eps file format (Encapsulated PostScript). Use the default settings.
- Get the nice little tool pstoedit.
- 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.
- 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.