Command/Python for create new empty layer?

Hello, I am using Atom with Python to script. I have a python script I wrote to export OBJ files. This is still working fantastic as per my previous forum questions and the helpful answers from the community. thank you!

However, now I would like to not only export the OBJ files, but also redistribute objects to layers via Python. Each discrete object is to be copied to a unique layer and the layer is given a unique name - perhaps simply a epoch timestamp or something. I looked at the command list but could not find a layer creation command. Is there one? Is there a more direct way to redistribute discrete/ joined objects to layers?

For example I have a model produced by an architect which has multiple discrete building masses on a single layer. I would like to check for multiple child objects and redistribute the massings to unique layers. Here You can see each building is a distinct group but they’re all on the Building_Mass layer and I need them each to have their own layer for further operations in Python with a cloud database:

Hi Radio412,

I’m not sure about available command in RFM but in python you can add a layer:
http://4.rhino3d.com/5/ironpython/functions/addlayer.htm

and ways to set an objects layer
http://4.rhino3d.com/5/ironpython/functions/objectlayer.htm

Note that layer names are a bit tricke with nested layers as a nest level is indicated by a '::'
to have an insight of the current layers use:
http://4.rhino3d.com/5/ironpython/functions/layernames.htm

HTH
-Willem

1 Like

Perfect, thank you Willem!

1 Like

Thanks, you have solved me many problems that I had

1 Like