Author Topic: Block instances  (Read 2559 times)

0 Members and 1 Guest are viewing this topic.


  • Guest
Block instances
« on: July 23, 2014, 03:48:33 AM »
Hi all,

I've created an AcadBlock (with AutoCad VBA) and now I wish to count the number of instances of that
block within the modelspace.

Can anyone provide me with a brief code on this ?

Thanks a Bunch !


  • Guest
Re: Block instances
« Reply #1 on: August 15, 2014, 10:35:23 AM »
dim ObjFind as AcadObject
dim BRFind as AcadBlockReference
dim BRCount as Integer

for each ObjFind in ThisDrawing.Modelspace
    if typeof ObjFind is AcadBlockReference then
        Set BRFind = ObjFind
        If BRFind.Name = "[Insert name of block from AutoCAD here]" Then
            BRCount = BRCount + 1
        End If
    End If

that should work, with your number of instances stored in BRCount.