We test PCBmodE with Python 3.7 under Linux, but it may or may not work on other operating systems.
It comes in the form of a installable tool called
pcbmode which is
run from the command line.
What you’ll need¶
- Python 3.7+
- Inkscape 1.0+
- Text editor
Installation in a virtual environment¶
Use a virtual environment to keep PCBmodE in its own isolated
environments, for example Python3’s
venv. If you don’t have
venv, get it like this:
sudo apt-get install python3-venv
These instructions describe how to build PCBmodE for use in a virtual environment. To be able to build python-lxml (one of PCBmodE’s dependencies) you need to install some system-level development packages. On Debian based systems these are installed like this:
sudo apt-get install libxml2-dev libxslt1-dev python-dev
You’re reading the documentation for version 5 of PCBmodE, ‘Cinco’. The link below will get you that branch while we’re working on it, and before its release.
Get the PCBModE source from GitHub.
git clone https://github.com/boldport/pcbmode/tree/cinco-master
Now run these commands to create a virtual environment, for example in
pcbmode-env/ next to
pcbmode/. Then create the
virtual environment like this:
python3 venv -m pcbmode-env source pcbmode-env/bin/activate cd pcbmode
If you want to just run PCBmodE, run
python3 setup.py install
but if you want to develop it, run
python3 setup.py develop
After installation, PCBmodE will be available in your path as an
pcbmode. But since it was installed in a virtualenv,
pcbmode command will only be available in your path after
source pcbmode-env/bin/activate and will no longer be in
your path after running
deactivate, which gets you out of the
virtual environment. You will need to activate the virtualenv each
time you want to run
pcbmode from a new terminal window.
Nothing is installed globally, so to start from scratch you can just follow these steps:
deactivate # skip if pcbmode-env is not active rm -r pcbmode-env cd pcbmode git clean -dfX # erases any untracked files (build files etc). Save your work!
To see all the options that PCBmodE supports, use
By default PCBmodE expects to find the board files under
relative to the place where it is invoked.
Paths where PCBmodE looks for things can be changed in the
Here’s one way to organise the build environment
beautiful-pcbs/ pcbmode-env/ pcbmode/ boards/ my-board/ # a PCB project my-board.json my-board_routing.json components/ shapes/ docs/ ... cordwood/ # another PCB project ...
To make the
my-board board, run PCBmodE within
pcbmode -b my-board -m
Then open the SVG with Inkscape
If the SVG opens you’re good to go!
PCBmodE processes a lot of shapes on the first time it is run, so it will take a noticeable amount. This time will be dramatically reduced on subsequent invocations since PCBmodE caches the shapes in a datafile within the project’s build directory.