Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

storing entity name ?

Status
Not open for further replies.

lispino

Technical User
Feb 8, 2004
8
PT
I'm looking for a way to get the entity name of one object,
store it in any form (ex: attribute of a block) in order to select it in a latter time, after closing and opening the drawing.

 
Try this:

Code:
(defun C:GETENTNAME ()
  (setq ent (entget (car (entsel "Pick entity:"))))
  (setq entName (cdr (assoc 0 ent)))
  (princ "\n")
  (princ entName)
  (princ)
); end defun

This will spit the entity name out on the command line so you can then copy and paste it wherever you need.

HTH
Todd
 
that way i will get a file with the name of the entity, and that is a good alternative,
but my major problem is to select the entity again using the stored information.

my first attempt using storedinformation
"<Entity name: 7ec06d68>"
was to try something like this:

(setq entity (ssget "X" '((-1 . storedinformation ))))

it didn´t work
I will try your lisp
 
You should use an entity's "handle" rather than its "name" if you want to access the entity in a different session. Names can change session to session; handles don't. The handle is the entity's group 5 code. To access entity name, use (handent "handle")
 
I concur with CarlAK, handles don't change. You might try to embedding XDATA to the entity, but since the handle never changes, you can always query the handle if you store that info somewhere.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top