Jump to content

Recommended Posts

Posted

Hello

 

Can someone please tell me how I can adjust the code below to delete all the specified dynamic blocks in the drawing? This code works well when I’m deleting regular blocks, but it doesn’t seem to work when I want to get rid of dynamic blocks.

 

 
Dim DeleteThisBlock As String
DeleteThisBlock  = "PE_Stamps"

Dim oEnt As AcadEntity
Dim blkRefObj As AcadBlockReference
Dim d As Integer
d = 0
For Each oEnt In ThisDrawing.PaperSpace
   If TypeOf oEnt Is AcadBlockReference Then d = d + 1
Next
If Not d = 0 Then
   For Each oEnt In ThisDrawing.PaperSpace
       If TypeOf oEnt Is AcadBlockReference Then
           Set blkRefObj = oEnt
       If StrComp(UCase(blkRefObj.Name), UCase(DeleteThisBlock)) = 0 Then
       blkRefObj.Delete
       End If
       End If
   Next
End If

Thank you for your help

Mike

Posted

Hi,

 

I'm not comfortable with VB but try replace:

(blkRefObj.Name)

with

(blkRefObj.EffectiveName)

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