python整理pads logic原理图

2019-07-14 10:44发布

  1. 打开原理图,点击“file”,“export”pads logic offpage 标签对齐方法
  2. 输出ASCII文件到指定位置,跳出设置框,点击“select all”,“OK”pads logic offpage 标签对齐方法pads logic offpage 标签对齐方法
  3. 用notepad++或editplus等记事本软件打开,搜索netnames,尽量不要选择记事本,因为notepad++有一个很重要的技巧,能够同时操作多行,详见经验“怎样在Notepad++中列选”9怎样在Notepad++中列选(竖选)pads logic offpage 标签对齐方法
  4. 每行各项所对应含义为,netname itemname x y ori just shx shy shori shjust shn fontinfo,其中Justification of the text string The value is a bit string as follows: Bit 0 = 0 Left justified or center (X direction) justified Bit 0 = 1 Right justified Bit 1 = 0 Bottom justified or middle (Y direction) justified Bit 1 = 1 Top justified Bit 2 = 0 Left or right justified Bit 2 = 1 Center justified Bit 3 = 0 Bottom or top justified Bit 3 = 1 Middle justified. When text is rotated the definitions for bits 0 and 1 are interchanged.pads logic offpage 标签对齐方法pads logic offpage 标签对齐方法
  5. 5把对应值改为相同的值,在pads logic新建一个空的原理图,点击“file”,“import”pads logic offpage 标签对齐方法

更进一步可以编写脚本,实现自动对齐。#!/usr/bin/python # -*- coding: UTF-8 -*- filepath = input("Please input the filepath: (In Powershell you can drag and drop the file!!!) ") file = open(filepath,"r") rows = file.readlines() lines = [] line = [] flag = 0 data = [] str_data = "" str_row = "" for row in rows: str_row = row if ("*NETNAMES*") in row: flag = 1 print("flag changed: 0--1") elif flag == 1 and (("*SHT*") in row or ("*END*") in row): flag = 0 lines.append(line) line = [] print("flag changed: 1--0") elif flag == 1: #line.append(row) data = row.split() if len(data) > 1: data[3] = "0" data[7] = "40" data[11] = "20" if data[4] == "90": data[2] = "0" data[3] = "400" data[6] = "-40" data[7] = "800" data[5] = "8" data[8] = "90" data[10] = "10" elif data[2][0] == "-": data[2] = "-400" data[6] = "-800" data[5] = "9" data[10] = "8" else: data[2] = "400" data[6] = "1000" data[5] = "8" data[10] = "9" #if data[0] == "VSYS" or data[0] == "VIO1V8": if data[0] != "GND": str_row = "" for d1 in data: str_row += (d1 + " ") str_row += " " else: flag = flag str_data += str_row filepath1 = input("Please input the target file: By default, you can press "Enter" directly! The file will be rewrited!") if filepath1 == "": filepath1 = filepath file = open(filepath1,"w") file.write(str_data) file.close()