Print Page | Close Window

autocad 2009 toggle between 2 layers on/off

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DXF formats, Design Review, AutoCAD web, Drive, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=11250
Printed Date: 17.Jul.2026 at 18:59


Topic: autocad 2009 toggle between 2 layers on/off
Posted By: monikt
Subject: autocad 2009 toggle between 2 layers on/off
Date Posted: 08.Jul.2015 at 12:20
Please help if you know a macro or a lisp for freeze/unfreeze 2 specific layer - ex. layer1 frozen and layer2 unfrozen and viceversa, by one click.
Thank you



Replies:
Posted By: John Connor
Date Posted: 08.Jul.2015 at 13:00
There are custom layer freeze/thaw lisps available that could easily be tweaked to be layer specific.  Find one and edit it or write one of your own.


-------------
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>



Posted By: Kent Cooper
Date Posted: 08.Jul.2015 at 16:00
Some ways that could be done:

(if (= (logand 1 (cdr (assoc 70 (tblsearch "layer" "layer1")))) 1); layer1 is frozen
  (command "_.layer" "_thaw" "layer1" "_freeze" "layer2" "" "_.regen"); then
  (command "_.layer" "_thaw" "layer2" "_freeze" "layer1" "" "_.regen"); else
); if

Or:

(if (= (logand 1 (cdr (assoc 70 (tblsearch "layer" "layer1")))) 1); layer1 is frozen
  (setq layerT "layer1" layerF "layer2"); then
  (setq layerT "layer2" layerF "layer1"); else
); if
(command "_.layer" "_thaw" layerT "_freeze" layerF "" "_.regen")

Or:

(setq
  layers '("layer1" "layer2")
  layerT (if (= (logand 1 (cdr (assoc 70 (tblsearch "layer" "layer1")))) 1) "layer1" "layer2")
); setq
(command "_.layer" "_thaw" layerT "_freeze" (car (vl-remove layerT layers)) "" "_.regen")

Use (defun) to put one into a command name, and have that command name invoked by a menu item [or by typing it].



Print Page | Close Window