stevesfr Posted February 1, 2012 Posted February 1, 2012 Greetings How to write short lisp to erase all insertions of one unique block? or how to do same from command line? i.e. (command "._erase" "") but this doesn't work.... somewhere there must be a place for a dotted pair? TIA Steve Quote
BlackBox Posted February 1, 2012 Posted February 1, 2012 "Select" block "Right-Click", Select "Select Similar" Press "Delete" Quote
stevesfr Posted February 1, 2012 Author Posted February 1, 2012 "Select" block "Right-Click", Select "Select Similar" Press "Delete" thanks, but if I knew what to do after Command " da da " etc. I could glue it into a lisp. I intend for lisp program to automatically erase the hardwired block name I put in. Thanks tho for reply Steve Quote
BlackBox Posted February 1, 2012 Posted February 1, 2012 Separately, the ERASE command is expecting a selection set. (defun c:FOO (/ ss) (if (setq ss (ssget ":S:E:L" '((0 . "INSERT")))) (command "._erase" (ssget "_x" (list '(0 . "INSERT") (cons 2 (cdr (assoc 2 (entget (ssname ss 0))))) (cons 410 (getvar 'ctab)))) "") (prompt "\n** Nothing selected ** ")) (princ)) Quote
BlackBox Posted February 1, 2012 Posted February 1, 2012 thanks, but if I knew what to do after Command " da da " etc. I could glue it into a lisp. I intend for lisp program to automatically erase the hardwired block name I put in.Thanks tho for reply Steve Aha - Had I known... (defun c:FOO (/ ss) (if (setq ss (ssget "_x" (list '(0 . "INSERT") '(2 . [color=red]<BlockName>[/color]) (cons 410 (getvar 'ctab))))) (command "._erase" ss "") (prompt "\n** No blocks found ** ")) (princ)) Quote
Lee Mac Posted February 1, 2012 Posted February 1, 2012 Quickly written: (defun c:DelBlock ( / blk ent inc obj sel ) (while (not (or (eq "" (setq blk (getstring t "\nSpecify Block Name: "))) (tblsearch "BLOCK" blk) ) ) (princ "\nBlock not Found.") ) (if (and (not (eq "" blk)) (setq sel (ssget "_X" (list '(0 . "INSERT") (cons 2 (strcat "`*U*," blk))))) ) (repeat (setq inc (sslength sel)) (setq ent (ssname sel (setq inc (1- inc))) obj (vlax-ename->vla-object ent) ) (if (or (and (vlax-property-available-p obj 'effectivename) (eq (strcase blk) (strcase (vla-get-effectivename obj))) ) (eq (strcase blk) (strcase (vla-get-name obj)) ) ) (entdel ent) ) ) ) (princ) ) (vl-load-com) (princ) Quote
stevesfr Posted February 2, 2012 Author Posted February 2, 2012 Thank you Lee and RM... I now have the tools to complete my task !!! guys here are the best of the NET !!! cheers and beers around !! Steve Quote
BlackBox Posted February 2, 2012 Posted February 2, 2012 cheers and beers around !! I cheers and beers. LoL 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.