Accessing Blocks Inside Blocks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I am writing a program that analyzes the attributes of blocks in an layout. However, I cannot find the way to access AcadBlockReference's of blocks inside a block. Anyone have an idea how to approach this? Here's my lines of code:
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Interop.Common
Imports System.Runtime.InteropServices
Sub Main()
Dim acad As AcadApplication = Marshal.GetActiveObject("Autocad.Application")
Dim acadDoc As AcadDocument = acad.ActiveDocument
Dim layout As AcadLayout = acadDoc.Layouts.Item("Model")
End Sub
Sub RunProgram(Lay As AcadLayout)
Dim Ent As AcadEntity
Dim Blk As AcadBlockReference
For i As Integer = 0 To Lay.Block.Count
Ent = Lay.Block.Item(i)
If TypeOf Ent Is AcadBlockReference Then
Call ProcessBlock(Ent)
End If
Next
End Sub
Sub ProcessBlock(Blk As AcadBlockReference)
Debug.Print("Name: {0}", Blk.EffectiveName)
'if block has blocks inside, ProcessBlock(New block)
End Sub
Thanks!