here is an example of recursive programming
Public Function GetNestedBlock(ByRef obj1 As ObjectId)
' recursive programming (calling itself)
Using DB As Database = HostApplicationServices.WorkingDatabase
Using Trans As Transaction = DB.TransactionManager.StartTransaction()
Try
Dim bRef As BlockReference = Trans.GetObject(obj1, OpenMode.ForRead)
Dim BTR As BlockTableRecord = Trans.GetObject(bRef.BlockTableRecord, OpenMode.ForRead, True)
Dim ID As ObjectId
'looping thru to grab all the objectid in the table on the block reference
For Each ID In BTR
Dim Ent As Entity = Trans.GetObject(ID, OpenMode.ForRead)
'is the selected entity a block
If TypeOf Ent Is BlockReference Then
Dim BlkRef As BlockReference = Ent
//your code//
GetNestedBlock(BlkRef.Id)
End If
Next
Catch ex As System.Exception
MsgBox(ex.Message)
Finally
Trans.Commit()
Trans.Dispose()
End Try
End Using
End Using
End Function
pat
www.cadenhancement.com