rodrigo_sjc_sp Posted January 7, 2014 Posted January 7, 2014 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? Quote
Tharwat Posted January 7, 2014 Posted January 7, 2014 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 ? Quote
Lee Mac Posted January 7, 2014 Posted January 7, 2014 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. Quote
Guilherme Rui Posted June 20, 2023 Posted June 20, 2023 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 Quote
Steven P Posted June 20, 2023 Posted June 20, 2023 How would you distinguish what the original type is? 12345 could be a string originally or a number for example? Quote
Lee Mac Posted June 21, 2023 Posted June 21, 2023 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. 1 Quote
Recommended Posts
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.