Altium Scripts
These are some helpful Altium Scripts written in Visual Basic Script
to help you get started with the programming.
This one will rotate the designators and center them on the
component so they will face one of two ways. Helps to clean up the
board while doing parts placement.

'www.tdpcb.com
'This will rotate the designators in one of two ways and center them on the
'component.
Sub RotateDesignators
Dim Board
Dim Component
Dim CompDes
Dim I
Set Board = PCBServer.GetCurrentPCBBoard
If Board is Nothing Then Exit Sub
Iterator = Board.BoardIterator_Create
Iterator.AddFilter_ObjectSet(MkSet(eComponentObject))
Iterator.AddFilter_LayerSet(AllLayers)
Iterator.AddFilter_Method(eProcessAll)
Set CompDes = Iterator.FirstPCBObject
PCBServer.PreProcess
I = 0
While Not (CompDes Is Nothing)
Call PCBServer.SendMessageToRobots(CompDes.Name.I_ObjectAddress,
c_Broadcast, PCBM_BeginModify, c_NoEventData)
I = I + 1
If CompDes.Layer = eTopLayer then 'Component is on the top
Select Case CompDes.Rotation
Case 0, 180, 360
CompDes.Name.Rotation = 0
Case 90, 270
CompDes.Name.Rotation = 90
End Select
else 'Component is on the bottom
Select Case CompDes.Rotation
Case 0, 180, 360
CompDes.Name.Rotation = 0
Case 90, 270
CompDes.Name.Rotation = 270
End Select
End If
Call PCBServer.SendMessageToRobots(CompDes.Name.I_ObjectAddress,
c_Broadcast, PCBM_EndModify , c_NoEventData)
Call PCBServer.SendMessageToRobots(CompDes.Name.I_ObjectAddress,
c_Broadcast, PCBM_BeginModify, c_NoEventData)
CompDes.ChangeNameAutoposition = eAutoPos_CenterCenter
Call PCBServer.SendMessageToRobots(CompDes.Name.I_ObjectAddress,
c_Broadcast, PCBM_EndModify , c_NoEventData)
Set CompDes = Iterator.NextPCBObject
Wend
'ShowMessage(I & " were found") 'Uncomment this line if you want a message
after it has finished.
Board.BoardIterator_Destroy(Iterator)
Pcbserver.PostProcess
Call AddStringParameter("Action", "Redraw")
RunProcess("PCB:Zoom")
End Sub


Tru Designs is an Altium Service Bureau
|
Tru Designs llc Altium Scripts