Even though, you can use the SELECTSIMILAR [found here] command to select a block and then this command will select the other blocks like the selected block…Here is a LISP rouinte that will make a selection set of a named block.
Edit the below lisp routine to select that you want selected. To do this, change the word “test” to the name of your block within quotes.
Save the lisp routine…
Thanks to Tharwat and him being extremely patient, he made many variations to this program.
The code in its various revisions can be found here: http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/selection-set-by-block-name/m-p/5192827/highlight/true#M324878
There’s really no need to find all Blocks and step through them one at a time to determine whether they have the right name. You can eliminate some variables and the whole (repeat) function and some other bits and pieces, by doing just:
(sssetfirst nil (ssget “_X” ‘((0 . “INSERT”) (2 . “TEST”))));;;;;;;change the Block name
That sounds simple enough… The next thing I was going to do was modify this to select multiple named blocks. Would your method do that easily?
Note: I have had barely any time to put stuff together for the blog since I started teaching about a month ago…
You can use wildcards and multiple patterns as described for (wcmatch), in the case of multiple Block names, stringing them together with comma separators:
(sssetfirst nil (ssget “_X” ‘((0 . “INSERT”) (2 . “test1,test2,test3”))))
Hi Kent ,
I have just read this article that brought by a guy that I helped before and noticed your reply against it , so although that the program is quite old and I could offer another one that would be mush better in performance , I wanted to tell you that I did the iteration to obtain Dynamic blocks as well as the standard / Normal blocks cause to just add the block in the filter of the ssget function , that doesn’t work with dynamic blocks .
I am going to update my post so that it doesn’t have the code posted, but rather a link to the programs. That guy had so many pages of “almost , but can you change this and that…”
Thanks for your work Tharwat
Oh, and following on my previous comment: It’s not even case-sensitive, so the (strcase) functions are not needed. The Block name, and even the “insert” entity type in the selection-set filter, can be in either (or even mixed) case.
I want to plot my selected blocks. is that possible?
I am not aware of any option to plot selected objects or blocks. I am pretty sure that the options ar elimited to plotting areas of your drawings.
The only thing i can think of to help achieve your request is to WBLOCK individual blocks out to their own files and then plotting those drawings.
I want to send the search name from the AutoCAD command line……
So is this correct?
(defun c:SelectBlock (b / blkname found objs ss i blk name)
;;; Tharwat 03. March. 2012 ;;;
(if (and (setq blkname b)……………………………………….
But this gives me an error…”no function definition:SelectBlock”
Pingback: مقدمة لتعلم الاتوليسب | OMAR SELIM
Could you please send me the code , i can not find it.
Could you please send me the code