Community
AutoCAD LT Forum
Welcome to Autodesk’s AutoCAD LT Forums. Share your knowledge, ask questions, and explore popular AutoCAD LT topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Toggle macro to freeze/thaw 1 layer in particular

27 REPLIES 27
SOLVED
Reply
Message 1 of 28
rhoscadman
15355 Views, 27 Replies

Toggle macro to freeze/thaw 1 layer in particular

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

27 REPLIES 27
Message 2 of 28
Charles_Shade
in reply to: rhoscadman

I do such with several Layers but use two buttons. One for On and one for Off for each Layer

The Toggle has been asked here before but I do not think anyone has solved it... Yet. 

Message 3 of 28
Imui
in reply to: rhoscadman

hello,

i'm using layer isolate and previous layer status. (buttons)

Message 4 of 28
hwalker
in reply to: Imui

Or you could use layer lock with a transparency setting about 75%

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

Message 5 of 28
pendean
in reply to: rhoscadman

Two macros, one for each process you describe as two separate functions right now:
^C^C-layer;Freeze;MYLAYERNAME;;
and
^C^C-layer;Thaw;MYLAYERNAME;;


I personally like the Layer Lock with the lock-fade option offered in AutoCAD for visual, or I suspect your real issue may be you don't know that by setting that layer to NOPLOT you can always keep it on but it never plots (and therefore no reason to constantly freeze and thaw it).
Message 6 of 28
rhoscadman
in reply to: pendean

Actually I DO know about layer NOPLOT and always activate it in case I forget to leave that layer thawed. But the real reason I need this is because with the numerous viewports we have on each layout and the constant need to shuffle the viewports around the layout I find I'm constantly freezing and thawing vports. When you've done 6-7 times an hr it does get a bit tedious having to oper the layer window to thaw a layer hidden amongst 120+ other layers. It would be much more convenient to have an ON/OFF toggle for that, or any other layer.

Call me lazy, but hey if the hat fits......

Message 7 of 28
pendean
in reply to: rhoscadman

Try the two macros I posted: if you want on/off chance the sub-commands from freeze/thaw.
Message 8 of 28
Charles_Shade
in reply to: rhoscadman

^C^C-la;Off;Detail;^C

^C^C-la;On;Detail;^C

Message 9 of 28
pendean
in reply to: Charles_Shade

Charlie, why not finish the -LAYER command instead of cancelling out of it?
Message 10 of 28
Charles_Shade
in reply to: pendean

I'm just turning Off/On Layers that I use for Construction lines and background noise in Modelspace to clear things up from time to time. These couple are no-plots and Frozen in Viewports already if left on.

Message 11 of 28
Imui
in reply to: rhoscadman

..or you could use layer states manager.

but then it's not just  a one click deal

Message 12 of 28
pendean
in reply to: Imui

It could be with a lot of pre-planning (and 100% perfect layers setup).
Message 13 of 28
pendean
in reply to: pendean

If you are still looking for a one macro toggle, edit this one to include your layer name and see if it will work for your needs (untested, I just took a stab at code re-writing):
^C^C$M=$(if,$(=,$(getenv,layfrz-thw),0),setenv;layfrz-thw;1;_-Layer;thaw;MYLAYERNAMEHERE;;,setenv;layfrz-thw;0;_-Layer;freeze;MYLAYERNAMEHERE;;)^Z
Message 14 of 28
rhoscadman
in reply to: Imui

Thanks Dean, it's almost there, but for some reason the layer won't stay ON or OFF. I'll give it another go at my lunch hour to see if I can tweak it.

 

Cheers

 

Rhoscadman

Message 15 of 28
pendean
in reply to: rhoscadman

Probably because this site dropped a happy face in place of the colon : and closed bracket ) , I should have put it on a code page.
Message 16 of 28
rhoscadman
in reply to: pendean

Sorry Dean, but I'm at a loss as to where the bracket should go; I can find 3 open brackets but only 2 closing ones. I'm almost ther inasmuch I can freeze the layer, but cannot then thaw it.

much appreciated

Message 17 of 28
pendean
in reply to: rhoscadman

happy face=closed bracket
Message 18 of 28
rhoscadman
in reply to: pendean

Sorry Dean, tried every which way with your macro, even tried the ON/OFF toggle described here:

 

http://forums.autodesk.com/t5/AutoCAD-LT/Replacing-LISP-with-Macros-for-AutoCAD-LT/td-p/3749673/high...

 

But it just kept taking me back to the CUI Manager for some obscure reason. So, to cut a long story short I just gave up and went the easy option of creating 2 separate buttons one for ON and another for OFF. If you do come across a macro that would work, let me know as I'd be very interested.

 

Thanks for your help

Message 19 of 28
Anonymous
in reply to: rhoscadman

Can you post the macro you are using (that is opening the CUI) and what is happening on the command line? 

 

The toggle I proposed on the other thread (the accepted solution) was for a group of layers.  Insert your layer for <layername>:

^C^Csetenv;layf-t;\$M=$(if,$(=,$(getenv,layf-t),0),_-Layer;Thaw;<layername>;;,_-Layer;Freeze;<layername>;;)

Or if you want to try the "true" toggle I posted there is one step to set it up.  Type this into the command line while your layers are thawed (environment variables are case sensitive).

SETENV layf-t 1

And this is the macro code for the toggle:

^C^C$M=$(if,$(=,$(getenv,layf-t),0),setenv;layf-t;1;_-Layer;Thaw;<layername>;;,setenv;layf-t;0;_-Layer;Freeze;<layername>;;)^Z

 

(if ("mysolution"=answer) then (click "Accept As Solution"))

Message 20 of 28
rhoscadman
in reply to: Anonymous

Hello Brandon,

 

Here is the macro I copied and pastred from your earlier thread to the CUI tool.

 

^C^C$M=$(if,$(=,$(getenv,layf-t),0),setenv;layf-t;1;_-Layer;Thaw;<layername>;;,setenv;layf-t;0;_-Layer;Freeze;<layername>;;)^Z

 

I mistakenly thought it opened the CUI, but no, all it does is repeat the previous command.

 

I have attached a screen shot of the commanlines when I invoke the toggle macro

 

Cheers

 

 

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

Post to forums  

Forma Design Contest


Technology Administrators