Hi @PCB_Wiz
I modified the annring_size function to manage also oval drills
def annring_size(pad): # valid for oval pad/drills annrX=(pad.GetSize()[0]) - (pad.GetDrillSize()[0]) annrY=(pad.GetSize()[1]) - (pad.GetDrillSize()[1]) #annr=min(pad.GetSize()) - max(pad.GetDrillSize()) #if annr < MIN_AR_SIZE: # print pad.GetSize() # print pad.GetDrillSize() return min(annrX,annrY)
and the full script
# -*- coding: utf-8 -*- # # An example script to check for annular ring violations #
import sys
import pcbnew
mm_ius = 1000000.0
AR_SET = 0.30
MIN_AR_SIZE = AR_SET * mm_ius
def annring_size(pad):
# valid for oval pad/drills
annrX=(pad.GetSize()[0]) - (pad.GetDrillSize()[0])
annrY=(pad.GetSize()[1]) - (pad.GetDrillSize()[1])
#annr=min(pad.GetSize()) - max(pad.GetDrillSize())
#if annr < MIN_AR_SIZE:
# print pad.GetSize()
# print pad.GetDrillSize()
return min(annrX,annrY)
def f_mm(raw):
return repr(raw/mm_ius)
board = pcbnew.GetBoard()
PassC=FailC=0
print("checkar_count.py Testing PCB for Annular Ring >= "+repr(AR_SET))
for module in board.GetModules():
for pad in module.Pads():
ARv = annring_size(pad)
if ARv < MIN_AR_SIZE:
# print("AR violation at %s." % (pad.GetPosition() / mm_ius )) Raw units, needs fixing
XYpair = pad.GetPosition()
print("AR violation of "+f_mm(ARv)+" at XY "+f_mm(XYpair[0])+","+f_mm(XYpair[1]) )
FailC = FailC+1
else:
PassC = PassC+1
print("PADS that Pass = "+repr(PassC)+" Fails = "+repr(FailC))
# execfile("C:\KiCad_Python\kicad-python-master\examples\checkar_count.py")
# checkar_count.py Testing PCB for Annular Ring >= 0.25
# AR violation of 0.1 at XY 172.974,110.744
# AR violation of 0.1 at XY 172.212,110.744
# AR violation of 0.0 at XY 154.813,96.52
# PADS that Pass = 49 Fails = 3