DRC unable to be performed via Python scripting API

Bug #1600081 reported by mithro
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Unknown

Bug Description

I posted the following to the KiCad Developer's mailing list and nobody seems to be able to answer the question.

------------------------
I'm trying to figure out how to run the DRC in pcbnew from the Python Scripting API. I've managed to get API into an iPython session (https://github.com/mithro/kicad-length-matching-checks/blob/master/ipython.py) to have a poke around but wasn't able to find the right function to call.

It looks like if I can get the DRC to run, there seems to be an API for accessing the marker's it adds to the board which exposes https://github.com/KiCad/kicad-source-mirror/blob/master/pcbnew/class_marker_pcb.h

GetMARKER(self, *args) method of pcbnew.BOARD instance
    GetMARKER(BOARD self, int index) -> MARKER_PCB

GetMARKERCount(self) method of pcbnew.BOARD instance
    GetMARKERCount(BOARD self) -> int

I did find, board.Test_Drc_Areas_Outlines_To_Areas_Outlines - but couldn't figure out how to call it, or if it did what I wanted.

Test_Drc_Areas_Outlines_To_Areas_Outlines(self, *args) method of pcbnew.BOARD instance
    Test_Drc_Areas_Outlines_To_Areas_Outlines(BOARD self, ZONE_CONTAINER aArea_To_Examine, bool aCreate_Markers) -> int

There also seems to be the pcbnew.DRC_VISIBLE constant, but I couldn't find where that might be used.

I had a dig around the KiCad source in the scripting directory, and the other files with DRC in their name but didn't see anything similar mapped into the API (but maybe I'm looking in the wrong area?)

Does anyone know how to cause the DRC to run from the Python scripting API? (Or if it isn't currently exposed, the correct functions to expose via SWIG?)

Thanks for your help!
------------------------

After more digging I've come to the conclusion it is currently impossible to cause a DRC to run via the Python API. It would be awesome if this could be added.

Revision history for this message
mithro (mithro) wrote :

FYI - As this is a feature I'm really interested in having implemented, I'm willing to offer a bounty of $US150 to the developer who gets this implemented and into an official KiCad repo (or a $US200 donation to CERN if the developer prefers, in this case the donation should also be matched through my employer's matching program too).

Novak Tamas (novak-7)
Changed in kicad:
importance: Undecided → Wishlist
status: New → Triaged
tags: added: pcbnew python
Jon Evans (craftyjon)
Changed in kicad:
milestone: none → 6.0.0-rc1
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

KiCad bug tracker has moved to Gitlab. This report is now available here: https://gitlab.com/kicad/code/kicad/-/issues/2030

Changed in kicad:
status: Triaged → Expired
Changed in kicad:
importance: Wishlist → Unknown
status: Expired → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.