Jump to content

macro code help plz


mikekmx

Recommended Posts

Hi,

I'm looking to add a custom toolbar button that will thaw Layer 1, make Layer 1 current and ensure drawing colour is set to ByLayer

 

 

atm i have

 

 ^C^C_-layer T "Layer 1";;^C^C_-layer _S "Layer 1";;

 

This works OK as far as it goes but i cannot code setting the colour to ByLayer. I can't remember exactly what i have tried but have spent a good deal of time trying various combinations.

EG

-color _"bylayer"

 

(I have no idea what i am doing, but am usually successfull in modifying various code for my own purposes, but it's time to ask for help on this one).

 

Thanks.

Link to comment
Share on other sites

^C^C_-layer T "Layer 1";;^C^C_-layer _S "Layer 1";;^C^C;;cecolor;bylayer;;^C^C

 

BigAl is correct about not repeatedly calling the layer command and you only needing ^C^C at the beginning of the macro, some people are now using ^C^C^C at the beginning of their macros as apparently there are a couple of commands that need three escapes to quit them cleanly. If you are running an English language version of AutoCAD you don't need the underscores either, they are only required on non English language versions before using an English command, they just allow you use English on any AutoCAD version. You have a mixture of spaces and semicolons and they both represent a return key press, it would be cleaner to be consistent and just use on of them, I would recommend using the semicolon as you can more easily see where your returns are and when you have several returns directly after each other its easier to count semicolons than spaces.

 

A cleaned up version of your macro would look like this:

^C^C^C-layer;T;"Layer 1";_S;"Layer 1";;cecolor;bylayer;

 

I also deleted a couple of returns that were not necessary.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...