34 | 35 |
36 |

Welcome to kinet2pcb’s documentation!

37 |
38 |
39 |

kinet2pcb

40 | https://img.shields.io/pypi/v/kinet2pcb.svg 41 |

Convert KiCad netlist into a PCBNEW .kicad_pcb file.

42 | 46 |
47 |

Features

48 |
    49 |
  • Converts a KiCad netlist file into a .kicad_pcb file that can be edited with PCBNEW.

  • 50 |
51 |
52 |
53 |

Credits

54 |

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

55 |
56 |
57 |
58 |

Installation

59 |

This is a Python package, and it requires the pcbnew module included with KiCad. 60 | Therefore, you’ll have to install it using the pip executable included in the 61 | KiCad bin directory like so:

62 |
$ pip install kinet2pcb
 63 | 
64 |
65 |

This is the preferred method to install kinet2pcb, as it will always install the most recent stable release.

66 |

You can also install kinet2pcb in the Python interpreter on your system using its pip command, 67 | but your system libraries probably won’t include the pcbnew module. 68 | By default, kinet2pcb adds /usr/lib/python3/dist-packages to the Python library 69 | search path which is where KiCad normally stores pcbnew in a linux system. 70 | If your system doesn’t follow this convention, then you’ll have to search for 71 | the pcbnew.py file and add its path to the PYTHONPATH environment variable.

72 |
73 |
74 |

Usage

75 |

kinet2pcb can be used as a module to provide other scripts with the ability 76 | to create KiCad PCB files, but it is mainly intended to serve as its own stand-alone utility:

77 |
usage: kinet2pcb [-h] [--version] [--input file] [--output [file]] [--overwrite] [--nobackup]
 78 |                 [--libraries footprint_dir [footprint_dir ...]] [--debug [LEVEL]]
 79 | 
 80 | Convert KiCad netlist into a PCBNEW .kicad_pcb file.
 81 | 
 82 | optional arguments:
 83 | -h, --help            show this help message and exit
 84 | --version, -v         show program's version number and exit
 85 | --input file, -i file
 86 |                         Input file containing KiCad netlist.
 87 | --output [file], -o [file]
 88 |                         Output file for storing KiCad board.
 89 | --overwrite, -w       Allow overwriting of an existing board file.
 90 | --nobackup, -nb       Do *not* create backups before modifying files. (Default is to make backup files.)
 91 | --libraries footprint_dir [footprint_dir ...], -l footprint_dir [footprint_dir ...]
 92 |                         Specify one or more directories containing .pretty footprint libraries.
 93 | --debug [LEVEL], -d [LEVEL]
 94 |                         Print debugging info. (Larger LEVEL means more info.)
 95 | 
96 |
97 |
98 |

Examples

99 |

Assuming you’ve generated a KiCad netlist file called example.net, then 100 | the following command would create a KiCad PCB file called example.kicad_pcb:

101 |
kinet2pcb -i example.net
102 | 
103 |
104 |

If a files called example.kicad_pcb already exists, then kinet2pcb will 105 | halt and not over-write the file. To override this behavior, use the -w option:

106 |
kinet2pcb -i example.net -w
107 | 
108 |
109 |

The above command will rename the pre-existing example.kicad_pcb file to 110 | example.kicad_pcb.bak.

111 |

If you have one or more libraries of part footprints that are not listed in your 112 | KiCad fp-lib-tables file, you can specify them on the command line like so:

113 |
kinet2pcb -i example.net --libraries /my/path/to/lib_1.pretty /my/path/to/lib2.pretty
114 | 
115 |
116 |

If you have a lot of libraries that are all stored in a single directory, then 117 | you can shorten the command by just listing the parent directory:

118 |
119 |

kinet2pcb -i example.net –libraries /my/path/to

120 |
121 |
122 |
123 |

Preventing Disasters

124 |

A lot of work goes into creating a PCB. 125 | For this reason, kinet2pcb makes a backup of any .kicad_pcb file it is about to overwrite 126 | (using file names such as example.1.kicad_pcb, example.2.kicad_pcb, etc.). 127 | You can turn off this behavior using the --nobackup option.

128 |

In addition, if kinet2pcb would overwrite an existing .kicad_pcb file 129 | and the --nobackup option is enabled, then you must also use the --overwrite option 130 | or the operation will be aborted.

131 |
132 |
133 |
134 |

Contributing

135 |

Contributions are welcome, and they are greatly appreciated! Every little bit 136 | helps, and credit will always be given.

137 |

You can contribute in many ways:

138 |
139 |

Types of Contributions

140 |
141 |

Report Bugs

142 |

Report bugs at https://github.com/devbisme/kinet2pcb/issues.

143 |

If you are reporting a bug, please include:

144 |
    145 |
  • Your operating system name and version.

  • 146 |
  • Any details about your local setup that might be helpful in troubleshooting.

  • 147 |
  • Detailed steps to reproduce the bug.

  • 148 |
149 |
150 |
151 |

Fix Bugs

152 |

