Selecting an object from it's entity name

Selecting an object from it's entity name

Anonymous
Not applicable
5,048 Views
4 Replies
Message 1 of 5

Selecting an object from it's entity name

Anonymous
Not applicable

Ok. Seems what I'm doing isn't very common.

 

Short question: Why does this command give an error? How do I make it work?

(ssget "_X" (list (cons -1 "29b079e26e0" ) ) )

 

This one doesn't work either:

(ssget "_X" (list (cons -1 "<Entity name: 29b079e26e0>" ) ) )

 

Long question:

I wrote a script to tabulate entities in a couple of hundreds of dwgs along with their attributes. Then I did some post-processing on the excel table to identify objects with errors in their attributes. Now I need to go fix them.

 

Basically, I've got a huge table with two columns. How can I get AutoCad to select an object with it's entity name?

 

DWG                | Entity Name

DWG001.dwg | 29b079e26e0

DWG001.dwg | 29b079db290

DWG002.dwg | 29b149a3e10

DWG002.dwg | 29b149a3dd0

DWG003.dwg | 29b14aeaa30

 

 

0 Likes
Accepted solutions (2)
5,049 Views
4 Replies
Replies (4)
Message 2 of 5

cadffm
Consultant
Consultant

Because your cons creates a dottedpair of 1 and a string, but an entity list want a ename (datatype!).

You can not convert a strin to an ename, sorry.

 

And enames in excel are not senseful.

You have to use the HANDLE per file as "Objectid".

Handles are stored in dwgs and unique (per file).

Enames are not stored in dwg and next time tge object generate another ename.

 

 

Sebastian

0 Likes
Message 3 of 5

Kent1Cooper
Consultant
Consultant
Accepted solution

Unfortunately, though entity names look like  text on-screen, they are not text strings.  You can't copy the text "look" and then bring it back in as text, and get the entity.

 

Use their handles instead [in the (assoc 5) entry in entity data], which are  text strings representing hexadecimal numbers, and the (handent) AutoLisp function to get access to the entities from them.

 

The other benefit of using handles instead of entity names is that they are permanent.  The entity name of an entity can sometimes be different after you close the drawing and open it again.

Kent Cooper, AIA
0 Likes
Message 4 of 5

Anonymous
Not applicable

Sorry for the dumb question. Thought Entity names were consistent across sessions. If I understand correctly, then the "handle name", code 5, would be the data I want to save, right?

 

Then this should work... Am I right?

(ssget "_X" (list (cons 5 "ADF3E" ) ) )

 

0 Likes
Message 5 of 5

Anonymous
Not applicable
Accepted solution

Actually no. If anyone else is interested, the correct command is:

(handent "ADF3E")

 

Thanks for replying guys.

0 Likes