ibrahem Posted August 29, 2019 Share Posted August 29, 2019 HELLO, I WANT A HELP TO MODIFY THIS ROUTINE THAT LEE MAC WROTES. I WANT TO SELECT MANY BLOCKS ON ONE SELECTION METHOD. THANKS , (defun c:bsel ( / att atx blk cnt ent enx flg idx sel str tag ) (setq blk (strcase (getstring t "\nSpecify block name <any>: ")) tag (strcase (getstring "\nSpecify attribute tag <any>: ")) str (strcase (getstring t (strcat "\nSpecify attribute value" (if (= "" tag blk) ": " " <any>: ")))) ) (if (not (= "" str tag blk)) (if (and (setq sel (ssget "_X" (append '((000 . "INSERT")) (if (not (= "" tag str)) '((066 . 1))) (if (/= "" blk) (list (cons 2 (strcat "`*U*," blk)))) (if (= 1 (getvar 'cvport)) (list (cons 410 (getvar 'ctab))) '((410 . "Model")) ) ) ) ) (progn (repeat (setq idx (sslength sel)) (setq ent (ssname sel (setq idx (1- idx))) enx (entget ent) ) (cond ( (not (or (= "" blk) (wcmatch (strcase (LM:name->effectivename (cdr (assoc 2 enx)))) blk))) (ssdel ent sel) ) ( (member (cdr (assoc 66 enx)) '(nil 0))) ( (progn (setq att (entnext ent) atx (entget att) flg nil ) (while (and (= "ATTRIB" (cdr (assoc 0 atx))) (not (and (or (= "" str) (wcmatch (strcase (cdr (assoc 1 atx))) str)) (or (= "" tag) (wcmatch (strcase (cdr (assoc 2 atx))) tag)) ) ) ) (setq att (entnext att) atx (entget att) ) ) (= "SEQEND" (cdr (assoc 0 atx))) ) (ssdel ent sel) ) ) ) (< 0 (setq cnt (sslength sel))) ) ) (progn (princ (strcat "\n" (itoa cnt) " block" (if (= 1 cnt) "" "s") " found.")) (sssetfirst nil sel) ) (princ "\nNo blocks found.") ) ) (princ) ) ;; Block Name -> Effective Block Name - Lee Mac ;; blk - [str] Block name (defun LM:name->effectivename ( blk / rep ) (if (and (wcmatch blk "`**") (setq rep (cdadr (assoc -3 (entget (cdr (assoc 330 (entget (tblobjname "block" blk)))) '("acdbblockrepbtag") ) ) ) ) (setq rep (handent (cdr (assoc 1005 rep)))) ) (cdr (assoc 2 (entget rep))) blk ) ) (princ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 29, 2019 Share Posted August 29, 2019 3 hours ago, ibrahem said: I WANT TO SELECT MANY BLOCKS ON ONE SELECTION METHOD. What do you mean by this? Quote Link to comment Share on other sites More sharing options...
ibrahem Posted August 29, 2019 Author Share Posted August 29, 2019 HELLO LEE MAC, I DON'T SPEAK ENGLISH WELL. FOR EXAMPLE: Specify block name -- ANY BLOCK Specify attribute tag--ANY TAG AND HERE I WANT TO ENTER MULTIBLE VALUES Specify attribute tag-- 84,90,100,...………. AND ALL THE BLOCKS I WANT TO SELECT IT BY THIS VALUES. THANK YOU Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 29, 2019 Share Posted August 29, 2019 The program already accepts wildcards, therefore you should be able to separate multiple values with commas. Quote Link to comment Share on other sites More sharing options...
ibrahem Posted August 31, 2019 Author Share Posted August 31, 2019 OK , THANK YOU VERY MUCH. Quote Link to comment Share on other sites More sharing options...
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.