Pre-Naming a Layer before runing the Layer Merge Lisp

Pre-Naming a Layer before runing the Layer Merge Lisp

gustavobernardi
Advocate Advocate
1,139 Views
5 Replies
Message 1 of 6

Pre-Naming a Layer before runing the Layer Merge Lisp

gustavobernardi
Advocate
Advocate

Hi. I'm developing a lisp to rename layers (known names). The problem is that when I try to put the Layer names on a shorter variable, it doesn't work.

This one works fine:

(if
		(and(tblsearch "layer" "Arquitetônico - Paredes")(tblsearch "layer" "ARQ - Paredes Alvenaria"))
		(progn
			(command "Laymrg") (foreach e '("Arquitetônico - Paredes") (if (tblsearch "LAYER" e)(command "_Name" e)))(command "" "_N" "ARQ - Paredes Alvenaria" "_Y")
			(command "_.-PURGE" "_La" "Arquitetônico - Paredes" "_N")
		)
	)

And this one doesn't work:

 

(setq oldname "Arquitetônico - Paredes")
(setq newname "ARQ - Paredes Alvenaria")
(if (and(tblsearch "layer" oldname)(tblsearch "layer" newname)) (progn (command "Laymrg") (foreach e '(oldname) (if (tblsearch "LAYER" e)(command "_Name" e)))(command "" "_N" newname "_Y") (command "_.-PURGE" "_La" oldname "_N") ) )

Isn't impossible to do the first way, but for several layers it will be interesting to just give the names and run the routine for each one.

TIA

 

 

 

0 Likes
Accepted solutions (1)
1,140 Views
5 Replies
Replies (5)
Message 2 of 6

ВeekeeCZ
Consultant
Consultant
Accepted solution

You gotta evaluate a variable, not just quote.

'(oldname) -> (list oldname) 

Message 3 of 6

gustavobernardi
Advocate
Advocate

Why this code sometime renames OK and sometimes screws up with the latin characters.

 

(setq oldname "Wipeout")(setq newname "Máscara")

(if(and(tblsearch "layer" oldname)(not(tblsearch "layer" newname)))
			(COMMAND "._-RENAME" "LA" OLDNAME NEWNAME)
	)

Sometimes the new name is "Máscara"

Sometimes the new name is "Máscara"

 

0 Likes
Message 4 of 6

ВeekeeCZ
Consultant
Consultant

I would suggest you ask about this language related issue to the Portuguese speaking forum.

In general, I would recommend avoiding use such letters, you will prevent a lot of troubles.

Message 5 of 6

gustavobernardi
Advocate
Advocate

I solved the problem loading the Layer names from a TXT in inspite of stocking them in the Autolip code.

 

0 Likes
Message 6 of 6

gustavobernardi
Advocate
Advocate

I have solved the question.

It is possible loading from a text file or use directly on the lisp file, whatever.

But the source (lisp or txt file) needs to be saved in ANSI Codification.

0 Likes