In the past I have used expensive packages such as Mentor Graphics PADS, which these often have a *.emn file import utility. This feature allows for a mechanical designer to create a CAD file or model of the PCB in 2D or 3D and export the PCB outline to a *.emn file. This file can then be imported into the EDA package as the Board Edge layer. However, KiCAD does not currently support importing such files. My hope is that this feature is on the radar for future developments and feature enhancements of KiCAD. It would be great if multiple file formats were supported as well, such as *.dxf, *.idf, *.iges, and *.step as most modern solid modeling programs support these common export formats (wink, wink @KiCAD). On a side note, and I think I saw a feature request for this a while back, it would also be nice to have a built-in 3D component import utility that would accept multiple 3D formats, such as *.VRML, *.3DS, *.stl, *.iges, *.step, etc (again wink, wink @KiCAD). The current process for bringing in new - from scratch - 3D components is fairly painstaking, especially if you don't have a 3D modeling package like SolidWorks at your disposal.
On with the tutorial... It's easy enough, in KiCAD, to create straight lines, polygons, circles and 90 degree arcs, but what happens when you need a slightly curved indentation, or outdent (i.e. an arc greater than 0, but less than 90 degrees)? Maybe a parabolic profile or an ellipse? Well if such features are critical to your design, then strictly from within KiCAD, you will find this to be a show-stopper. However, if you're anything like me, there is a voice in your head that tells you, "No..... There's got to be a way around this..." And if you have enough persistence, you will probably find a way. And that I have with this particular endeavor.
Draw the irregular PCB outline in a program outside of Pcbnew (this is the name of the PCB layout editor in KiCAD). This
article I found said they used GIMP to draw the board outline. Really, any 2D drawing or diagramming program could be used, such as Paint, Visio, PowerPoint, Word, freeCAD
, Google Sketchup
. Some of these CAD packages I have not yet evaluated, but some look much more polished than others. For this example I am using Paint.NET
to create a simple elliptical PCB outline.
Once you have created the outline drawing, save the file as a monochrome bitmap image.
Use KiCAD's "Bitmap2Component" utility to open your bitmap image file and convert it to a library module, or *.mod file. To simplify things, make sure the board outline is what is shown in white in the Bitmap2Component utility. Choose the "Pcbnew old fmt (.emp)" option (it seems the new format is not currently supported?). You can invert the image with the "Normal" or "Negative" options. Click the "Export" button and browse for a location and name the file as Outline.mod, or any other *.mod.
Use a text editor (recommend notepad++
) and open the .mod file you just created. Note: all of KiCAD's files (schematic, PCB, CvPCB, Netlist, project) are text-based, which makes manual editing easier if the need arises as in this case.
Find and delete the lines that start with "Li", "T0", and "T1". See this document
for what these designations mean if you're interested.
Find all lines that start with "DP" and change the last numeric value to "28", which is the layer designation field. In KiCAD layer 28 is reserved as the Board Outline layer.
Save and close the file when finished with these manual edits.
Open KiCAD and start Pcbnew.
Go to "Preferences > Library" and add the library module file which has just been edited and click "OK".
Go to "Place > Module" and browse for a footprint named "LOGO" and insert it into the layout. If your colors are set as the default, the board outline footprint you just placed should be yellow.
If there is any extra yellow around the board outline where it is not supposed to be as above, you'll need to go back to step 3 and delete out the first entire section that starts with "DP". The section consists of the line that starts with "DP" followed by usually several lines starting with "D1". Then repeat the remaining steps again.
I hope this tutorial will help some individuals that are needing to create an irregular board outline using KiCAD. I wouldn't consider myself an expert at KiCAD, but would be glad to answer questions via the blog reply, social media links or email if I can. Hopefully with future releases of KiCAD these types of mechanical integration will make their way into the great EDA package that it already is. Thanks for reading.