python整理pads logic原理图

  1. 打开原理图,点击“file”,“export”

    pads logic offpage 标签对齐方法
  2. 输出ASCII文件到指定位置,跳出设置框,点击“select all”,“OK”

    pads logic offpage 标签对齐方法
    pads logic offpage 标签对齐方法
  3. 用notepad++或editplus等记事本软件打开,搜索netnames,尽量不要选择记事本,因为notepad++有一个很重要的技巧,能够同时操作多行,详见经验“怎样在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:\n(In Powershell you can drag and drop the file!!!)\n")

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 += "\n"
				
	else:
		flag = flag
	str_data += str_row
		
filepath1 = input("Please input the target file:\nBy default, you can press \"Enter\" directly!\nThe file will be rewrited!")
if filepath1 == "":
	filepath1 = filepath

file = open(filepath1,"w")
file.write(str_data)
file.close()

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值