Rhinoscriptsyntax make a layer child of another

Hi,

I have a file with multiple layers and I want all of these to become children of new layer I am creating, is there a way to do this with rhinoscriptsyntax? It seems you can check if they have children or parent layers but not a way to set these.

Many thanks

Vincenzo

Yes, rs.ParentLayer() allows you to set a parent layer for an existing layer.

https://developer.rhino3d.com/api/RhinoScriptSyntax/#layer-ParentLayer

Example:

import rhinoscriptsyntax as rs

layer_a=rs.AddLayer("layer_a")
layer_b=rs.AddLayer("layer_b")
rs.ParentLayer(layer_b,layer_a)

image

1 Like