2012-03-20 06:34:23 +00:00
|
|
|
#!/usr/bin/env python
|
2012-03-19 11:21:29 +00:00
|
|
|
import sys
|
|
|
|
from pcbnew import *
|
|
|
|
|
|
|
|
filename=sys.argv[1]
|
|
|
|
|
|
|
|
pcb = LoadBoard(filename)
|
|
|
|
|
2014-09-30 18:23:27 +00:00
|
|
|
ToUnits = ToMM
|
|
|
|
FromUnits = FromMM
|
|
|
|
#ToUnits=ToMils
|
|
|
|
#FromUnits=FromMils
|
2012-03-19 11:21:29 +00:00
|
|
|
|
|
|
|
print "LISTING VIAS:"
|
|
|
|
|
|
|
|
for item in pcb.GetTracks():
|
2014-10-02 17:09:32 +00:00
|
|
|
if type(item) is VIA:
|
2014-09-30 18:23:27 +00:00
|
|
|
|
2014-10-02 17:09:32 +00:00
|
|
|
pos = item.GetPosition()
|
|
|
|
drill = item.GetDrillValue()
|
|
|
|
width = item.GetWidth()
|
|
|
|
print " * Via: %s - %f/%f "%(ToUnits(pos),ToUnits(drill),ToUnits(width))
|
2014-09-30 18:23:27 +00:00
|
|
|
|
2014-10-02 17:09:32 +00:00
|
|
|
elif type(item) is TRACK:
|
2014-09-30 18:23:27 +00:00
|
|
|
|
2014-10-02 17:09:32 +00:00
|
|
|
start = item.GetStart()
|
|
|
|
end = item.GetEnd()
|
|
|
|
width = item.GetWidth()
|
2014-09-30 18:23:27 +00:00
|
|
|
|
2014-10-02 17:09:32 +00:00
|
|
|
print " * Track: %s to %s, width %f" % (ToUnits(start),ToUnits(end),ToUnits(width))
|
2014-09-30 18:23:27 +00:00
|
|
|
|
2014-10-02 17:09:32 +00:00
|
|
|
else:
|
|
|
|
print "Unknown type %s" % type(item)
|
2012-03-19 11:21:29 +00:00
|
|
|
|
|
|
|
print ""
|
2014-09-30 18:23:27 +00:00
|
|
|
print "LIST DRAWINGS:"
|
2012-03-19 11:21:29 +00:00
|
|
|
|
|
|
|
for item in pcb.GetDrawings():
|
2014-10-02 17:09:32 +00:00
|
|
|
if type(item) is TEXTE_PCB:
|
|
|
|
print "* Text: '%s' at %s"%(item.GetText(), item.GetPosition())
|
|
|
|
elif type(item) is DRAWSEGMENT:
|
|
|
|
print "* Drawing: %s"%item.GetShapeStr() # dir(item)
|
|
|
|
else:
|
|
|
|
print type(item)
|
2014-09-30 18:23:27 +00:00
|
|
|
|
2012-03-19 11:21:29 +00:00
|
|
|
print ""
|
|
|
|
print "LIST MODULES:"
|
|
|
|
|
|
|
|
for module in pcb.GetModules():
|
2014-10-02 17:09:32 +00:00
|
|
|
print "* Module: %s at %s"%(module.GetReference(),ToUnits(module.GetPosition()))
|
2014-09-30 18:23:27 +00:00
|
|
|
|
|
|
|
print ""
|
|
|
|
print "Ratsnest cnt:",len(pcb.GetFullRatsnest())
|
|
|
|
print "track w cnt:",len(pcb.GetTrackWidthList())
|
|
|
|
print "via s cnt:",len(pcb.GetViasDimensionsList())
|
|
|
|
|
|
|
|
print ""
|
2014-10-02 17:09:32 +00:00
|
|
|
print "LIST ZONES:", pcb.GetAreaCount()
|
2012-03-19 11:21:29 +00:00
|
|
|
|
2014-09-30 18:23:27 +00:00
|
|
|
for idx in range(0, pcb.GetAreaCount()):
|
|
|
|
zone=pcb.GetArea(idx)
|
|
|
|
print "zone:", idx, "priority:", zone.GetPriority(), "netname", zone.GetNetname()
|
|
|
|
|
2012-03-19 11:21:29 +00:00
|
|
|
print ""
|
2014-10-02 17:09:32 +00:00
|
|
|
print "NetClasses:", pcb.GetNetClasses().GetCount(),
|
2012-03-19 11:21:29 +00:00
|
|
|
|