NarkDuffy Posted February 23, 2021 Posted February 23, 2021 (edited) Good day to you all. I have hundreds of blocks. I do not know where they came from - down loading blocks or drawings I suspect. I need to thin out the ones I will never use but can't find out how. They make it very difficult to find what I want. I haver not used this forum before and am excited to be starting. All the best Mark Edited February 23, 2021 by NarkDuffy Quote
SLW210 Posted February 23, 2021 Posted February 23, 2021 If they are not used in the drawing, -PURGE them. If used in the drawing, you will need to delete them, then -PURGE them. Quote
CyberAngel Posted February 23, 2021 Posted February 23, 2021 SLW is correct. Watch out for nested blocks, that is, blocks inside of other blocks. You may also find anonymous blocks, whose names start with an asterisk. If there are blocks that you use on a regular basis, consider adding them to your template(s). That way you don't have to bring them in every time. 1 Quote
BIGAL Posted February 24, 2021 Posted February 24, 2021 The purge will remove unused blocks but maybe you want one of them, so the only alternative may be to do insert all blocks so you can look at them, there is a few examples around to do a grid of bocks. The other thing is its pretty easy to just create a text file of all the block names. So could do a script style of -purge Blocks Name, note the "-" you can also do wildcard so could do ac* etc A quicky copy and paste to command line (vlax-for blk (vla-get-blocks (vla-get-ActiveDocument (vlax-get-acad-object))) (princ "\n") (princ (vla-get-name blk)) ) Like Cyberangel we had a tree that consisted of 5 blocks the branches were repeated as nested blocks, exploded and saved final result 1 block, removed 4. Quote
jonathann3891 Posted February 26, 2021 Posted February 26, 2021 I recently wrote this to allow me to select a block that I want completely deleted and purged from a drawing. Maybe it will be useful to you. (defun c:DAPB (/ bname ucmdecho ss) (vl-load-com) (setq ucmdecho (getvar 'cmdecho)) ;get user cmdecho setting (setvar 'cmdecho 0) ;turn off cmdecho (setq bname (vla-get-effectivename (vlax-ename->vla-object (car (entsel "\n Select block: "))))) ;get block name (setq ss (ssget "X" (list '(0 . "INSERT")(cons 2 bname)))) ;get all blocks in drawing (if (= (acet-ui-message "This will delete and purge this block for this drawing! Ok to proceed?" "Delete & Purge" 1) 2)(exit)) (command "erase" ss "" "-purge" "B" bname "N" "regenall") (setvar 'cmdecho ucmdecho) ;restore user cmdecho setting (princ) ) Quote
BIGAL Posted February 27, 2021 Posted February 27, 2021 narkduffy your turn now Jonathon has provided a good routine that could be easily be changed for multiple blocks, so you need to provide info about how to choose what to delete, name or pick ? 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.