pcb设计完成后,如果我们要统计过孔数量,查看过孔信息怎么弄呢?可以利用脚本的方法,把pcb钻孔的信息打印出来。
首先,打开pcb脚本编辑器,编写以下代码。
参考代码如下:
dim drillcount as long
sub main
' open temporarly text file
randomize
filename = defaultfilepath & mp & cint(rnd()*10000) & .txt
open filename for output as #1
' output headers
print #1, type;space(9);
print #1, name;space(26);
print #1, net;space(28);
print #1, drill;space(25);
print #1, plated;space(2);
print #1, x;space(29);
print #1, y;space(0)
drillcount = 0
' lock server to speed up process
lockserver
' go through each via in the design and output values
for each nextvia in activedocument.vias
' output via type property
a = via
print #1, a; space$(13-len(a));
' output via name property
a = nextvia.type
print #1, a; space$(30-len(a));
' output via attached net property
set nnet = nextvia.net
if (nnet is nothing) then a = n/a else a = nnet.name
print #1, a; space$(30-len(a));
' output via drill size property
a = nextvia.drillsize
print #1, a; space$(30-len(a));
' output via plated property
a = nextvia.plated
print #1, a; space$(8-len(a));
' output via positionx property
a = format$(nextvia.positionx, #.00)
print #1, a; space$(30-len(a));
' output via positiony property
a = format$(nextvia.positiony, #.00)
print #1, a
drillcount = drillcount + 1
next nextvia
' unlock the server
unlockserver
' close the text file
close #1
if drillcount = 0 then
msgbox the design has no drills
exit sub
end if
' start excel and loads the text file
on error goto noexcel
dim excelapp as object
set excelapp = createobject(excel.application)
on error goto 0
excelapp.visible = true
excelapp.workbooks.opentext filename:= filename
excelapp.rows(1:1).select
with excelapp.selection
.font.bold = true
.font.italic = true
end with
excelapp.cells.select
excelapp.selection.sort key1:=excelapp.activesheet.columns(d), order1:=1, header:=0
excelapp.selection.subtotal groupby:=4, function:=-4112, totallist:=array(5), replace:=true
excelapp.activesheet.outline.showlevels rowlevels:=2
excelapp.range(a1).select
set excelapp = nothing
end
noexcel:
' display the text file
shell notepad & filename, 3
end sub
然后,运行脚本,pcb的过孔信息就被打印出来了。
由上图可以知道,过孔的类型,大小,坐标都打印出来,数量也统计出来了。
最后,保存脚本,方便以后调用。
感兴趣的朋友,可以敲写以上代码调试使用,也可以到群里下载脚本,直接使用。
积极推动5G应用生态建设,一加5G App畅想创新马拉松活动圆满落幕
3399元的iPhone6s与国产手机价格相同,你如何选
快速实现基于FPGA的脉动FIR滤波器,VHDL,脉动阵列,PE处理单元,FIR滤波器
Supplyframe XQ:智能化BOM分析 数字化询报价
新一轮PCB资本大战也拉开了序幕
如何利用脚本打印出PCB钻孔的信息
vivoNEX评测 脱胎于概念机的前沿技术
ChipLink提供直观界面能够在产品开发的每个环节中提供视觉反馈
TD终端销量突然大增 芯片已供不应求
思必驰推出人口普查机器人助力第七次人口普查工作
工业PoE++交换机:引领工业通信革命
同样2499元的价格,华为nova2和小米6谁更值得买?华为nova2和小米6评测对比
一文解析百度知道上云与架构演进
PCB设计不能忘记什么
联想投资寒武纪行歌,后者致力于自动驾驶AI芯片业务
无感直流无刷电机的转子位置检测分析
极米开盘涨三倍,做“下一个小米”?
纯硬件方案模拟手动开关机,解决国产CPU断电间隔短无法启动问题
浅谈Verilog复杂时序逻辑电路设计实践
电动夹具已成为机器人机协作时代的新要求