Create a sting from the PCB file name and place it on the board but leave off the ending (.pcbdoc). It will place a string on any routing and mechanical layer that is currently enabled and is visible.
Sub AddFileName
Dim Board
Dim ASMSting
Dim Layer
Dim TmpString
Set Board = PCBServer.GetCurrentPCBBoard
If Board is Nothing Then Exit Sub
PCBServer.PreProcess
For Layer = eTopLayer to eMultiLayer
If Board.LayerIsDisplayed(Layer) AND Board.LayerIsUsed(Layer) Then
ASMString = PCBServer.PCBObjectFactory(eTextObject,_
eNoDimension, eCreate_Default)
ASMString.XLocation = Board.XOrigin + MilsToCoord(500) '500 mils from origin in X
ASMString.YLocation = Board.YOrigin - MilsToCoord(500) '-500 mils from origin in Y
TmpString = Board.FileName
'Get rid of the drive and folder portion of the FileName
While Instr(TmpString, "\") <> 0
TmpString = Right(TmpString, Len(TmpString)-Instr(TmpString, "\") ) 'removes the path
Wend
ASMString.Text = Left(TmpString, Instr(TmpString, ".") - 1 ) 'removes the extension
ASMString.Size = MilsToCoord(100) 'Size of the string is 10
ASMString.Layer = Layer
Board.AddPCBObject(ASMString) ' Put this string on the Board
Call PCBServer.SendMessageToRobots(ASMString.I_ObjectAddress, c_Broadcast,_
PCBM_BoardRegisteration, ASMString.I_ObjectAddress)
End If
Next
Pcbserver.PostProcess
ResetParameters
Call AddStringParameter("Action", "Redraw")
RunProcess("PCB:Zoom")
End Sub
http://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 String. Show all posts
Showing posts with label String. Show all posts
Friday, April 29, 2011
Make A String
Create a sting of various heights and widths on the PCB.
Sub StringCreation
Dim Board
Dim ASMSting
Set Board = PCBServer.GetCurrentPCBBoard
If Board is Nothing Then Exit Sub
PCBServer.PreProcess
For I = 1 to 10
' Create a String object
ASMString = PCBServer.PCBObjectFactory(eTextObject, eNoDimension, eCreate_Default)
ASMString.XLocation = Board.XOrigin + I*MilsToCoord(50)
ASMString.YLocation = Board.YOrigin + I*MilsToCoord(100)
ASMString.Layer = eMechanical7
ASMString.Text = "This Is String #" & I & " with a height of " & (10*I) & " a width of " & I & "mils."
ASMString.Width = MilsToCoord(I)
ASMString.Size = MilsToCoord(10 * I)
Call PCBServer.SendMessageToRobots(ASMString.I_ObjectAddress, c_Broadcast,_
PCBM_BoardRegisteration, ASMString.I_ObjectAddress)
'Put this string on the Board
Board.AddPCBObject(ASMString)
Next
PCBServer.PostProcess
ResetParameters
Call AddStringParameter("Action", "Redraw")
RunProcess("PCB:Zoom")
End Sub
http://www.tdpcb.com/
Sub StringCreation
Dim Board
Dim ASMSting
Set Board = PCBServer.GetCurrentPCBBoard
If Board is Nothing Then Exit Sub
PCBServer.PreProcess
For I = 1 to 10
' Create a String object
ASMString = PCBServer.PCBObjectFactory(eTextObject, eNoDimension, eCreate_Default)
ASMString.XLocation = Board.XOrigin + I*MilsToCoord(50)
ASMString.YLocation = Board.YOrigin + I*MilsToCoord(100)
ASMString.Layer = eMechanical7
ASMString.Text = "This Is String #" & I & " with a height of " & (10*I) & " a width of " & I & "mils."
ASMString.Width = MilsToCoord(I)
ASMString.Size = MilsToCoord(10 * I)
Call PCBServer.SendMessageToRobots(ASMString.I_ObjectAddress, c_Broadcast,_
PCBM_BoardRegisteration, ASMString.I_ObjectAddress)
'Put this string on the Board
Board.AddPCBObject(ASMString)
Next
PCBServer.PostProcess
ResetParameters
Call AddStringParameter("Action", "Redraw")
RunProcess("PCB:Zoom")
End Sub
http://www.tdpcb.com/
Subscribe to:
Posts (Atom)

