scripts
Private Sub LayerLabeler
dim TheBoard ' Storage for the board object
dim TheLayerstack ' storage for the layerstack object
dim TheLayer ' storage for the layer object
dim x ' integer variable
set TheBoard = pcbserver.GetCurrentPCBBoard ' Let's grab the board handle of the current PCBDoc
set TheLayerstack = TheBoard.layerstack_v7 ' layerstack ' and snatch the layerstack associated with TheBoard.
for x = 1 to 32
set TheLayer = TheLayerstack.layerobject_v7(Ilayer.MechanicalLayer(x)) ' Now let's grab a layer in the stack, pointed to by x
TheLayer.MechanicalLayerenabled = true ' We'll turn it on
TheLayer.isdisplayed(TheBoard) = true ' and show it
' The statements below will turn it back off
' if it is not in the 'approved list'. Doing it this way saves lot's
' of keyboard pounding.
select case x ' Switch depending on the Mechanical layer number :
case 1
TheLayer.name ="[M01] 3D Part Outline"
case 2
TheLayer.name ="[M02] Board Outline"
case 3
TheLayer.name ="[M03] ConCoat Top"
case 4
TheLayer.name ="[M04] ConCoat Bottom"
case 5
thelayer.name ="[M05] Coverlay Flex Top"
case 6
thelayer.name ="[M05] Coverlay Flex Bottom"
case 7
thelayer.name ="[M07] Stiffner Top"
case 8
thelayer.name ="[M08] Stiffner Bottom"
case 11
TheLayer.name ="[M11] PCB Notes Top"
case 12
TheLayer.name ="[M12] PCB Notes Bottom"
case 13
TheLayer.name ="[M13] Assy Notes Top"
case 14
TheLayer.name ="[M14] Assy Notes Bottom"
case 15
TheLayer.name ="[M15] Courtyard Top"
case 16
TheLayer.name ="[M16] Courtyard Bottom"
case 17
TheLayer.name ="[M17] Titleblock Top"
case 18
TheLayer.name ="[M18] Common Data TOP"
case 19
TheLayer.name ="[M19] Film Markers"
case 20
TheLayer.name ="[M20] Titleblock Bottom"
case 21
TheLayer.name ="[M21] Common Data Bottom"
end select
next
end sub
you can do the same for the electricals by altering the iterator :
private sub ElectricalStack_LongNames
dim Theboard
set theboard = pcbserver.GetCurrentPCBBoard
dim iter
set iter= theboard.electricallayeriterator
dim x
x = 0
while iter.next
x = x + 1
iter.layerobject.name = "[L"+ right ("00"+cstr(x),2) + "] "+ layer2string(iter.layerobject.layerid)
wend
end sub