Hi Folks,
I need a macro to toggle a single layer on and off (or freeze/thaw). At the moment I'm using the freeze layer button, but when I want to thaw it I find I need to go into the Layer command and scroll down the list to thaw it. It's the layer we keep our viewports on. And I need to turn it on and off quite frequently.
Any help would be greatly appreciated
Rhoscadman
Solved! Go to Solution.
Solved by pendean. Go to Solution.
I get the same thing here with Help and the CUI but I did remove the <layername> (both with and without the arrows(?))and replaced this with the Layer I am hoping to toggle
Regards, Charles Shade
CSHADEDESIGN | AUTOCAD LT | LT-KB | DYNAMIC BLOCKS
Please mark Accept as Solution if your question is answered. Kudos gladly accepted. ⇘
My apologies, I forgot in my haste to add the layer name.
^C^C$M=$(if,$(=,$(getenv,layf-t),0),setenv;layf-t;1;_-Layer;Thaw;<VPORTS>;;,setenv;layf-t;0;_-Layer;Freeze;<VPORTS>;;)^Z
Ignore the funny face that's supposed to be ;;)
cheers
blast, it's gone and done it again....................single semi colon ; and closed bracket)
Yeah, I not have been as clear as I thought I was about what to replace. Sorry about that.
setenv;layf-t;0;_-Layer;Freeze;<layername>;;
would be:
setenv;layf-t;0;_-Layer;Freeze;VPORTS;;
So, yeah, Charles, the arrows <> need to be removed. Sorry for the confusion. I cannot replicate this HELP and CUI business at all. Did you guys use SETENV to give the variable a value (1 or 0) before hand?
You can get rid of the smileys by putting the macro in code blocks or totally per this thread if you would like.
(if ("mysolution"=answer) then (click "Accept As Solution"))
@Anonymous wrote:
Did you guys use SETENV to give the variable a value (1 or 0) before hand?
That would be negative on the SETENV Variable.
Though that also concedes that I do not know quite what you are asking.
I thought the Macro set this at the beginning?
Regards, Charles Shade
CSHADEDESIGN | AUTOCAD LT | LT-KB | DYNAMIC BLOCKS
Please mark Accept as Solution if your question is answered. Kudos gladly accepted. ⇘
OK. I'll take it a little slower and explain. Again, I apologize for the confusion.
The first macro:
^C^Csetenv;layf-t;\$M=$(if,$(=,$(getenv,layf-t),0),_-Layer;Thaw;layername;;,_-Layer;Freeze;layername;;)
This macro does set the variable at the beginning. However each and every time you run it you must specify either a 1 or a 0 (freeze or thaw respectively). Essentially, the macro asks you what you want the state (frozen or thawed) of the layer to be. So it is not a 'true' toggle.
The second macro:
^C^C$M=$(if,$(=,$(getenv,layf-t),0),setenv;layf-t;1;_-Layer;Freeze;layername;;,setenv;layf-t;0;_-Layer;Thaw;layername;;)^Z
This macro assumes that the environment variable "layf-t" is present and has a value of 0 or 1 (thaw or freeze respectively); it does not create the variable nor set its value. You do not have to enter any values during the running of this macro. The macro reads the value of "layf-t" and if the value is not equal to 0 (which indicates that the layer are thawed) then it freezes the layer; otherwise it thaws the layer. Prior to running the macro you must create and set the value of "layf-t" to a 0 or 1 (depending on the current state of the layer) using SETENV.
Hopefully that clears up some of the confusion for you, Charles and Rhoscadman.
(if ("mysolution"=answer) then (click "Accept As Solution"))
Ahh... So it is a two Macro solution; not one or the other.
Now I see what I am missing. Thanks for banging my head against the wall.
Regards, Charles Shade
CSHADEDESIGN | AUTOCAD LT | LT-KB | DYNAMIC BLOCKS
Please mark Accept as Solution if your question is answered. Kudos gladly accepted. ⇘
@rhoscadman wrote:
Ignore the funny face that's supposed to be ;;)
cheers
Coding issues can be avoided when posting in the fourms by using the insert code option when posting
Thanks
Discussion_Admin
Can't find what you're looking for? Ask the community or share your knowledge.