Create custom buttons to freeze/ thaw a specific layer

Create custom buttons to freeze/ thaw a specific layer

dan.luxford
Contributor Contributor
1,256 Views
7 Replies
Message 1 of 8

Create custom buttons to freeze/ thaw a specific layer

dan.luxford
Contributor
Contributor

Hi All, I am trying to create two buttons to freeze and thaw a specific layer.

 

To elaborate, I have two layers - 2D Arch Xref and 3D Arch Xref (these are the layers that the xreferences are placed in. With nearly all the drawings I work on I have multiple xrefs with multiple layers, which means I have somewhere between 100 and 500 layers in a drawing/ model.

 

Rather than scroll through all these layers to get to the ones I want (the above layers) I would like to create buttons to quickly freeze/ thaw the layers.

 

If someone out the could provide me with the correct button syntax or point me to a tutorial it would be most appreciated.

 

Thanks in advance

 

Dan

0 Likes
Accepted solutions (1)
1,257 Views
7 Replies
Replies (7)
Message 2 of 8

cadffm
Consultant
Consultant
Accepted solution
The command is -LAYER for using LAYER in commandlineversion.
So you can see the snytax of that command.
Command: -LAYER follow the command..


In Macro use ; as Enter

'-LAYER;freeze;*|MyXREFlayer;;
freeze all MyXREFlayer in all XREFs

'-LAYER;freeze;*ARC*|MyXREFlayer
freeze MyXREFlayer in all XREFs with refname pattern *ARC*

For Wildcards in Acad look at F1 and Lispfunction WCMATCH

Sebastian

0 Likes
Message 3 of 8

ВeekeeCZ
Consultant
Consultant

... or lisp maybe...

 

(ToggleFreeze-Thaw "2D Arch Xref")
  
(defun ToggleFreeze-Thaw (layer / )
  (if (and (or (tblsearch "LAYER" layer)
               (prompt (strcat "\nLayer '" layer "' not found it the drawing. ")))
           (setq laydef (entget (tblobjname "LAYER" layer))))
    (if (= 1 (logand (cdr (assoc 70 (entget (tblobjname "LAYER" layer)))) 1))
      (command "_.LAYER" "_ON" layer "_Thaw" layer "")
      (if (= layer (getvar 'CLAYER))
        (command "_.LAYER" "_S" "0" "_Freeze" layer "")
        (command "_.LAYER" "_Freeze" layer ""))))
  (princ)
)
0 Likes
Message 4 of 8

dan.luxford
Contributor
Contributor

Works perfectly! Thank you for your reply.

0 Likes
Message 5 of 8

dan.luxford
Contributor
Contributor

Thank you for the reply, but the button way works for me.

0 Likes
Message 6 of 8

Juergen_Becker
Advocate
Advocate

Hi,

 

please insert into the CUI following command:

 

^C^C_Layer;_make;"2D Arch Xref";;

 

For the 3D layer it's similar.

 

Reagards Jürgen

I hope my tip helps. If so then give me kudos and mark the tip as a solution.
Thanks.

Jürgen A. Becker
Building Services

Development and Support
Autodesk Forge Spezialist


CAD-Becker.de
https://www.CAD-Becker.de

0 Likes
Message 7 of 8

ВeekeeCZ
Consultant
Consultant

@dan.luxford wrote:

Thank you for the reply, but the button way works for me.


Sure, you're welcome, whatever fits you better! 

 

Just for you to know, that was meant to be a (single) button as well - not two buttons, just one.... which is hard to achieve with macros only.

0 Likes
Message 8 of 8

dan.luxford
Contributor
Contributor

BeeKeeCZ, to be honest I have absolutely no idea about LISP routines, how to make them, or initiate them in Autocad. Maybe one day I'll get on to them.

0 Likes