- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi folks,
I am trying to select a specific block and delete it with Lisp.
I can not pick the block using any selection mode. Reason being is I want to run a batch script on several files.
For instance, I have this code which will work, however, if If place the code in a loop to delete all REVISION_SYMBOL_I_22x34 blocks in a drawing, it will actually delete all unamed blocks and not just the one I need deleted. It seems that my code just selectes any unamed block after it deletes the first one I want when I place in a loop (loop no in code below). Any help appreciated. Thanks
Moderator edit: Put code in code window, use </> button.
(defun c:DeleteBlocks ()
(vl-load-com)
(setq blockName "REVISION_SYMBOL_I_22x34")
(setq ss (ssget "_X" (list '(0 . "INSERT") (cons 2 (strcat "`*U*," blockName)))))
(setq blkRef (ssname ss 0))
(vla-delete (vlax-ename->vla-object blkRef))
(ssdel blkRef ss)
(princ)
)
Tags
Solved! Go to Solution.