We recieved some files from an architect and they contained a bunch of stuff that has been since embeded into our base files. It's making our drawings incredibly slow and frustrating the entire team. We are way too far along to try and re-build new line work. Copying our likework out and wblocking have all resulted in these entities being carried through.
And here's another, safer, variation that will only remove the blocks created by Group:
(vlax-for blk (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (if (wcmatch (vla-get-name blk) "`*A*") (vla-delete blk) ) )
Or another that does the Group blocks and Anonymous blocks:
(vlax-for blk (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (if (wcmatch (vla-get-name blk) "`*A*,`*U*") (vla-delete blk) ) )
Here's one that explodes anonymous blocks, something that was driving me nutty:
(defun c:test (/ ss old-echo item ss1 item1) (setq old-echo (getvar "CMDECHO")) (setvar "CMDECHO" 0) (if (setq ss (ssget '((2 . "`*U*")))) (foreach item (mapcar 'cadr (ssnamex ss)) (command "Explode" item) (while (setq ss1 (ssget "_P" '((2 . "`*U*")))) (foreach item1 (mapcar 'cadr (ssnamex ss1)) (command "Explode" item1) ) ) ) ) (setq ss nil) (setq ss1 nil) (setvar "CMDECHO" old-echo) (princ) )
Don't know if that is related or not.
Credit where credit is due! Give kudos or accept as solution whenever you can.
I ended up exporting the linework base file I had to a DXF file and then brought it back in. This allowed me to then purge all of the blocks I was unable to see or purge before. I'm not sure if that's the best way to do it, but nothing else was working. Luckily I didn't have to do something like that to a file that had any built in intelligence, it was just lines. Thanks for everyone's help.