Click on a component and the designator autoposition will cycle around the 8 positions each time you click on the component.
Sub CycleDesPos
Dim Board
Dim Comp
Dim I
Dim eAutoArray
' 0 1 2
'eAutoPos_TopLeft,eAutoPos_CenterLeft,eAutoPos_BottomLeft,
' 3 4 5
'eAutoPos_BottomCenter,eAutoPos_BottomRight,eAutoPos_CenterRight,
' 6 7
'eAutoPos_TopRight,eAutoPos_TopCenter
eAutoArray = Array(1,2,3,6,9,8,7,4)
Set Board = PCBServer.GetCurrentPCBBoard
If Board is Nothing Then Exit Sub
Call PCBServer.PreProcess
While Board.ChooseLocation(x,y, "Click Via To Change") = True
Set Comp = Board.GetObjectAtXYAskUserIfAmbiguous(x,y,MkSet(_
eComponentObject),AllLayers,eEditAction_Focus)
I= -1
If Not(Comp is Nothing) Then
'Look for the current setting of the autoposition
For J = 0 to 7
If Comp.NameAutoposition = eAutoArray(J) Then
I = J + 1
'Set the array to begin again at eAutoPos_TopLeft
If J = 7 Then
I = 0
End If
End If
Next
'Autoposition is either manual or centercenter
If I = -1 Then
I = 0
End If
Call PCBServer.SendMessageToRobots(Comp.I_ObjectAddress,_
c_Broadcast, PCBM_BeginModify, c_NoEventData)
Comp.ChangeNameAutoposition = eAutoArray(I)
Call PCBServer.SendMessageToRobots(Comp.I_ObjectAddress,_
c_Broadcast, PCBM_EndModify , c_NoEventData)
End If
Wend
Call PCBServer.PostProcess
ResetParameters
Call AddStringParameter("Action", "Redraw")
RunProcess("PCB:Zoom")
End Sub
www.tdpcb.com