Hi,
I have found this Python code
How can I do the same thing by using visual basic code? Does anyone know of any example code I can adapt. I have searched the forum but cannot find anything that can get me started. I can provide a sample gerber file listing if this would be helpful? I hope some one can help.
Thanks.
David.
I have found this Python code
Code:
#!/usr/bin/env python
# Gerber query script
# Usage: ./gerber_query.py board_edges.gbr
# Written by Matthew Beckler for Wayne and Layne, LLC
# Based on a script from @laen
# Released into the Public Domain. Have fun
def main():
import sys
if len(sys.argv) < 2:
print "Usage: %s gerberfile" % sys.argv[0]
sys.exit()
import re
filename = sys.argv[1]
xmin = None
xmax = None
ymin = None
ymax = None
with open(filename, 'r') as fid:
for line in fid:
results = re.search("^X(\d+)Y([\d-]+)", line)
if results:
x = int(results.group(1))
y = int(results.group(2))
if not xmin or x < xmin:
xmin = x
if not ymin or y < ymin:
ymin = y
if not xmax or x > xmax:
xmax = x
if not ymax or y > ymax:
ymax = y
print "Board dimensions:"
w = xmax - xmin
h = ymax - ymin
print " ", (w, h), "original units"
print " (%.4f, %.4f) inches" % (w / 10000.0, h / 10000.0)
print " (%.4f, %.4f) mm" % (w / 10000.0*25.4 , h / 10000.0*25.4)
if __name__ == "__main__":
main()Thanks.
David.