Jump to content

Recommended Posts

Posted

Hello,

 

I need to find empty blocks in the drawing, as they are causing some problems for us. How can I get AcadBlockReference entities count using VBA? To be more precise, how can I find blocks with zero entities?

 

currently I have this code:

 

Dim objEntity As AcadEntity

Dim objTemp As AcadBlockReference

For Each objEntity In ThisDrawing.ModelSpace

If TypeOf objEntity Is AcadBlockReference Then

MsgBox objTemp.EffectiveName

...

 

What can I do with objTemp to find out about those entities within block?

Posted

I did that myself.. Turns out that I can only find block entities count with AcadBlock not AcadBlockReference. Soo I did get the results I wanted with this extra function:

Private Function GetBlock(pavadinimas As String) As AcadBlock

Dim aa As Integer

For aa = 1 To ThisDrawing.Blocks.Count

'MsgBox ThisDrawing.Blocks(aa - 1).Name

If ThisDrawing.Blocks(aa - 1).Name = pavadinimas Then

Set GetBlock = ThisDrawing.Blocks(aa - 1)

Exit Function

End If

Next aa

End Function

 

.. and the AcadBlock object has Count property in it. That's all I needed

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...