Welcome to kinet2pcb’s documentation!¶
kinet2pcb¶
Convert KiCad netlist into a PCBNEW .kicad_pcb file.
Free software: MIT license
Documentation: https://devbisme.github.io/kinet2pcb .
Features¶
Converts a KiCad netlist file into a
.kicad_pcbfile that can be edited with PCBNEW.
Credits¶
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Installation¶
This is a Python package, and it requires the pcbnew module included with KiCad.
Therefore, you’ll have to install it using the pip executable included in the
KiCad bin directory like so:
$ pip install kinet2pcb
This is the preferred method to install kinet2pcb, as it will always install the most recent stable release.
You can also install kinet2pcb in the Python interpreter on your system using its pip command,
but your system libraries probably won’t include the pcbnew module.
By default, kinet2pcb adds /usr/lib/python3/dist-packages to the Python library
search path which is where KiCad normally stores pcbnew in a linux system.
If your system doesn’t follow this convention, then you’ll have to search for
the pcbnew.py file and add its path to the PYTHONPATH environment variable.
Usage¶
kinet2pcb can be used as a module to provide other scripts with the ability
to create KiCad PCB files, but it is mainly intended to serve as its own stand-alone utility:
usage: kinet2pcb [-h] [--version] [--input file] [--output [file]] [--overwrite] [--nobackup]
[--libraries footprint_dir [footprint_dir ...]] [--debug [LEVEL]]
Convert KiCad netlist into a PCBNEW .kicad_pcb file.
optional arguments:
-h, --help show this help message and exit
--version, -v show program's version number and exit
--input file, -i file
Input file containing KiCad netlist.
--output [file], -o [file]
Output file for storing KiCad board.
--overwrite, -w Allow overwriting of an existing board file.
--nobackup, -nb Do *not* create backups before modifying files. (Default is to make backup files.)
--libraries footprint_dir [footprint_dir ...], -l footprint_dir [footprint_dir ...]
Specify one or more directories containing .pretty footprint libraries.
--debug [LEVEL], -d [LEVEL]
Print debugging info. (Larger LEVEL means more info.)
Examples¶
Assuming you’ve generated a KiCad netlist file called example.net, then
the following command would create a KiCad PCB file called example.kicad_pcb:
kinet2pcb -i example.net
If a files called example.kicad_pcb already exists, then kinet2pcb will
halt and not over-write the file. To override this behavior, use the -w option:
kinet2pcb -i example.net -w
The above command will rename the pre-existing example.kicad_pcb file to
example.kicad_pcb.bak.
If you have one or more libraries of part footprints that are not listed in your
KiCad fp-lib-tables file, you can specify them on the command line like so:
kinet2pcb -i example.net --libraries /my/path/to/lib_1.pretty /my/path/to/lib2.pretty
If you have a lot of libraries that are all stored in a single directory, then you can shorten the command by just listing the parent directory:
kinet2pcb -i example.net –libraries /my/path/to
Preventing Disasters¶
A lot of work goes into creating a PCB.
For this reason, kinet2pcb makes a backup of any .kicad_pcb file it is about to overwrite
(using file names such as example.1.kicad_pcb, example.2.kicad_pcb, etc.).
You can turn off this behavior using the --nobackup option.
In addition, if kinet2pcb would overwrite an existing .kicad_pcb file
and the --nobackup option is enabled, then you must also use the --overwrite option
or the operation will be aborted.
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/devbisme/kinet2pcb/issues.
If you are reporting a bug, please include:
Your operating system name and version.
Any details about your local setup that might be helpful in troubleshooting.
Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” and “help wanted” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “enhancement” and “help wanted” is open to whoever wants to implement it.
Write Documentation¶
kinet2pcb could always use more documentation, whether as part of the official kinet2pcb docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/devbisme/kinet2pcb/issues.
If you are proposing a feature:
Explain in detail how it would work.
Keep the scope as narrow as possible, to make it easier to implement.
Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up kinet2pcb for local development.
Fork the kinet2pcb repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/kinet2pcb.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv kinet2pcb $ cd kinet2pcb/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
The pull request should work for Python 2.7, and >=3.6
Credits¶
Development Lead¶
Dave Vandenbout <devb@xess.com>
Other Contributors¶
History¶
1.1.2 (2024-02-26)¶
Added FPID setting to part, otherwise only the fp_name and not the fp_lib appears in the final board.
Added iterator to connect all pads of the same number to a given net. This mimics the behavior of the GUI editor.
Added Python 3.12 to test environments.
1.1.1 (2023-09-10)¶
net.get_pins() is now used when a SKiDL Circuit object is used as the input for generating a PCB.
1.1.0 (2022-08-13)¶
Added –libraries command-line option to specify footprint library directories.
1.0.1 (2022-06-30)¶
Fixed incompatibilities with KiCad V6 Python API (pcbnew).
1.0.0 (2021-09-16)¶
Decided this tool was mature to the point it could be called 1.0.0.
0.1.3 (2021-05-19)¶
The parts in the PCB are now given a non-overlapping arrangement grouped according to their hierarchical nesting.
0.1.2 (2021-05-18)¶
The
kinet2pcb()function will now generate a KiCad PCB file when given a netlist file name, a PyParsing object, or a SKiDL Circuit object.kinet2pcbcan now be installed in the default Python interpreter on a system and it will look in/usr/lib/python3/dist-packagesto find thepcbnewmodule installed by KiCad. If thepcbnewmodule is not found there, add the correct location to thePYTHONPATHenvironment variable.
0.1.1 (2019-03-09)¶
Now runs under Python 2 & 3.
0.1.0 (2019-10-28)¶
First release on PyPI.