AutoCAD Civil 3D
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Can not purge blocks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I have a file with 403 blocks in it that can not be deleted, purged, or seen. I've attempted to WBLOCK the linework out, copy and paste the linework out, exploding every object in the file, changing everything to bylayer and layer 0, purgeing and -purgeing, but the blocks are still there along with a number of linestyles associated with the hidden blocks. Is there any way to get rid of these blocks? I have a file attached with nothing else in it except the blocks I cannot purge. They are also not associated with any styles. Any help would be greatly appreciated.
Thanks,
Ryan
Civil 3D 2013
Re: Can not purge blocks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
What happens if you use QuickSelect to select all instances of one of the blocks, and delete. Can it then be purged? Not something you want to do 403 times, but as a test.
You could try a couple of searches for a deep purge or super purge lisp routine. There might be something out there to help you.
Win 7 Pro, 32 bit; Intel Core i5 @ 2.80GHz; 4GB RAM—Civil 3D 2008 & 2011
__________________________________________________________
Credit where credit is due! Give kudos or accept as solution whenever you can.
Re: Can not purge blocks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Quick select is not available. The file doesn't appear to have any objects in it. The blocks only show up under the items that you cannot purge.
Civil 3D 2013
Re: Can not purge blocks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
This would work, but it's dangerous. It deletes every block definition from your drawing. It doesn't check to see if the block is in use or anything, it just deletes all block definitions. So it would completely hose most drawings.
(setq acad (vlax-get-acad-object))
(setq doc (vla-get-activedocument acad))
(setq blocks (vla-get-blocks doc))
(while (> (vla-get-count blocks) 2); blocks 0 and 1 are modelspace and paperspace
(setq b1 (vla-item blocks 2))
;; This is where you'd put filters to weed out blocks you want to keep
(vlax-invoke-method b1 'delete)
)
(vlax-release-object blocks)
(vlax-release-object doc)
(vlax-release-object acad)Hope this helps!
John
Re: Can not purge blocks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Would I just type the code in the command line? I don't have that much coding experience.
Civil 3D 2013
Re: Can not purge blocks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I think copy/paste in commandline will work.
If you want to save it as a routine, you can put the text in notepad, save it with the file extention .lsp
Then you need to type appload in autocad, browse to the .lsp file and load it.
But I think there may be more lines required in the code for it to work that way.
Win 7 Pro, 32 bit; Intel Core i5 @ 2.80GHz; 4GB RAM—Civil 3D 2008 & 2011
__________________________________________________________
Credit where credit is due! Give kudos or accept as solution whenever you can.
Re: Can not purge blocks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You can copy and paste it in at the command line (do it all in one shot, not line-by-line).
But this is like a last resort thing. I would recommend you try to find out what these things are and how they were created. If purge doesn't want to delete them, there's probably a reason. Though I did look through the drawing and couldn't find anything.
If you're just looking for a blank slate, try creating a drawing with acad.dwt.
Running this routine could potentially do more harm than good, which is why I didn't write it into a function. I hesitate using it once, let alone setting it up to be used repeatedly.
Re: Can not purge blocks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I ran it and it gives me an automation error. Object is referenced. Thanks for the help though.
Civil 3D 2013
Re: Can not purge blocks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You know what - when I ran that successfully, it was after I had exported your drawing to AutoCAD. Export to AutoCAD removes all Civil3D objects from a drawing.
Why are you doing this anyway?
Re: Can not purge blocks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Ryan, in the same vein as what John mentioned, try this bit of lisp: (I did test it on your drawing without error)
(vl-load-com)
(vlax-for blk (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
(if (= (vla-get-islayout blk) :vlax-false)
(vla-delete blk)
)
)
This makes sure to not include the Modelspace or any Paperspace objects. From the looks of the drawing, I think that an Xref containing anonymous Groups was Inserted/Bound to the drawing and something triggered them as being unpurgable, although I'm not sure what that could have been.
Oh, and I ran it from the C3D as AutoCAD icon, not inside C3D.


