Lisp Routine to Toggle Freeze/Thaw of Specific Layers

Lisp Routine to Toggle Freeze/Thaw of Specific Layers

Anonymous
Not applicable
2,208 Views
2 Replies
Message 1 of 3

Lisp Routine to Toggle Freeze/Thaw of Specific Layers

Anonymous
Not applicable

I am a novice at writing lisp routines and I having having trouble trying to figure out how to come up with a routine to toggle certain layers to freeze/thaw.

 

In our drawings we have both 2D and 3D layers. I want to be able to toggle frozen/thawed 3D layers, however there are two 3D layers that I need to always remain thawed (3D_ITEM & 3D_PRODUCT).

 

Currently, I have two commands that will do this. F3D and T3D

 

(defun c:f3d()
    (command "-layer" "f" "3D_*" "")
while
    (command "-layer" "t" "3D_ITEM,3D_PRODUCT" ""))

 

(defun c:t3d()
    (command "-layer" "t" "3D_*" ""))

 

I'm just unsure of how to be able to use those in a single toggle routine so I can store it in a button on a toolbar.

 

Any help would be greatly appreciated.

0 Likes
2,209 Views
2 Replies
Replies (2)
Message 2 of 3

ВeekeeCZ
Consultant
Consultant

Look HERE or the same issue HERE on this forum, try to make it on your own.

 

BTW What if is one layer thawed, the second not?

0 Likes
Message 3 of 3

Kent1Cooper
Consultant
Consultant

You can combine more than one Layer operation in one Layer command:

 

(defun c:f3d ()
    (command "-layer" "f" "3D_*" "t" "3D_ITEM,3D_PRODUCT" "")

)

 

If some 3D_... Layer other than those to be kept thawed might ever be current when you call for this command, that one will not be frozen.  So if that's possible, you could set one of those that will be re-thawed current first:

 

(defun c:f3d ()
    (command "-layer" "s" "3D_ITEM" "f" "3D_*" "t" "3D_ITEM,3D_PRODUCT" "")

)

Kent Cooper, AIA