Jump to content

get Entity name , ( string )


rodrigo_sjc_sp

Recommended Posts

i have this code

 

 

(setq selpline (ssget '((0 . "INSERT"))))
  (setq m 0)
  (repeat (sslength selpline)
      (setq entbh (ssname selpline m))  
      (setq lentpl (entget entbh))      
      (setq tipo_l (cdr(assoc -1 (entget entbh))))  
)

 

 

Unable to collect the value of the variable entity in tipo_l

when I try to use it more of an error

Error: bad argument type: stringp

 

How can I work with this value as a string?

Link to comment
Share on other sites

i have this code

 

 

      [color=darkorange](setq lentpl (entget entbh))      [/color]
      (setq tipo_l (cdr(assoc -1 [color=royalblue](entget entbh)[/color])))  
)

 

How can I work with this value as a string?

there is no need for the line in orange color since you have it with entget function or visa versa .

 

The entity you want can not be string , so what are you planning to do with it as a string ?

Link to comment
Share on other sites

How can I work with this value as a string?

 

You can convert any data type to a string using the vl-princ-to-string or vl-prin1-to-string functions.

 

However, since an entity name is simply a pointer to the DXF data in the drawing database, it is useless when the pointer is lost through converting it to a string or when not assigned to a variable.

Link to comment
Share on other sites

  • 9 years later...

Hi! Is there a way to convert back the string to data type, making the inverse of vl-princ-to-string? Thanks for the help

Link to comment
Share on other sites

How would you distinguish what the original type is? 12345 could be a string originally or a number for example?

Link to comment
Share on other sites

20 hours ago, Guilherme Rui said:

Hi! Is there a way to convert back the string to data type, making the inverse of vl-princ-to-string? Thanks for the help

 

It depends on the target data type - for example, as noted in my previous post, you cannot convert a string representation of an entity name back to the entity pointer - you would instead need to derive the pointer from the handle or object ID.

  • Like 1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...