PSAPmapR Posted November 14, 2013 Share Posted November 14, 2013 Hello Everyone, I've "Binged" and "Googled" this for days, and have searched this forum internally with no luck. I work primarily in GIS of a totally different platform than Auto Desk's offerings so my terminology may be tainted. (I'm running AutoCad 2005 btw) How can I tell AC to turn off any/all layers that are empty (i.e. have no objects, no block associations, no rasters etc). I don't want to purge these empty layers as I will eventually need them. Scenario: All layers are turned on and visible, after I have purged empty layers that won't be needed, there are still empty layers left I will need to use later, I wish to turn off only these layers. (There may be 20 or so layers so I was hoping for a programmatic way of doing this.) Thanks, Dave Quote Link to comment Share on other sites More sharing options...
SAFeSTeR Posted November 14, 2013 Share Posted November 14, 2013 What difference does it make if empty layers are on or off? Just open the layer control and switch them off manually, 20 layers = 20 clicks, not very time consuming. My AutoCAD version has an 'All Used Layers' filter which can be inverted, then you can click / shift the list and switch off in one go. Not sure if 2005 has this though. Quote Link to comment Share on other sites More sharing options...
PSAPmapR Posted November 16, 2013 Author Share Posted November 16, 2013 What difference does it make if empty layers are on or off? Just open the layer control and switch them off manually, 20 layers = 20 clicks, not very time consuming.My AutoCAD version has an 'All Used Layers' filter which can be inverted, then you can click / shift the list and switch off in one go. Not sure if 2005 has this though. Well, after taking a look at my post after putting that project aside for a while, I can see how the concept of my post was inverted Perhaps I should have put my query this way... I often receive drawings from engineers, drawings that often, an architect has muddled with, the drawing may have forty to fifty layers in it. Many layers are or may be empty and viewable, many layers may contain drawings but be turned off. I don't want to purge the drawing just to know what layers truly contain drawn objects which I may need. So the objective I'm after here would be... If a layer contains drawn objects, turn it's display status ON, if the layer is empty, turn it off, hopefully to do this programatically (lisp, menu option I haven't seen, command I haven't learned). Often, the drawing I receive has survey point data, triangulation lines, contour lines and lots of other topology turned on which I'm not interested in. On the other hand, vacated R.O.W.s, edge of pavement, buildings to demolish various other themes which I am interested in are turned off. Thus, a difference does it make to me if empty layers are off, and populated layers are on. -Dave Quote Link to comment Share on other sites More sharing options...
Murph_map Posted November 16, 2013 Share Posted November 16, 2013 Have you looked at the Laywalk command? Might be of use to you. In the layer property manager dialog you can create a property filter to filter the layers by on/off or freeze/thaw status. Quote Link to comment Share on other sites More sharing options...
Organic Posted November 16, 2013 Share Posted November 16, 2013 Well, after taking a look at my post after putting that project aside for a while, I can see how the concept of my post was inverted Perhaps I should have put my query this way... I often receive drawings from engineers, drawings that often, an architect has muddled with, the drawing may have forty to fifty layers in it. Many layers are or may be empty and viewable, many layers may contain drawings but be turned off. I don't want to purge the drawing just to know what layers truly contain drawn objects which I may need. So the objective I'm after here would be... If a layer contains drawn objects, turn it's display status ON, if the layer is empty, turn it off, hopefully to do this programatically (lisp, menu option I haven't seen, command I haven't learned). Often, the drawing I receive has survey point data, triangulation lines, contour lines and lots of other topology turned on which I'm not interested in. On the other hand, vacated R.O.W.s, edge of pavement, buildings to demolish various other themes which I am interested in are turned off. Thus, a difference does it make to me if empty layers are off, and populated layers are on. -Dave Personally I turn on every single layer (200+ commonly), then manually freeze off those I don't need. This way it ensures you don't miss something. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 18, 2013 Share Posted November 18, 2013 (edited) You can create a layer list then loop trhough and select all objects on that layer a False answer would then see the layer say off and frozen it may take a bit of time though searching the drawing for all objects. Some test code replace "T" line with layer frozen etc up to you (vlax-for l (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) (setq layname (vla-get-name l)) (princ layname) (setq sstest (ssget "X" (list (cons 8 layname)))) (if (= sstest nil) (princ "T") (princ "F") ) ; end if (setq sstest nil) ) Edited November 18, 2013 by BIGAL Quote Link to comment Share on other sites More sharing options...
RobDraw Posted November 18, 2013 Share Posted November 18, 2013 What is the purpose of having the layers that do not have anything on them turned off? I don't see a useful reason for it unless you plan on using them in a filter or something. Here is a quick way of getting what you want: (Maybe someone can code it.) While in the Layer Manager, select the "All" filter from the Filters list. Right click in the layer list area and "Select All". Click on a light bulb to turn off all the layers. (You will have to click twice if you pick a light bulb that is off.) Now, select the "All Used Layers" filter. Right click in the layer list area and "Select All". Click on a light bulb to turn on all the layers containing objects. HTH Quote Link to comment Share on other sites More sharing options...
PSAPmapR Posted November 18, 2013 Author Share Posted November 18, 2013 While in the Layer Manager, select the "All" filter from the Filters list.Right click in the layer list area and "Select All". Click on a light bulb to turn off all the layers. (You will have to click twice if you pick a light bulb that is off.) Now, select the "All Used Layers" filter. Right click in the layer list area and "Select All". Click on a light bulb to turn on all the layers containing objects. HTH Well thanks kindly Rob, that looks like what I wanted to achieve. I've never been able to take advantage of powers of the Layers Prop Mngr aside from of course creating/editing layers. Again, AC is not my normal everyday workshop so usually at nights or on weekends I try to swim a little deeper to learn more. Thanks for the fishin' lesson! Quote Link to comment Share on other sites More sharing options...
RobDraw Posted November 18, 2013 Share Posted November 18, 2013 You're quite welcome. Quote Link to comment Share on other sites More sharing options...
SAFeSTeR Posted November 18, 2013 Share Posted November 18, 2013 I already mentioned about using the 'All used Layers' filter, guess that got overlooked... Quote Link to comment Share on other sites More sharing options...
RobDraw Posted November 18, 2013 Share Posted November 18, 2013 It wasn't overlooked. The OP quoted you. I think he just didn't understand. Quote Link to comment Share on other sites More sharing options...
rkent Posted November 18, 2013 Share Posted November 18, 2013 For those reading through this and can't make it work for them, make sure SHOWLAYERUSAGE is set to 1. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.