SunnyTurtle Posted November 14, 2011 Posted November 14, 2011 Hi I am try to create a script that will remove all of type of dynamic block. I can do this manual using quick select and filtering by name. But I cannot do this with the ssx command that I use in my scripts So I guess I have 2 questions: can you used quickselect in script? how does quickselect determine these blocks by name? Quote
YZ Posted November 28, 2011 Posted November 28, 2011 You can use the QSELECT command in a script but it spits up a dialog box. For some reason that command does not have a -QSELECT alternative to suppress it to the command line. It is therefore very dificult to automate a script for it. Someone on this forum previously suggested to me that I try using FILTER but I have not had time yet to verify if it will work. Quote
SunnyTurtle Posted November 29, 2011 Author Posted November 29, 2011 Hi YZ I have found a solution for my problem but sadly no way to automate QSELECT or FILTER. To delete all of a praticual dynamic block i used a mixture of lisp and script. Lisp DDSS (dynamic block selection set) ;SORCED [url]http://forums.augi.com/archive/index.php/t-31578.html[/url] ;17/11/2011 ;posted by irneb ;at 2007-12-07, 01:11 PM ;on [url]http://forums.augi.com/archive/index.php/t-31578.html[/url] ;modified RCondon 17/11/2011 (defun c:DBSS (/ name ss namelist n en ed eo sslist) ;; Ask user for block's effective name (if (not (setq name (getstring "Enter the block's effective name: "))) (quit) ) ;_ end of if ;; Search through blocks for anonymous referring to this effective name (setq namelist (list name) ;Initialize names list with normal block's name ss (ssget "x" '((0 . "INSERT") (2 . "`**"))) ;Get all anonymous blocks in drawing n 0 ;Initialize counter ) ;_ end of setq ;; Step through selection set (while (< n (sslength ss)) ;; Get nth entity in selection set + it's data (setq en (ssname ss n) ed (entget en) ) ;_ end of setq ;; Check if it isn't an unchanged dynamic block & that it hasn't been added to the list already (if (and (/= name (cdr (assoc 2 ed))) (not (member (strcat "`" (cdr (assoc 2 ed))) namelist)) ) ;_ end of and (progn ;; Get the entity's object handle (setq eo (vlax-ename->vla-object en)) ;; Check if effective name is the same (if (= name (vlax-get-property eo 'EffectiveName)) ;; Add the anonymous block's name with reverse appostrophe prefix (setq namelist (cons (strcat "`" (cdr (assoc 2 ed))) namelist)) ) ;_ end of if ) ;_ end of progn ) ;_ end of if (setq n (1+ n)) ) ;_ end of while ;; Clear selection set & clear memory (setq ss nil) (gc) ;; Construct the selection filter list in reverse order (setq sslist '((-4 . "<OR") (0 . "INSERT")) n 0 ) ;_ end of setq ;; Step through the list of names (while (< n (length namelist)) ;; Add the name to the filter list (setq sslist (cons (vl-list* 2 (nth n namelist)) sslist)) (setq n (1+ n)) ) ;_ end of while ;; End the filter list's OR section (setq sslist (cons '(-4 . "OR>") sslist)) ;; Reverse the list to get it in the correct order (setq sslist (reverse sslist)) ) ;_ end of defun Script needed to run lisp (load "DBSS.lsp") DBSS TAG_PAV _.erase P Quote
SunnyTurtle Posted January 18, 2013 Author Posted January 18, 2013 I Have recently upgraded to 2012 and this lisp is not working It is selecting all blocks and not filtering but the name. Can anyone help me modify Quote
YZ Posted February 11, 2013 Posted February 11, 2013 This might go better in the lisp forum now that you are using lisp rather than a script. Quote
SunnyTurtle Posted February 11, 2013 Author Posted February 11, 2013 This might go better in the lisp forum now that you are using lisp rather than a script. is there a way to move this Thread or do i need to post a new one Quote
YZ Posted February 11, 2013 Posted February 11, 2013 I am not certain how to move it. I usually see the moderators doing that on our behalf. But if you don't hear from one then I'd say copy and paste into a new thread on that forum. Quote
SLW210 Posted February 11, 2013 Posted February 11, 2013 Relocated your thread to the AutoLISP, Visual LISP & DCL forum. 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.