Jump to content

Too many blocks How to delete some totally


NarkDuffy

Recommended Posts

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 by NarkDuffy
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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