From f23319ccf8f926863260cf0eb26487c11ee6c503 Mon Sep 17 00:00:00 2001 From: acha666 <1339211182@qq.com> Date: Fri, 5 Aug 2022 21:48:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0AD=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | Bin 674 -> 830 bytes modify.py | 20 +++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b1215f25a0aaed6203fe92d12b3b2c5e6f0cd7f5..ace3e1075f1f0287d1b24dc5a1a5f6a6adffac22 100644 GIT binary patch delta 220 zcmZ3)x{qzc6h?VIKSzcfh7yKMhEj%H1_cHehE#@PATOOE56CK-Jee`H{%3R_epL(( zNq?e$1-6u>gY+;Yfk~eK-@9Km`gAA+rA*`VA hnMt8BEoBi5MhqZXj{hmyl`{(C&xS-qPb}s94*>X%8RP%} diff --git a/modify.py b/modify.py index d5117e2..6205625 100644 --- a/modify.py +++ b/modify.py @@ -8,7 +8,7 @@ G04 Gerber Generator version 0.2* G04 Scale: 100 percent, Rotated: No, Reflected: No * G04 Dimensions in millimeters * G04 leading zeros omitted , absolute positions ,4 integer and 5 decimal *\n""" -path = r"C:/Users/lol/Desktop/xxxxxx" +path = r"C:/Users/Acha/Desktop/gerber_PCB1" textFile="""如何进行PCB下单 请查看: @@ -35,16 +35,23 @@ for file in currentDir: os.rename(os.path.join(path,file),os.path.join(path,"Gerber_TopSilkscreenLayer.GTO")) if os.path.splitext(file)[-1][1:].lower() == "gts": os.rename(os.path.join(path,file),os.path.join(path,"Gerber_TopSolderMaskLayer.GTS")) + if os.path.splitext(file)[-1][1:].lower() == "gd1": + os.rename(os.path.join(path,file),os.path.join(path,"Drill_Through.GD1")) + if os.path.splitext(file)[-1][1:].lower() == "gm1": + os.rename(os.path.join(path,file),os.path.join(path,"Gerber_MechanicalLayer1.GM1")) + if os.path.splitext(file)[-1][1:].lower() == "gm13": + os.rename(os.path.join(path,file),os.path.join(path,"Gerber_MechanicalLayer13.GM13")) - if file.find("_PCB-PTH")!=-1 or file.find("_PCB-PTH")!=-1: + + if file.find("_PCB-PTH")!=-1: os.rename(os.path.join(path,file),os.path.join(path,"Drill_PTH_Through.DRL")) - if file.find("_PCB-NPTH")!=-1 or file.find("_PCB-NPTH")!=-1: + if file.find("_PCB-NPTH")!=-1: os.rename(os.path.join(path,file),os.path.join(path,"Drill_NPTH_Through.DRL")) - if file.find("_PCB-In1_Cu")!=-1 or file.find("_PCB-In1_Cu")!=-1: + if file.find("_PCB-In1_Cu")!=-1 or file.find(".G1")!=-1: os.rename(os.path.join(path,file),os.path.join(path,"Gerber_InnerLayer1.G1")) - if file.find("_PCB-In2_Cu")!=-1 or file.find("_PCB-In2_Cu")!=-1: + if file.find("_PCB-In2_Cu")!=-1 or file.find(".G2")!=-1: os.rename(os.path.join(path,file),os.path.join(path,"Gerber_InnerLayer2.G2")) - if file.find("_PCB-Edge_Cuts")!=-1 or file.find("_PCB-Edge_Cuts")!=-1: + if file.find("_PCB-Edge_Cuts")!=-1 : os.rename(os.path.join(path,file),os.path.join(path,"Gerber_BoardOutlineLayer.GKO")) currentDir=os.listdir(path) @@ -55,7 +62,6 @@ for file in currentDir: fileData=f.read() f.close() f=open(os.path.join(path,file),"w") - print(fileData) f.write(header) f.write(fileData) f.close()