2012-03-20 06:34:23 +00:00
|
|
|
#!/usr/bin/env python
|
2018-08-04 15:11:45 +00:00
|
|
|
|
|
|
|
from __future__ import print_function
|
|
|
|
|
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
|
|
|
|
2018-08-04 15:11:45 +00:00
|
|
|
print("LISTING VIAS:")
|
2012-03-19 11:21:29 +00:00
|
|
|
|
|
|
|
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()
|
2018-08-04 15:11:45 +00:00
|
|
|
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
|
|
|
|
2018-08-04 15:11:45 +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:
|
2018-08-04 15:11:45 +00:00
|
|
|
print("Unknown type %s" % type(item))
|
2012-03-19 11:21:29 +00:00
|
|
|
|
2018-08-04 15:11:45 +00:00
|
|
|
print("")
|
|
|
|
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:
|
2018-08-04 15:11:45 +00:00
|
|
|
print("* Text: '%s' at %s" % (item.GetText(), item.GetPosition()))
|
2014-10-02 17:09:32 +00:00
|
|
|
elif type(item) is DRAWSEGMENT:
|
2018-08-04 15:11:45 +00:00
|
|
|
print("* Drawing: %s" % item.GetShapeStr()) # dir(item)
|
2014-10-02 17:09:32 +00:00
|
|
|
else:
|
2018-08-04 15:11:45 +00:00
|
|
|
print(type(item))
|
2014-09-30 18:23:27 +00:00
|
|
|
|
2018-08-04 15:11:45 +00:00
|
|
|
print("")
|
|
|
|
print("LIST MODULES:")
|
2012-03-19 11:21:29 +00:00
|
|
|
|
|
|
|
for module in pcb.GetModules():
|
2018-08-04 15:11:45 +00:00
|
|
|
print("* Module: %s at %s" % (module.GetReference(), ToUnits(module.GetPosition())))
|
2014-09-30 18:23:27 +00:00
|
|
|
|
2018-08-04 15:11:45 +00:00
|
|
|
print("")
|
|
|
|
print("Nets cnt: ", pcb.GetNetCount())
|
|
|
|
print("track w cnt:", len(pcb.GetTrackWidthList()))
|
|
|
|
print("via s cnt:", len(pcb.GetViasDimensionsList()))
|
2014-09-30 18:23:27 +00:00
|
|
|
|
2018-08-04 15:11:45 +00:00
|
|
|
print("")
|
|
|
|
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)
|
2018-08-04 15:11:45 +00:00
|
|
|
print("zone:", idx, "priority:", zone.GetPriority(), "netname", zone.GetNetname())
|
2012-03-19 11:21:29 +00:00
|
|
|
|
2018-08-04 15:11:45 +00:00
|
|
|
print("")
|
|
|
|
print("NetClasses:", pcb.GetNetClasses().GetCount())
|