The best way to identify layers without objects to delete?


#1

When I import DXFs from Cinema there are many layers with no objects. Therefore I had to select every layer and ask “select objects in layer”. If there are non I can delete them. Is there a faster way to do this?
I think this is not only a Mac problem.


#2

• in the layers panel, select all the layers except the active layer… (click the first one then hold Shift and click the last… all those in between will select)

• right-click -> Delete

• you’ll get a prompt "Object on layer… are you sure you want to delete?"
click ‘cancel’

the layers with objects on them will stay-- the empty layers will delete.

(obviously, try this on a duplicate file first)


#3

Hi Jeff. Thanks for the fast reply. Don´t work with the current layer (and detects only the last selected layer obviously only one layer. Mac thing?)

Edit: Sorry. Works. Result was mutch more than expected


#4

Actually, it is… Windows Rhino has a filter function in the layer dialog which can filter either empty layers or layers with objects - so you just show only empty layers and select all/delete. Not implemented in Mac (yet).

Here is a script which will delete all empty layers in the document (except current layer if it is empty):

import rhinoscriptsyntax as rs
layers=rs.LayerNames()
for layer in layers:
    if rs.IsLayerEmpty(layer): rs.DeleteLayer(layer)

DeleteEmptyLayers.py (130 Bytes)

–Mitch


#5

Thanks Mitch. The method of Jeff works ecept for the current layer.


#6

Usually, when I import dxf or dwg from other programs, I run a “Purge” so you’ll delete in a single hit all empty layers, empty block definitions, dim styles unused… etc. etc.
The “current layer” won’t be removed 'cause Rhino assume you are using it.
Ciao!