Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

layer name with spaces in a menu macro

6 REPLIES 6
Reply
Message 1 of 7
rrebich
577 Views, 6 Replies

layer name with spaces in a menu macro

Hi,

I am trying to change the color of a layer using a menu macro. The layer name contains a space, which I think is the problem. If I type this string at the command line:

(command "-layer" "c" "7" "ipco border$0$line1" "")

the layer color changes properly, but when I use the same string in a menu macro and run it from a button, the command fails. Any help?

Ross
6 REPLIES 6
Message 2 of 7
EC-CAD
in reply to: rrebich

You can execute Lisp from your menu Macro.. just do:
^c^c(command "-layer" "c" "7" "ipco border$0$line1" "");
... as your Macro

Bob
Message 3 of 7
rrebich
in reply to: rrebich

Hi Bob,

I tried that exact macro and the command failed. It works from the command line, but fails as a macro. Could it be the space in the layer name?

Ross
Message 4 of 7
EC-CAD
in reply to: rrebich

Most likely the $ rather than the space.
Make sure you have quote marks around the Layername.
Another way might be to :
^c^c(setq lay "ipco border$0$line1")(command "-layer" "c" "7" lay "");

Bob
Message 5 of 7
rrebich
in reply to: rrebich

You're probably right about the $, but still no luck with the macro. I'm getting a syntax error. I appreciate the help, though.

Ross
Message 6 of 7
EC-CAD
in reply to: rrebich

Cut/Paste your Macro..as it is now.

Bob
Message 7 of 7
EC-CAD
in reply to: rrebich

Got it. It's the $ character .. chr 36 .. that's doing it.
Try this Macro:
^c^c(setq lay (strcat "ipco border" (chr 36) "0" (chr 36) "line1"))(command "-layer" "c" "7" lay "");

Bob

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost