Jump to content

Block attributes


korhaniski

Recommended Posts

Hello all,

 

I am having an issue with a code that semi works. The following code works when i have only one block that is called "DBORDER_1"

 

Dim blk As AcadBlockReference

For Each blk In ThisDrawing.ModelSpace

If blk.Name = "DBORDER_1" Then

....

 

 

However when I have more than 1 block than the vba code crashes. The runtime error code is 13, type mismatch. What i am trying to do is to find the block named "DBORDER_1" and determine its attributes.

would anyone know how to remove this problem. thanks. Korhaniski

Link to comment
Share on other sites

Hello all,

 

I am having an issue with a code that semi works. The following code works when i have only one block that is called "DBORDER_1"

 

Dim blk As AcadBlockReference

For Each blk In ThisDrawing.ModelSpace

If blk.Name = "DBORDER_1" Then

....

 

 

However when I have more than 1 block than the vba code crashes. The runtime error code is 13, type mismatch. What i am trying to do is to find the block named "DBORDER_1" and determine its attributes.

would anyone know how to remove this problem. thanks. Korhaniski

 

At the first glance you need declare AcadEntity before

i.e.

Dim oEnt as AcadEntity
Dim blk As AcadBlockReference
For Each oEnt In ThisDrawing.ModelSpace
if Typeof oEnt Is AcadBlockReference Then
Set blk=oEnt
If blk.Name = "DBORDER_1" Then 
< the rest code goes here>
End If
End If
Next oEnt

 

~'J'~

Link to comment
Share on other sites

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...