Thanks for your response Alfred!
Im sorry but I forgot to mention that I would be trying to achieve this in VB.net
This is what I currently have going but am stuck at a roadblock:
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim tr As Transaction = db.TransactionManager.StartTransaction()
Dim res As PromptSelectionResult = ed.SelectAll
Dim selSet As SelectionSet = res.Value
Dim idArray As ObjectId() = selSet.GetObjectIds()
For Each blkId As ObjectId In idArray
Dim obj As DBObject = tr.GetObject(blkId, OpenMode.ForRead)
Dim blkRef As BlockReference = DirectCast(tr.GetObject(blkId, OpenMode.ForRead), BlockReference)
Dim btr As BlockTableRecord = DirectCast(tr.GetObject(blkRef.BlockTableRecord, OpenMode.ForRead), BlockTableRecord)
If btr.IsFromExternalReference Then
MsgBox("yes")
End If
Next
Instead of the message box, I want to get to the next step of picking up the attributes tho at that point btr is of External Reference type and doesn't contain any original block attributes (the Xref contains multiple blocks with multiple attributes so I need to drill down to this level).
Is there a way to turn btr to a certain type of object which is a collection of the blocks that the xref contains that I can cycle through?
so the code would be something like this (if possible?):
If btr.IsFromExternalReference Then
dim XrefBlockCollection as (some object array)
dim i as in int = 0
For Each id As ObjectId In XrefBlockCollection
Dim ad As AttributeDefinition = TryCast(tr.GetObject(id, OpenMode.ForRead), AttributeDefinition)
If ad IsNot Nothing Then
print( ad.tag & ad.textstring )
End If
next
end while
End If
Much appreciated for all your time
HD