如上图所示,图中PCB的元器件的编号还没有摆放好,看起来很乱。如何快速将元器件编号摆放好?可以编写一个脚本,一键就能快速摆放好。
首先,打开PCB脚本编辑器,编写以下脚本。
参考代码:
Sub Main
Dim partFi As Double
Dim DocumentUnit,x As Integer
DocumentUnit = ActiveDocument.unit
ActiveDocument.unit = ppcbUnitMils
For Each part In ActiveDocument.Components
If part.Labels.Count > 0 Then
If GetPartType(part) = "CON" Or GetPartType(part) = "J" Then
For x = 1 To part.Labels.Count