Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Active Member
rrebich
Posts: 8
Registered: ‎10-02-2006
Message 1 of 7 (132 Views)

layer name with spaces in a menu macro

132 Views, 6 Replies
06-04-2008 11:53 AM
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
Distinguished Contributor
EC-CAD
Posts: 5,929
Registered: ‎12-12-2003
Message 2 of 7 (132 Views)

Re: layer name with spaces in a menu macro

06-04-2008 11:57 AM 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
Active Member
rrebich
Posts: 8
Registered: ‎10-02-2006
Message 3 of 7 (132 Views)

Re: layer name with spaces in a menu macro

06-04-2008 12:01 PM 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
Distinguished Contributor
EC-CAD
Posts: 5,929
Registered: ‎12-12-2003
Message 4 of 7 (132 Views)

Re: layer name with spaces in a menu macro

06-04-2008 12:15 PM 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
Active Member
rrebich
Posts: 8
Registered: ‎10-02-2006
Message 5 of 7 (132 Views)

Re: layer name with spaces in a menu macro

06-04-2008 12:49 PM 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
Distinguished Contributor
EC-CAD
Posts: 5,929
Registered: ‎12-12-2003
Message 6 of 7 (132 Views)

Re: layer name with spaces in a menu macro

06-04-2008 12:52 PM in reply to: rrebich
Cut/Paste your Macro..as it is now.

Bob
Distinguished Contributor
EC-CAD
Posts: 5,929
Registered: ‎12-12-2003
Message 7 of 7 (132 Views)

Re: layer name with spaces in a menu macro

06-04-2008 01:13 PM 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
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.