I've got some code that I want to use to for searching through blocks that uses the SymbolTable.. The code was from someone that helped me out on the Autodesk forums. It was in C# so I "translated it" into VB code. And I think I did a good job of converting it, but I'm slightly confused about the usage of one particular line and what I am supposed to pass to it.
The Arx documentation confuses the heck out of me sometimes. Most of the time I can figure it out but this one is stumping me. So if anyone can help or at least point me in the right direction
Dim table As SymbolTable = CType(trans.GetObject(TableId,OpenMode.ForRead), SymbolTable)
tableid is a variable that gets passed to the function, but I'm trying to figure out what that is supposed to be that I am passing to it? It tells me it needs to be DatabaseServices.ObjectID, but I can't figure out what I should passing? That's where I am stumped
The full function if anyone is curious is
Public Shared Function GetBlockName(ByVal tableId As ObjectId, ByVal prefix As String) As String
Dim names As ArrayList
Dim db As Database = HostApplicationServices.WorkingDatabase()
Using trans As Transaction = db.TransactionManager.StartTransaction()
Dim table As SymbolTable = CType(trans.GetObject(TableId,OpenMode.ForRead), SymbolTable)
Dim id As ObjectId
For Each id In table
If Not id.IsErased Then
Dim rec As SymbolTableRecord = CType(trans.GetObject(id,OpenMode.ForRead), SymbolTableRecord)
If rec.Name.StartsWith(prefix,StringComparison.InvariantCultureIgnoreCase) Then
names.Add(rec.Name)
End If
End If
Next
names.Sort()
Dim n As Integer = 0
While names.BinarySearch(String.Format("{0}{1}",prefix,n)) > -1
n = n + 1
End While
Return String.Format("{0}{1}", prefix, n)
End Using
End Function
Thanks!