Get a list of net names in the PCB and write a report (text file).
Sub ReportNets
Dim Board
Dim FileName
Dim ReportFile
Dim ReportDocument
Dim fso
BeginHourGlass
Set Board = PCBServer.GetCurrentPCBBoard
If Board is Nothing Then Exit Sub
FileName = Left(Board.FileName, InstrRev(Board.FileName, "\") ) & "ReportNets.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set ReportFile = fso.CreateTextFile(FileName, True)
NetIterator = Board.BoardIterator_Create
NetIterator.AddFilter_ObjectSet(MkSet(eNetObject))
NetIterator.AddFilter_LayerSet(AllLayers)
NetIterator.AddFilter_Method(eProcessAll)
Set NetFound = NetIterator.FirstPCBObject
While Not (NetFound Is Nothing)
Call ReportFile.WriteLine( NetFound.Name )
Set NetFound = NetIterator.NextPCBObject
Wend
Board.BoardIterator_Destroy(NetIterator)
Call AddStringParameter("Action", "Redraw")
RunProcess("PCB:Zoom")
ReportFile.Close
Set ReportDocument = Client.OpenDocument("Text", FileName)
If Not (ReportDocument Is Nothing) Then
Client.ShowDocument(ReportDocument)
End If
EndHourGlass
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 PCB File Name. Show all posts
Showing posts with label PCB File Name. Show all posts
Monday, May 16, 2011
Friday, April 29, 2011
File Name On Visible Layers
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/
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/
Labels:
Layer,
PCB File Name,
String
Subscribe to:
Posts (Atom)

