gustavobernardi Posted December 7, 2018 Share Posted December 7, 2018 Hi, Why sometimes this operation returns wrong? (defun c:cvt() (setq oldname "ESP - Esquadrias CIR")(setq newname "ANT - Esquadria Círculo")(runtorenamelayer) ) (defun runtorenamelayer() (if (and(tblsearch "layer" oldname)(not(tblsearch "layer" newname))) (COMMAND "._-RENAME" "LA" OLDNAME NEWNAME);;(command "._-layer" "R" oldname newname "") ) (if (and(tblsearch "layer" oldname)(tblsearch "layer" newname)) (progn (command "Laymrg") (foreach e (list oldname) (if (tblsearch "LAYER" e)(command "_Name" e)))(command "" "_N" newname "_Y") ;;(command "_.-PURGE" "_La" oldname "_N") ) ) (princ) ) Being specific, if I load the code with the appload or even in the ACAD.LSP the problem occurs. And the result is a strange name: ANT - Esquadria CÃrculo If I just copy and paste the code into the command bar it works fine and te name is ok: ANT - Esquadria Círculo Ok, I am thinking about avoiding special characters in the new Layer names, but in some cases the old layers have them already, and in this situation the operation doesn't rename that old layers, the application just skip them because the names doesn't match. TIA Quote Link to comment Share on other sites More sharing options...
Grrr Posted December 8, 2018 Share Posted December 8, 2018 Heres a suggestion: convert the strings into lists of ASCII characters, process them and then reconvert them back into strings. Look into the vl-string->list and vl-list->string functions. Quote Link to comment Share on other sites More sharing options...
gustavobernardi Posted December 9, 2018 Author Share Posted December 9, 2018 Thanks for the answer, but It didn't work as well (unfortunately ). But I think I found a way, reading from a txt file it worked fine. I'll do some experiments to see if the problem remains or not. Quote Link to comment Share on other sites More sharing options...
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.