From ebaeb29d0e9d4f402d46c5750c2e145fef1b5b32 Mon Sep 17 00:00:00 2001 From: acha666 <1339211182@qq.com> Date: Mon, 1 Aug 2022 22:23:48 +0800 Subject: [PATCH] =?UTF-8?q?init=20commit=20=E6=94=AF=E6=8C=81Kicad?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | Bin 0 -> 674 bytes modify.py | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 README.md create mode 100644 modify.py diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b1215f25a0aaed6203fe92d12b3b2c5e6f0cd7f5 GIT binary patch literal 674 zcmezWPnki1!HuDmA(a6MQG~{0GGdC@#KtUkvsHhF&o+=298T;#{Vw#ew{DxvnK$ zEQz(@RpacSFKP0n0SrO#utj(Ix6~Io{D};Hv;B_MH8p`;ss(goy}w3j0z&{Wl=6Wt zO=ZYo0L3cEFPTZ9F}xuO3?OrO{-jh!IdK<2iTMKBnFZQ=l$TsfmK{%lA@^u$um{{TR%xC#IO literal 0 HcmV?d00001 diff --git a/modify.py b/modify.py new file mode 100644 index 0000000..d5117e2 --- /dev/null +++ b/modify.py @@ -0,0 +1,69 @@ +import os +from tkinter import filedialog + +header="""G04 Layer: TopLayer* +G04 EasyEDA v6.5.9, 2022-08-01 21:18:00* +G04 ac5e******************************************aa,10* +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" +textFile="""如何进行PCB下单 + +请查看: +https://docs.lceda.cn/cn/PCB/Order-PCB""" +textFileName="PCB下单必读.txt" + +currentDir=os.listdir(path) +for file in currentDir: + if os.path.splitext(file)[-1][1:].lower() == "gbl": + os.rename(os.path.join(path,file),os.path.join(path,"Gerber_BottomLayer.GBL")) + if os.path.splitext(file)[-1][1:].lower() == "gko": + os.rename(os.path.join(path,file),os.path.join(path,"Gerber_BoardOutlineLayer.GKO")) + if os.path.splitext(file)[-1][1:].lower() == "gbp": + os.rename(os.path.join(path,file),os.path.join(path,"Gerber_BottomPasteMaskLayer.GBP")) + if os.path.splitext(file)[-1][1:].lower() == "gbo": + os.rename(os.path.join(path,file),os.path.join(path,"Gerber_BottomSilkscreenLayer.GBO")) + if os.path.splitext(file)[-1][1:].lower() == "gbs": + os.rename(os.path.join(path,file),os.path.join(path,"Gerber_BottomSolderMaskLayer.GBS")) + if os.path.splitext(file)[-1][1:].lower() == "gtl": + os.rename(os.path.join(path,file),os.path.join(path,"Gerber_TopLayer.GTL")) + if os.path.splitext(file)[-1][1:].lower() == "gtp": + os.rename(os.path.join(path,file),os.path.join(path,"Gerber_TopPasteMaskLayer.GTP")) + if os.path.splitext(file)[-1][1:].lower() == "gto": + 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 file.find("_PCB-PTH")!=-1 or 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: + 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: + 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: + 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: + os.rename(os.path.join(path,file),os.path.join(path,"Gerber_BoardOutlineLayer.GKO")) + +currentDir=os.listdir(path) +for file in currentDir: + fileType=os.path.splitext(file)[-1][1:].lower() + if fileType!="txt" and fileType!="py": + f=open(os.path.join(path,file),"r") + fileData=f.read() + f.close() + f=open(os.path.join(path,file),"w") + print(fileData) + f.write(header) + f.write(fileData) + f.close() + +file=open(textFileName,"w") +file.write(textFile) +file.close() + + + +