Created
August 3, 2016 09:31
-
-
Save tuna-f1sh/6088a9add39d28476b92489ef1eeff8d to your computer and use it in GitHub Desktop.
Convert Proteus gerber export to layer based file extensions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os,sys | |
# Get folder | |
if len(sys.argv) > 1: | |
folder = sys.argv[1] | |
else: | |
# folder = os.path.dirname(os.path.realpath(__file__)) | |
folder = os.getcwd() | |
convert = { | |
"Top Copper" : ".GTL", | |
"Top Silk Screen" : ".GTO", | |
"Top Solder Resist" : ".GTS", | |
"Bottom Copper" : ".GBL", | |
"Bottom Silk Screen" : ".GBO", | |
"Bottom Solder Resist" : ".GBS", | |
"Mechanical 1" : ".GML", | |
"Drill" : ".TXT", | |
} | |
# Run through files in current folder | |
for filename in os.listdir(folder): | |
# print "Looking at: " + filename | |
infilename = os.path.join(folder,filename) | |
if not os.path.isfile(infilename): continue | |
oldbase = os.path.splitext(filename) | |
for x in convert: | |
if (x in filename) and (convert[x] not in filename): | |
print "Convert " + filename + " to " + convert[x] | |
if x == "Drill": | |
newname = infilename.replace('.DRL', convert[x]) | |
else: | |
newname = infilename.replace('.GBR', convert[x]) | |
output = os.rename(infilename, newname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you so much