How I Select *U blocks or How I select block by name "*U27" from entire drawing

How I Select *U blocks or How I select block by name "*U27" from entire drawing

Anonymous
Not applicable
3,820 Views
6 Replies
Message 1 of 7

How I Select *U blocks or How I select block by name "*U27" from entire drawing

Anonymous
Not applicable

Hi All,

 

Good Day..

 

new to forum here,

Looking for help in LISP coding to select single Block Automatically on screen by Block name Through lisp code from entire drawing .

I trying many codes as follows.

(setq ss(ssget "x" (list(cons 0 "insert") (cons2 "*U27"))))

( setq anonymus-ss (ssget "x" (list (cons 0 "INSERT") (cons 2 "*U27"))))

(setq ss (ssget "_x" '((0 . "INSERT") (2 . "YourBlockNameHere")

 

but it not work properly i cant select single Block By Block Name 

 

 

 

Your help in this highly appreciated.

Regards

TechTeam Zener

0 Likes
Accepted solutions (3)
3,821 Views
6 Replies
Replies (6)
Message 2 of 7

cadffm
Consultant
Consultant
Accepted solution

U are knowing the this blockname can be change with the next time open the drawing?

 

(sssetfirst nil (ssget "_X" '((0 . "INSERT")(2 . "`*U*"))))

 

Please read about WCMATCH / Wildcards [F1]. You have to quote the * with ` for char compare literally.

Sebastian

0 Likes
Message 3 of 7

cadffm
Consultant
Consultant
Accepted solution

And if you are not the creator of Blockreference (command insert) or if we talk about dynamic blocks,

i am sure not all blockreferences you want are refered the same block.

Select all symbols by hand and check there Blockname in properties palette CTRL+1,

is ther one name (*U27) or *varies*?

Sebastian

0 Likes
Message 4 of 7

john.uhden
Mentor
Mentor
Accepted solution

Place a reverse quote before the aterisk so that the filtering treats the asterisk as a character, not a wildcard.

 

'(`*U27)

John F. Uhden

0 Likes
Message 5 of 7

Anonymous
Not applicable

Hi,

Good Day!!

Your help in this highly appreciated. but i using Following code

(sssetfirst nil (ssget "_X" '((0 . "INSERT")(2 . "`*U27*"))))

but code will select other 2 -3 Block at the same time.

but selected block name is different (U270, U275 , U274) as per my attach  jpg. file.

So how i select particular single Block ? as per above lisp code. 

 

can we do one thing,  select single Block Automatically on screen by Block Name ("U27") and Block Layer Name ("Left View-Support") Through Lisp code from entire Drawing.

 

Your help in this highly appreciated.

Regards

TechTeam Zener

 

0 Likes
Message 6 of 7

cadffm
Consultant
Consultant

You didn't commented my comments above.

 

I wrote about where you can read about WILDCARDs in AutoCAD: F1 - wcmatch 

About DXF-codes too: Click - Groupcode 8 is for Layer

(sssetfirst nil (ssget "_X" '((0 . "INSERT")(2 . "`*U27")(8 . "Left View-Support"))))

 

get

INSERTs

only of BLOCK "*U27"

only on Layer "Left View-Support"

 

 

Sebastian

Message 7 of 7

Anonymous
Not applicable

Thank you for your valuable comments. 

 

It is working fine. 

Thank you once again. 

 

Your help in this highly appreciated.

Regards

TechTeam Zener

0 Likes