I’ve got a custom PCB shape I made in Inkscape that I want to use in a project, but it never imports properly into KiCAD; there are errors about malformed a malformed outline and also spurious lines in the main PCB view. However, the exact same .svg file works just fine if I import it to Fritzing. How can I fix this?
It appears that it tried to get there by fracturing the polygon set (those are the horizontal lines that connect all the holes in the shape to the outer outline).
You can try deleting those and see if that cleans it up.
I changed the parameters in Inkscape to fill = “none” and a thin 0.025mm line for stroke. That got rid of the spurious horizontal lines in KiCAD but I still got errors about malformed “self-intersecting” outlines on the two large circles on the centre line(*). I eventually had to delete those larger circles and re-add them manually based off the dimensions in the drawings for the enclosure.
(*) Jusy by-the-by, KiCAD seems to have interpreted the curves in the original .svg as a series of straight lines for some reason, at least in the main pcb editor view. They seem to be near-as-makes-no-difference smooth curves in the 3d viewer, at least.
Alternatively, you can delete the line segments and replace them with arcs manually, but it’s a bit of a nuisance to do so. It may help if you add some sort of center mark to the original svg drawing.
If the 3D pcb viewer is correct, then the bits with arcs seem to be close enough. It seems it was only the two large circles that were giving the DRC issues, and they were simple to replace with circles from within KiCAD itslelf. Not getting any errors now and the 3d viewer shows all the holes in the right places now
We use NanoSVG to import SVG graphics, and it turns everything into cubic Bezier curves. Since Kicad has pretty weak support for Beziers, we then convert those into polygons (line segments) as you’ve noticed.
You got my attention as I’ve made many PCB’s using Fritzing and you’ll find many of my posts on making Custom PCB’s/etc (look for user: Opera_Night )
For Kicad, it’s even easier.
Do this, in Inkscape, Draw your shape with the Draw/Lines tool, (depending on your shape and details, may need to make it into a Path) Save as DXF. You’re Done!
Import into Kicad.
Example below is Drawn in Inkscape using the Draw tools. Then, selected and Made a Path. Then, Saved as DXF.
Imported the DXF into Kicad on the Edge_Cuts layer…
Note, I did not care about size/flipping/other… you get the idea, though…
ADDED: Example2…. Drew shape, did Not Path it, Simply Saved as DXF then imported into Kicad… Last screenshot…