← Back to team overview

kicad-developers team mailing list archive

Hello, first post, sharing python code

 

Hello!
This is my first post. I've read some of the material for KiCAD developers and some of the mailing list archives. I hope this is appropriate.
I've just started using KiCAD in the last month or so. I'm an experienced programmer, and I thought I'd try to add to the knowledge base here. I've developed some python code that is in VERY BETA state and seeking advice on how, when, and where to share it. Below are the comments at the top of the file.
Right now it might best be considered as some python examples of interacting with KiCAD.
How solid, tested, and guideline-conforming should the code be prior to sharing?
Any comments, questions, or advice welcome.
Greg S.

# Original Author: Greg Smith, June 2017# This is VERY beta. Not thoroughly tested. Not well commented. Not optimized for memory or run time.# Not conforming to style guides (neither Python nor KiCAD style guides).# Inputs and outputs are in varying non-changable units (mils, inches, mm, nm)# Only tested on KiCAD 4.06, Windows 7.## Install: place file in C:\Program Files\KiCad\share\kicad\scripting\plugins\PadDrillStencilSilk.py# in pcbnew, open scripting console (Tools > Scripting Console)# type "import PadDrillStencilSilk.py"# This python package provides additional basic DRC checks to KiCAD# It adds a menu item to "Tools" called Pads/Vias/Stencils.## THERE ARE BUGS:# Only handles 2-layer boards, only through vias, and pads are not verified for shape.# Does not check pad drill DRC# Assumes all pads are on the front.# Does not mix via drill and pad drill checks.# Does not check annular ring size.## Pad Info: quantity of pads by size, detailed list of pads and some python properties# Drill Info: Lists specified pad drill sizes, and closest larger standard drill size#             Checks via drill to via drill clearance, and via drill to track clearance#             Lists quantity by size# Stencil Info: Lists apertures, checks AspectRatio and# AreaRatio against a variety of stencil thicknesses (all currently hardcoded)## Nevertheless, there are some examples of useing python code to interact with KiCAD:# Install Tools menu, replace if already existing (allows reloading python file after changes)# Iterate over tracks, identify vias, get sizes of via copper, mask, and paste# Identify which layers a pad is on.# Generate basic interactive window.# Get Paste (stencil) Aperture size calculated from pad properties.
# TODO list, aside from fixing the BUGS above.#    Mask Info: Checks mask sizes.#    Silk Info: Checks silk screen character sizes.

Follow ups