"Named Views" for Organizing AutoCAD Layers

A tip for managing what does and does not display when your AutoCAD drawings involve multiple layouts. September 27, 2009

Question
Does anyone know of a way to assign a layer's on/off switch to associate with a particular layout? My drawings usually have 15-20 layouts, and they're cluttered with cabinets, toekicks, plumbing, electrical, countertops, lighting, etc. Here's what I've been doing when I need to print out a set of drawings: click 1st layout, load the appropriate layer state, plot. Click 2nd layout, load appropriate layer state, plot, etc. I was hoping the sheet set manager would have some control over layers, but it doesn't seem so. I have a feeling there's a way to automate this, but I'll be darned if I can find it. Any hints?

Forum Responses
(CAD Forum)
From contributor A:
I believe that there is a "viewport freeze" feature in the layer control box which does this type of thing. The icon looks like a sun with a rectangle. In ACAD 2008 it is the last column to the right in the dialog box. I think it's in 2004 also. The trick is that it is only available while in the layout, not in model space.



From contributor B:
If you go inside of the viewport in each layout, you can change the settings of each layer per each viewport. A simple lisp could help set the layers for each viewport and then plot them for you.


From contributor C:
Named Views! If you use Named Views to get around your CAD, those same views can be used to set your viewports. Open your viewport, select the named view, scale and close. That's it. You must, of course, manage your views.


From contributor D:
To contributor C: Can you elaborate a bit? I'd like to use this named view approach, I believe. Can I set these up in my Template file? I've been looking for a tutorial on this but haven't quite found one yet. I just figured out how to use a camera for the first time!


From contributor C:
Command line: view

That will open the Named View manager. You can also access it from the ribbon on the viewport panel, the first button to the right of the drop down.

To make a Named View, set the layers on or off according to how you want them to show. I prefer on/off to freezing, it saves trouble later. Once your layers are correct, zoom to the view you wish to see. Enter the View command, use the New button on the right. Give the view a name. You can define the boundry, or use the one you have already zoomed to. Under Settings, leave the save layer snapshot with view. The UCS should be current, or if you want to change it, go ahead, but usually it's correct already. Click okay. Click Apply, and Ok again, though Ok usually works fine. You have created a Named View.

Why do this? If you have multible views, you can jump back to them through that drop down command window on the viewport panel. This is very useful when you are jumping back and forth between places and layers. Also, when you make a Viewport in paper space, click into model space and jump to the named view. Scale your viewport and close the window. Your layers and view should remain the same.

Now for the hiccup. Depending on what you are working with (computer, OS, video card, etc.) you may find that your image becomes disconnected with what AutoCAD thinks is the image's location. The easy fix is the Regen command. You may have to jump to another view and jump back to the one you just made, Regen again. That usually solves the problem, and you usually only have it when you create the view. That's 2009 for you.

Named Views are awesome if you create large drawings, multible layers, and lots of viewports.



From contributor E:
As stated earlier you can switch on and off layers from the viewport. But it has a drawback It's beneficial if you are using layout or paper space only. If you are using only model space, use "Layer State Manager" for each drawings . The layer state manager is located at layer box using shortcut key "la". You can create and save layer states as you want. For more information look in AutoCAD help.


From contributor F:
A simple way is from paper space. Activate the view port, open layers, drag the right side of the dialog box to the right, exposing other comands, turn off the layers for printing for that page. Do not make named viewports or turn on and off layers for different plotting. I use it all the time because I dimension in model space with different scale factors and turn off the dimensions in paper space and still have my original drawing in model space.


From contributor G:
Is there a website where we could download some free lisp routines for this?


From contributor C:
This was worked out several years back on this site, hope it works for you.

;commands
;freeze and unfreeze
(defun c:freeze (/ el l lt)
(vl-load-com)
(setvar "CMDECHO" 0)
(setvar "tilemode" 0)
(setq lt (vla-get-layers (vla-get-activedocument (vlax-get-Acad-Object)))
l (tblnext "layer" T))
(while l (setq el (vla-item lt (cdr (assoc 2 l))))
(if (= (vla-get-layeron el) :vlax-false)
(vl-cmdf "_VPLAYER" "f" (vla-get-name el) "" ""))
(setq l (tblnext "layer")))


(princ))
(defun c:unfreeze (/ el l lt)
(vl-load-com)
(setvar "CMDECHO" 0)
(setvar "tilemode" 0)
(vl-cmdf "_pspace")
(setq lt (vla-get-layers (vla-get-activedocument (vlax-get-Acad-Object)))
l (tblnext "layer" T))
(while l (setq el (vla-item lt (cdr (assoc 2 l))))
(if (= (vla-get-layeron el) :vlax-false)
(vl-cmdf "_VPLAYER" "t" (vla-get-name el) "" ""))
(setq l (tblnext "layer")))
(princ))