Export by layer - subsublayers and all objects

I need to select layers, both unlocked and locked, and export all objects on those layers and sublayers, including locked and hidden objects,as a .3dm file with the layer structure retained. I need to create files with portions of the model.

I’ve seen assorted scripts for this. Is there one which does exactly what I need, including locked layers and sublayers, and locked and hidden objects?

Could this be added to list to either be an option in Export, or a new Rhino command?

Hi, @davidcockey. I couldn’t fine any script with this exact behavior.

I’d offer working by subtraction instead:

  1. Save any progress you’ve made on your file, first.
  2. Then, Save As under a new name, so you never edit the original.
  3. In the Layers panel, select the layers you don’t want.
  4. Delete them. Parent layers take their sublayers and objects with them.
  5. Save.

Everything on the layers you’ve kept survives: locked objects, hidden objects, objects on locked layers, hierarchy intact, empty parents included.

@stevefuchs Thanks for the response. Your suggestion is exactly what I’ve been doing, but I don’t like it because of the risk of deleting from the wrong file, etc. I’ve had one incident which I managed to recover from.

So back to my request:

I need to select layers, both unlocked and locked, and export all objects on those layers and sublayers, including locked and hidden objects,as a .3dm file with the layer structure retained. I need to create files with portions of the model.

Could this be added to list to either be an option in Export, or a new Rhino command?

Isn’t this something that can be addressed with a naming convention or how you set up your file system? How many times are you exporting parts of the whole file?

There’s this, but I don’t think it picks up locked and and hidden objects Rhino - Export Layer Objects

Hi David,

These type of specific export tools are perfect for a custom python script you can build with Claude.

For example I made one that exports by layer, with a default list based on what layers are currently on, but allowing me to override that list with checkboxes on a list of layers (I think it makes an ETO form). And it tells me how many objects per layer are exporting and how many objects are ignored. Because in my case only meshes export as STL. And only Nurbs export at step.

You can try to describe what you want as an initial prompt and try it until it works the way you want. It usually takes 10+ takes until you reach a script that does what you want, but it’s pretty powerful.

G

@gustojunk Thanks for the reply. Essential to my request is to export all objects on selected layers and sublayers, including locked and hidden objects. The destination needs to be a .3dm file.

No need for anything more complex. If it can be easily scripted using Claude then it should be simple for McNeel to add it to Rhino. :face_with_raised_eyebrow:

Not deleting files you need also feels pretty simple though

Your request has been filed, @davidcockey.
RH-97325 Export all objects on selected layers

IMG_2725

The fundamental problem idifficulty in doing what I requested is Rhino apparently does not have a method for selecting objects which are hidden or on locked layers. I have my doubts that Claude can create such a method.

RhinoCommon scripting language apparently does have those options:

So scripting can get you there.

I made this first pass using voice chat to Claude on my phone:

export layers v2 claude gf 260730.py (4.5 KB)

Does it look promising?

G

If you’re not used to programming (which, by the looks of it, might be the case), I’d suggest being a little more optimistic about what code can achieve.

You’re essentially saying it’s not possible because no method exists. By that logic, not even the Rhino developers could achieve it. If they can, so can Claude or any other AI.

Also, there is no need for a dedicated method. You can create your own, after all, a method is essentially just a packaged piece of code.

And sometimes things can be done differently than you imagined. For instance, the script could find all objects, temporarily unlock and unhide them, export what it needs, and then lock and hide the ones that originally had those properties again. Pretty simple.

Lastly, it looks like quite a custom tool, so I’m not sure why you’re seem so fixated on having Rhino developers implement it just for you in a piece of software used by hundreds of thousands of people.

@ShynnSup There is no reason to call me “fixated” for making a request and responding to others in four posts in a single thread.

I’m surprised you haven’t just posted a plugin, what with all that free time you have and how simple it is.

byRhino Gadget - Help

Would this be helpful?

Does it include sublayers and the objects on the sublayers, or only objects on the selected layers?

Do sublayers need to be selected to be included?

Are objects which are hidden or on locked sublayers included?

Here are the details regarding your questions:

  • Export Scope: Only objects on the explicitly selected layers are exported. Sublayers and objects on sublayers are not included unless those sublayers are directly selected as well.

  • Hidden / Locked Objects: Hidden objects are automatically excluded from the export.

  • Output Format: A separate file is created for each individual layer.

Additionally, here are two useful commands you might want to try alongside this workflow:

  • ImportFilesinFolder: Automatically imports multiple files from a designated folder at once.

  • MergeLayers: Merges multiple layers into a single layer.

This does not meet my needs: I need to select layers, both unlocked and locked, and export all objects on those layers and sublayers, including locked and hidden objects,as a .3dm file with the layer structure retained.

ExportByLayerFull.rhp (132 KB)

I created a plugin with the help of Claude Opus (and drew the icon myself!).

It seems to cover everything you requested. Please give it a try and let me know your feedback!

  • Command: ExportByLayerFull