Intro: How to Modify Fritzing PCB .svg Files for Production
https://www.instructables.com/id/PCB-designing-and-isolationmilling-only-using-free/ describes how to process SVG files produced by Fritzing so they can be exported to MakerCAM to generate gcode for CNC milling.
When I make a PCB, I usually want to make the connector pad circles larger and the leads thicker. My soldering skills are pitiful, so more space helps. This is tedious, finicky and cumbersome in Inkscape, especially if the PCB is two sided, since it's so easy to inadvertently move a component and lose alignment between the sides.
This Instructable presents pcbsvg, a Python program that allows changing the size of selected circles and thickness of selected lines, without changing their positions. It also allows for reordering selected circles at the end of the file, meaning these circles will be rendered on top.
Items are selected for processing by painting them a color - the default is red, ff0000. To do several different operations, I find it useful to mark items in a single SVG in various colors and then run pcsvg several times.
pcbsvg can be run as executable, assuming your Python interpreter is in /usr/bin/python. Alternatively, it can be called via "python pcbsvg ..parameters...". The usage is as follows:
pcbsvg [-h] [--help] [--line_w=LINE_W] [--diam=DIAM] [--reorder] [--color=COLOR] infile outfile
infile: input SVG file
outfile: output SVG file
-h, --help: print usage
--line_w: new line width in mm of selected lines
--diam: new diameter in mm of selected circles
--reorder: if present, selected circles are sorted on top and their interiors are made opaque, so they knock out what's below.
--color: selection color, in hex RGB. Default is red, ff0000.
At least one of the --line_w, --diam or --reorder must be specified.
The latest version of the code can be found on GitHub: https://github.com/imageguy/cnc_tools
You are welcome to use, modify and share this code as you see fit.
The steps will show how I prepared a PCB for MakerCAM using Inkscape and pcbsvg. For each step, I provide both the SVG files and the image of each file. I hope you will find this Instructable useful.
Step 1: Prepare Fritzing SVG for Processing
bottom_00 is the SVG file from Fritzing, a copy of *_etch_copper_bottom_mirror.svg. To get bottom_01, I ungrouped all the groups (pcbsvg will fail if it encounters any groups) and erased the board outline.
I'll resize all the circles to 2.35mm, which is as large as I can safely make without MakerCAM merging them. I'll resize most of the leads also to 2.35mm. Blue leads will be slightly narrower (they'd merge with neigboring items at 2.35mm) and green leads will be wider.
Step 2: Run Pcbsvg
I now run pcbsvg three times:
pcbsvg --line_w=2.35 --diam=2.35 --reorder bottom_01.svg bottom_02.svg
pcbsvg --color=0000ff --line_w=2.00 --diam=2.00 bottom_02.svg bottom_03.svg
pcbsvg --color=00ff00 --line_w=3.00 bottom_03.svg bottom_04.svg
Step 3: Final Operations
This PCB contains a bunch of MOSFETs whose connector pads are more complex constructs that make it harder to select what I need in MakerCAM. bottom_04_nopath removes them. I will import this file into MakerCAM to select places to drill.
bottom_05 strips out the colors and changes the line ends to square. This is essentially how the finished PCB should look. bottom_06 is the SVG converted to a single path. Notice how we lost the holes, since it is the *union* of all the items. I will import this file into MakerCAM for isolation milling.
Title picture shows the resulting PCB after CNC milling.