TroutKing Posted September 17, 2009 Posted September 17, 2009 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 Quote
gile Posted September 17, 2009 Posted September 17, 2009 Hi, I'm not comfortable with VB but try replace: (blkRefObj.Name) with (blkRefObj.EffectiveName) Quote
TroutKing Posted September 17, 2009 Author Posted September 17, 2009 Beautiful! That worked. Thank you very much! Quote
Recommended Posts
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.