Look through the GitHub issues for bugs. Anything tagged with “bug” and “help 153 | wanted” is open to whoever wants to implement it.

154 |
155 |
156 |

Implement Features

157 |

Look through the GitHub issues for features. Anything tagged with “enhancement” 158 | and “help wanted” is open to whoever wants to implement it.

159 |
160 |
161 |

Write Documentation

162 |

kinet2pcb could always use more documentation, whether as part of the 163 | official kinet2pcb docs, in docstrings, or even on the web in blog posts, 164 | articles, and such.

165 |
166 |
167 |

Submit Feedback

168 |

The best way to send feedback is to file an issue at https://github.com/devbisme/kinet2pcb/issues.

169 |

If you are proposing a feature:

170 |
    171 |
  • Explain in detail how it would work.

  • 172 |
  • Keep the scope as narrow as possible, to make it easier to implement.

  • 173 |
  • Remember that this is a volunteer-driven project, and that contributions 174 | are welcome :)

  • 175 |
176 |
177 |
178 |
179 |

Get Started!

180 |

Ready to contribute? Here’s how to set up kinet2pcb for local development.

181 |
    182 |
  1. Fork the kinet2pcb repo on GitHub.

  2. 183 |
  3. Clone your fork locally:

    184 |
    $ git clone git@github.com:your_name_here/kinet2pcb.git
    185 | 
    186 |
    187 |
  4. 188 |
  5. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:

    189 |
    $ mkvirtualenv kinet2pcb
    190 | $ cd kinet2pcb/
    191 | $ python setup.py develop
    192 | 
    193 |
    194 |
  6. 195 |
  7. Create a branch for local development:

    196 |
    $ git checkout -b name-of-your-bugfix-or-feature
    197 | 
    198 |
    199 |

    Now you can make your changes locally.

    200 |
  8. 201 |
  9. Commit your changes and push your branch to GitHub:

    202 |
    $ git add .
    203 | $ git commit -m "Your detailed description of your changes."
    204 | $ git push origin name-of-your-bugfix-or-feature
    205 | 
    206 |
    207 |
  10. 208 |
  11. Submit a pull request through the GitHub website.

  12. 209 |
210 |
211 |
212 |

Pull Request Guidelines

213 |

Before you submit a pull request, check that it meets these guidelines:

214 |
    215 |
  1. If the pull request adds functionality, the docs should be updated. Put 216 | your new functionality into a function with a docstring, and add the 217 | feature to the list in README.rst.

  2. 218 |
  3. The pull request should work for Python 2.7, and >=3.6

  4. 219 |
220 |
221 |
222 |
223 |

Credits

224 |
225 |

Development Lead

226 | 229 |
230 |
231 |

Other Contributors

232 |
233 |
234 |
235 |

History

236 |
237 |

1.1.2 (2024-02-26)

238 |
    239 |
  • Added FPID setting to part, otherwise only the fp_name and not the fp_lib appears in the final board.

  • 240 |
  • Added iterator to connect all pads of the same number to a given net. This mimics the behavior of the GUI editor.

  • 241 |
  • Added Python 3.12 to test environments.

  • 242 |
243 |
244 |
245 |

1.1.1 (2023-09-10)

246 |
    247 |
  • net.get_pins() is now used when a SKiDL Circuit object is used as the input for generating a PCB.

  • 248 |
249 |
250 |
251 |

1.1.0 (2022-08-13)

252 |
    253 |
  • Added –libraries command-line option to specify footprint library directories.

  • 254 |
255 |
256 |
257 |

1.0.1 (2022-06-30)

258 |
    259 |
  • Fixed incompatibilities with KiCad V6 Python API (pcbnew).

  • 260 |
261 |
262 |
263 |

1.0.0 (2021-09-16)

264 |
    265 |
  • Decided this tool was mature to the point it could be called 1.0.0.

  • 266 |
267 |
268 |
269 |

0.1.3 (2021-05-19)

270 |
    271 |
  • The parts in the PCB are now given a non-overlapping arrangement 272 | grouped according to their hierarchical nesting.

  • 273 |
274 |
275 |
276 |

0.1.2 (2021-05-18)

277 |
    278 |
  • The kinet2pcb() function will now generate a KiCad PCB file when given 279 | a netlist file name, a PyParsing object, or a SKiDL Circuit object.

  • 280 |
  • kinet2pcb can now be installed in the default Python interpreter on 281 | a system and it will look in /usr/lib/python3/dist-packages to find 282 | the pcbnew module installed by KiCad. If the pcbnew module 283 | is not found there, add the correct location to the PYTHONPATH 284 | environment variable.

  • 285 |
286 |
287 |
288 |

0.1.1 (2019-03-09)

289 |
    290 |
  • Now runs under Python 2 & 3.

  • 291 |
292 |
293 |
294 |

0.1.0 (2019-10-28)

295 |
    296 |
  • First release on PyPI.

  • 297 |
298 |
299 |
300 |
301 |
302 |
303 |

Indices and tables

304 | 309 |
310 | 311 | 312 |