Quick way to renumber pads, mostly useful in the pcb library editor.
Click on the pad with the first number and then click on the other pads and they will incremently change numbers.
Sub RenumberPads
Dim Board
Dim Rpad
Dim PadNumber
Set Board = PCBServer.GetCurrentPCBBoard
If Board is Nothing Then Exit Sub
Pcbserver.PreProcess
Set PadObject = Board.GetObjectAtCursor(MkSet(ePadObject),_
AllLayers,"Select Pad To Start With")
PadNumber = PadObject.Name + 1
While Board.ChooseLocation(x,y, "Click Next Pad To Renumber") = True
Set Rpad = Board.GetObjectAtXYAskUserIfAmbiguous(x,y,MkSet(_
ePadObject),AllLayers,eEditAction_Change)
If Not(Rpad is Nothing) Then
Call PCBServer.SendMessageToRobots(Rpad.I_ObjectAddress,_
c_Broadcast, PCBM_BeginModify, c_NoEventData)
Rpad.Name = PadNumber
Call PCBServer.SendMessageToRobots(Rpad.I_ObjectAddress,_
c_Broadcast, PCBM_EndModify , c_NoEventData)
End If
PadNumber = PadNumber + 1
Wend
Pcbserver.PostProcess
ResetParameters
Call AddStringParameter("Action", "Redraw")
RunProcess("PCB:Zoom")
End Sub
www.tdpcb.com
Altium Designer Script Information in VB for PCB Layout and Schematic Capture by Bill Smock from Tru Designs, San Diego, CA.
Showing posts with label GetObject. Show all posts
Showing posts with label GetObject. Show all posts
Friday, June 17, 2011
Friday, May 13, 2011
Get pads that make up a component using a group iterator.
Select a PCB component with the GetObject and then using a Group Iterator list all pads and the location of the pads that make up the choosen component.
Sub GetCompPads
Dim Board
Dim Comp
Dim CompGroup
Dim CompPads
Dim x,y
Set Board = PCBServer.GetCurrentPCBBoard
If Board is Nothing Then Exit Sub
While Board.ChooseLocation(x,y, "Choose Pad") = True
Set Comp = Board.GetObjectAtXYAskUserIfAmbiguous(x,y,MkSet(_
eComponentObject),AllLayers,eEditAction_Focus)
If Not(Comp is Nothing) Then
Set CompGroup = Comp.GroupIterator_Create
CompGroup.AddFilter_ObjectSet(MkSet(EpadObject))
Set CompPad = CompGroup.FirstPCBObject
While Not(CompPad is Nothing )
ShowMessage("Pad=" & CompPad.Name & " X=" & CoordToMils(CompPad.X)_
& " Y=" & CoordToMils(CompPad.Y))
Set CompPad = CompGroup.NextPCBObject
Wend
End If
Wend
End Sub
www.tdpcb.com
Sub GetCompPads
Dim Board
Dim Comp
Dim CompGroup
Dim CompPads
Dim x,y
Set Board = PCBServer.GetCurrentPCBBoard
If Board is Nothing Then Exit Sub
While Board.ChooseLocation(x,y, "Choose Pad") = True
Set Comp = Board.GetObjectAtXYAskUserIfAmbiguous(x,y,MkSet(_
eComponentObject),AllLayers,eEditAction_Focus)
If Not(Comp is Nothing) Then
Set CompGroup = Comp.GroupIterator_Create
CompGroup.AddFilter_ObjectSet(MkSet(EpadObject))
Set CompPad = CompGroup.FirstPCBObject
While Not(CompPad is Nothing )
ShowMessage("Pad=" & CompPad.Name & " X=" & CoordToMils(CompPad.X)_
& " Y=" & CoordToMils(CompPad.Y))
Set CompPad = CompGroup.NextPCBObject
Wend
End If
Wend
End Sub
www.tdpcb.com
Thursday, May 05, 2011
GetObject at cursor to pick a component.
Using the GetObject to choose what component to reset the designator to center/center.
Press escape to end action.
Sub ChooseDesReset
Dim Board
Dim Comp
Dim x,y
Set Board = PCBServer.GetCurrentPCBBoard
Call PCBServer.PreProcess
While Board.ChooseLocation(x,y, "Choose Component") = True
Set Comp = Board.GetObjectAtXYAskUserIfAmbiguous(x,y,MkSet(_
eComponentObject),AllLayers,eEditAction_Focus)
If Not(Comp is Nothing) Then
Call PCBServer.SendMessageToRobots(Comp.Name.I_ObjectAddress,_
c_Broadcast, PCBM_BeginModify, c_NoEventData)
Comp.ChangeNameAutoposition = eAutoPos_CenterCenter
Call PCBServer.SendMessageToRobots(Comp.Name.I_ObjectAddress,_
c_Broadcast, PCBM_EndModify , c_NoEventData)
End If
Wend
Call PCBServer.PostProcess
ResetParameters
Call AddStringParameter("Action", "Redraw")
RunProcess("PCB:Zoom")
End Sub
http://www.tdpcb.com/
Press escape to end action.
Sub ChooseDesReset
Dim Board
Dim Comp
Dim x,y
Set Board = PCBServer.GetCurrentPCBBoard
Call PCBServer.PreProcess
While Board.ChooseLocation(x,y, "Choose Component") = True
Set Comp = Board.GetObjectAtXYAskUserIfAmbiguous(x,y,MkSet(_
eComponentObject),AllLayers,eEditAction_Focus)
If Not(Comp is Nothing) Then
Call PCBServer.SendMessageToRobots(Comp.Name.I_ObjectAddress,_
c_Broadcast, PCBM_BeginModify, c_NoEventData)
Comp.ChangeNameAutoposition = eAutoPos_CenterCenter
Call PCBServer.SendMessageToRobots(Comp.Name.I_ObjectAddress,_
c_Broadcast, PCBM_EndModify , c_NoEventData)
End If
Wend
Call PCBServer.PostProcess
ResetParameters
Call AddStringParameter("Action", "Redraw")
RunProcess("PCB:Zoom")
End Sub
Labels:
Components,
Cursor,
GetObject
Subscribe to:
Posts (Atom)