forked from odurc/kicad-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck-rule-3.2.py
executable file
·32 lines (27 loc) · 1.06 KB
/
check-rule-3.2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from schlib import *
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('libfiles', nargs='+')
parser.add_argument('-v', '--verbose', help='Print output for all pins - violating or not', action='store_true')
args = parser.parse_args()
def select_violating_pins(pins):
violating_pins = []
for pin in pins:
length = int(pin['length'])
if (length < 100) or (length - 100) % 50 != 0:
violating_pins.append(pin)
return violating_pins
for libfile in args.libfiles:
lib = SchLib(libfile)
print 'library: %s' % libfile
for component in lib.components:
violating_pins = select_violating_pins(component.pins)
if len(violating_pins) > 0:
print '\tcomponent: %s' % component.name
for pin in violating_pins:
print '\t\tpin: %s (%s), dir: %s, length: %s' % (pin['name'], pin['num'], pin['direction'], pin['length'])
else:
if args.verbose:
print '\tcomponent: %s......OK' % component.name