Collect layers in new layer?

I want to select a bunch of layers imported from AutoCAD in the layers panel and collect in a new layer called “_acad”… so all the new layers would be “_acad::layer1” "acad::“layer2” and so on… how can I do this in rhinoscript or rhinocommon?

Hi @Francis1,

How about this?

import rhinoscriptsyntax as rs

def test_move_layers(parent):
    layers = rs.GetLayers()
    if not layers:
        return
    
    if not rs.IsLayer(parent):
        rs.AddLayer(parent)
    
    for lyr in layers:
        rs.ParentLayer(lyr, parent)
    
if __name__ == "__main__":
    test_move_layers("_acad")

– Dale

1 Like