简单,将basic script的第17项修改一下就可以了,最好是先另存再做修改,修改的内容如下(这里是在PartDecal后面加上PartValue,大家可以根据自己的情况修改): 先找到这一段: …… Open filename For Output As #1 ' Output Headers  rint #1, "PartType"; Space(32);  rint #1, "RefDes"; Space(24); Print #1, "PartDecal"; Space(32);  rint #1, "Pins"; Space(6);  rint #1, "Layer"; Space(26);  rint #1, "Orient."; Space(24);  rint #1, "X"; Space(30);  rint #1, "Y"; Space(29);  rint #1, "SMD"; Space(7);  rint #1, "Glued"; Space(0) ' Lock server to speed up process LockServer ' Go through each component in the design and output values For Each nextComp In ActiveDocument.Components  rint #1, nextComp.PartType; Space$(40-Len(nextComp.PartType)); Print #1, nextComp.Name; Space$(30-Len(nextComp.Name)); Print #1, nextComp.Decal; Space$(40-Len(nextComp.Decal)); Print #1, nextComp.Pins.Count; Space$(10-Len(nextComp.Pins.Count)); …… 注意到红色的字体,我们现在只要在红色字体后面加上一句就OK了,如下绿色字体: Open filename For Output As #1 ' Output Headers Print #1, "PartType"; Space(32); Print #1, "RefDes"; Space(24); Print #1, "PartDecal"; Space(32); Print #1, "PartValue"; Space(32); Print #1, "Pins"; Space(6); Print #1, "Layer"; Space(26); Print #1, "Orient."; Space(24); Print #1, "X"; Space(30); Print #1, "Y"; Space(29); Print #1, "SMD"; Space(7); Print #1, "Glued"; Space(0) ' Lock server to speed up process LockServer ' Go through each component in the design and output values For Each nextComp In ActiveDocument.Components Print #1, nextComp.PartType; Space$(40-Len(nextComp.PartType)); Print #1, nextComp.Name; Space$(30-Len(nextComp.Name)); Print #1, nextComp.Decal; Space$(40-Len(nextComp.Decal)); Print #1, nextComp.Attributes("Value").value; Space$(40-Len(nextComp.Attributes("Value").value)); Print #1, nextComp.Pins.Count; Space$(10-Len(nextComp.Pins.Count)); …… 修改后保存运行就可以了。 注意:要保证所有的元件都有Value,否则不能运行,只要有一个元件的Value为空,程序跑到上面长长的绿色那一句会就过不去,中午不睡觉研究了半个小时也没搞定,决定放弃。注意孔的value也不要为空。 |