Export Layer names to ASCII list

I’m looking for a way to export the layer names as a list in an ASCII file (text file or csv), e.g. as “layernames.txt”. How can I do this?

What have you tried so far?

Thank you Ivelin. So far I have selected all objects and done an export as csv. In the “CSV Export Options” I unchecked everything except “Layer name”. The csv has then a numbering, commata (,) and quotes ("), which I need to delete manually. Sometimes there are duplicates of the layer names, which I need to check, find out and delete. Not very efficient. What do you suggest?

So you haven’t tried any scripting?
This is what I meant.

Yes, .csv export from Rhino is intended primarily for exporting points. You can try the following script…

ExportLayerNamesTXT.py (369 Bytes)

Thank you! Works fine.