listPcb.py 1.23 KB
Newer Older
1
#!/usr/bin/env python
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 33 34 35 36 37 38 39
import sys
from pcbnew import *

filename=sys.argv[1]

pcb = LoadBoard(filename)

#ToUnits = ToMM 
#FromUnits = FromMM 
ToUnits=ToMils
FromUnits=FromMils

print "LISTING VIAS:"

for item in pcb.GetTracks():
	if type(item) is SEGVIA:
		
		pos = item.GetPosition()
		drill = item.GetDrillValue()
		width = item.GetWidth()
		print " * Via:   %s - %f/%f "%(ToUnits(pos),ToUnits(drill),ToUnits(width))
		
	elif type(item) is TRACK:
		
		start = item.GetStart()
		end = item.GetEnd()
		width = item.GetWidth()
		
		print " * Track: %s to %s, width %f" % (ToUnits(start),ToUnits(end),ToUnits(width))
		
	else:
		print "Unknown type	%s" % type(item)

print ""
print "LISTING DRAWINGS:"

for item in pcb.GetDrawings():
	if type(item) is TEXTE_PCB:
40
		print "* Text:    '%s' at %s"%(item.GetText(), item.GetPosition())
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
	elif type(item) is DRAWSEGMENT:
		print "* Drawing: %s"%item.GetShapeStr() # dir(item)
	else:
		print type(item)
	
print ""
print "LIST MODULES:"

for module in pcb.GetModules():
	print "* Module: %s at %s"%(module.GetReference(),ToUnits(module.GetPosition()))
	
print "" 
print "LIST ZONES:"

for zone in pcb.GetSegZones():
	print zone
	
	
print ""
print "RATSNEST:",len(pcb.GetFullRatsnest())

print dir(pcb.GetNetClasses())
63