A plugin for Blender 3D modeling software which will import SVG exports of a Gerber file into an accurate virtual model of the PCB.
I had two reasons for making this.
First off, I want to start 3d-printing out cases for some of my Arduino or Rasberry Pi hobby projects, and wanted an accurate virtual model of the boards I order for designing those casings. Virtual models of most components can be downloaded right from the manufacturers for this, but not custom PCB's or SMT's.
Secondly, sometimes I feel that the 2D layout is not suffecient for examining a PCB before placing the order -I recently got one in with a tiny mistake (I left the pads for resistors and transitors from the SMT in the PCB I planned to solder by hand for a prototype). I would have caught that easily in a 3D virtual model, and now have to wait a couple weeks for the corrected design -I'm not paying rapid shipping rates for two dollars worth of PCB's to come from China.
I figure I'm not the only one who does this stuff with my Arduino or Rasberry Pi projects so I'd share it on here.
Current Instructions:
1.) using GerbV 2.7 export the gerer files as SVG files, each layer needs to include the board outline to import correctly for the automated parts --must be done manually for now, I'm working on automating this part, or eventually I may take the time to figure out how to translate the machine vector instructions in the Gerber files into an svg myself. I chose this format because personally I like to put these layers directly into the webpage documentation I make for my Arduino projects, so I already have them in a project.2.) include a filenames.txt file in the folder with the svg (I always use 2-layer boards with top silk screen and solder pads on the top and the bottom, the filenames.txt file is included in this repository)
3.) run the import_pcb.py script
A video walking through these instructions can be found at https://youtu.be/a3hJ6541-y0
Since I mentioned that I use these svg files to generate a gerber viewer in webpage documentation, figured I would go ahead and include that here too. Instructions:
put all layers of a pcb into a folder named like those listed in filenames.txt
include filenames.txt and create_pcb_viewer.py in the folder
run create_pcb_viewer.py and embed, or copy, the result into the webpage documentation
I also included the scripts to work with one single SELECTED layer at a time, if corrections are necessary or if you prefer to build the layers one at a time. Pieces from the original will be 100 units in the positive x direction from the original position if corrections are being made to a layer.
The testing so far was PCB created with EasyEDA online PCB editing software, SVG files exported from GerbV 2.7 Gerber Viewer Software, and scripted with Blender 2.8.3 API.
Early drafts of the Doxygen generated documentation is available at https://francis-chris5.github.io/GerberToBlender/
Here's the result of running this plugin, one solid single piece model representing the board with 1 meter in Blender equal to 1 millimeter in the real world. I've been downloading models of common components for Arduino projects from GrabCAD.com, those slide right into the boards generated by this plugin, allowing a more detailed inspection of an idea before an order for the PCB's are placed.
And here's a picture with components situated in a board generated by this plugin (I haven't bothered to change the leads on the transistor model I have yet, but everything else is fits nicely in the model). Note that with the viewport set to "SOLID" the traces inside the PCB are clearly visible making it easy to inspect the circuit virtually, the whole point of this project.