Coder Social home page Coder Social logo

kicad-python's Introduction

kicad-python

Abstraction layer for the KiCad python interface.

Be aware this is in initial development and the interface can change anytime!

Inspired by https://github.com/pierstitus/kicad-python

Build Status Documentation Status Python 2.7

Example usage

from kicad.pcbnew import Board

b = Board.from_file('path/to/file.kicad_pcb')

for module in b.modules:
    print(module)

Run Tests

./setup.py test

kicad-python's People

Contributors

pointhi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

kicad-python's Issues

can not import pcbnew

Hi, I installed the package both in python2.7 and python3.6 on ubuntu 18.04 system using following commands:
How can I solve the problem?

For python2:

pip install wheel typing
pip install . # pwd is where setup.py is.
Python 2.7.17 (default, Jul 1 2022, 15:56:32)
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from kicad.pcbnew import Board
Traceback (most recent call last):
File "", line 1, in
File "kicad/pcbnew/init.py", line 16, in
from kicad.pcbnew.board import Board # noqa: F401
File "kicad/pcbnew/board.py", line 18, in
from kicad.pcbnew.boarditem import BoardItem, from_board_item
File "kicad/pcbnew/boarditem.py", line 16, in
from kicad.pcbnew.layer import Layer, LayerSet
File "kicad/pcbnew/layer.py", line 18, in
from kicad._native import _pcbnew
File "kicad/_native.py", line 22, in
raise e
ImportError: No module named pcbnew

For python3:

Python 3.6.9 (default, Jun 29 2022, 11:45:57)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

from kicad.pcbnew import Board
Traceback (most recent call last):
File "", line 1, in
File "kicad-python/kicad/pcbnew/init.py", line 16, in
from kicad.pcbnew.board import Board # noqa: F401
File "kicad-python/kicad/pcbnew/board.py", line 18, in
from kicad.pcbnew.boarditem import BoardItem, from_board_item
File "kicad/pcbnew/boarditem.py", line 16, in
from kicad.pcbnew.layer import Layer, LayerSet
File "kicad/pcbnew/layer.py", line 18, in
from kicad._native import _pcbnew
File "kicad-python/kicad/_native.py", line 22, in
raise e
File "kicad-python/kicad/_native.py", line 19, in
_pcbnew = import('pcbnew') # We need to import the pcbnew module this way
ModuleNotFoundError: No module named 'pcbnew'

Big set of pull requests

Hi @pointhi,

I couldn't find anything else like kicad-python out there. One of the great things about wrapping the official SWIG library is that it updates with KiCAD. Now is a good time to get updates together before the KiCAD v6 release (which will not escape the clunky SWIG interface).

I developed it a bit myself over the past few months. The changes have been extremely useful to me in bringing new functionality, rounding out some of the in-progress ideas, and putting more of the quirky drudgery under the hood.
https://github.com/atait/kicad-python

Environment management

  • disambiguating kicad.pcbnew and SWIG pcbnew
  • platform-independent auto-linkers to make pip and kicad environments work together
  • one command to do all that link_kicad_python_to_pcbnew, see README

Python 3 and python 2 compatibility

Fixed up docs to work with new Sphinx versions

Layer handling

  • through strings. KiCAD 6 will allow custom layers, and this will be critical
  • still works with Enums

More API wraps

  • TEXTE_PCB
  • GUI properties (selected, highlighted, visible, etc.)
  • zones
  • net names and codes
  • polygons
  • segments
  • via nets

Ctrl-Z compatible

  • using transactions and garbage collection prevention

I was wondering if you would consider merging some of them into your repo and then PyPI. I would love to be able to share this functionality with my colleagues through PyPI. And for newbies who search for an official-ish pcbnew python wrapper (like I did), it would be fantastic if my code would be able to help them. Newbies like PyPI and they like single commands that set everything up for them.

pip install kicad
link_kicad_python_to_pcbnew ...

It is a nontrivial merge, in part, because I forked off of KiCad's repo instead of yours. I wanted to reach out beforehand to see what you thought because there hasn't been much activity in this repo lately. If you like these changes and are up for some reviewing and merging, then I will fork and start making pull requests.

Best,

How to build docs?

What are the requirements to build the documentation?

If I call make, I get this error:
sphinx-build2: command not found

Maybe some instructions could be added to the README?

Thanks for the nice repo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.