Jump to content

Empty layers, Hide Turn off or (Show only layers that contain objects)


PSAPmapR

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by BIGAL
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...