Copy Layers Between Drawings

Is it possible to copy layers from one drawing to another please? I was hoping it could be done either via the clipboard (two Rhino sessions running at the same time) or via import, and selecting layers but not geometry.



I don’t believe you can copy just layers to another drawing. But you can either save that as a new file and erase all your old geometry. Then import that new saved file into your other drawing. Or create a template if the Layer names are ones you always use.

Hi Jonnie- I guess I workaround would be to copy an object from each layer you want - just a point will do - to the clipboard, Paste in the target file and hit Delete, since all the pasted stuff will be selected on Paste.


Thanks RA Mull and Pascal,

What I do currently is make sure all the layers are on in the drawing with the layers I want, then import the drawing, which leaves the imported stuff selected, then delete the selected stuff. But it would be better to just be able to import the layers, as there are other things that get imported that I don’t want, like blocks, and other maybe other stiff / settings as well.

One layer at a time would take too long, and I would still have to delete the objects that come with the layer.

Could we have it implemented as some sort of right click option, like duplicate layer is currently - but it would be ‘copy layer to clipboard’, and in the target drawing, you right click and ‘paste layers from clipboard’ or similar? Should I add this as a request to Rhino 6?



Just select one object from each layer you want, Copy all of them to the clipboard at once. In the other file, use Paste then Delete - done. No?


I’d still have to go through and pick the objects. Is it something that could be written with a Python script? I could have a go at that.

It’s something I do all the time in CAD (copying layers via the clipboard), and it would be handy to have it in Rhino as well, that’s all - I’m using Rhino for things that previously I would have done in CAD. Clients are (finally!) starting to ask for stuff in 3D rather than 2D.

Chiming in from the sideline here…
I’m sure that most of us at one time or another need to get layers from another file - and we go through the work-around.

But for the sake of consistency, I think there should be an import for the layer structure from another file, just like there is the import of named views and import of layouts.


Hi Wim-

I agree- I’ve long, and so far resultlessly (though I can find no evidence in the bug tracker) , advocated a more general SelectiveImport tool where you could pick among all manner of things to bring in from another file.



A couple details to iron out…

  • How would you resolve duplicate layer name conflicts?
  • How would you resolve problems between files with parent/child layers and all top level layers?

Exactly the same way as you do today when you copy an object from another file. The new file wins.

I’m not sure how this one is different from the first one?

Easy, discard the new layer with the same name. Or the opposite. Ask at the
start of import what to do with conflicts, with option to chose each one.

Well, . . .
Again, for the sake of consistency, the file that is copied into wins. It’s like that with line types, line weights, etc. The user isn’t asked what to do in these cases. As long as the same logic is used there won’t be surprises.

1 Like

OK, here is a quick and dirty Python that you can play with for now, I’ll see if I can spruce it up a little:

def test():
    file= rs.OpenFileName("Import layers", extension="3dm")
    if not file: return
    x = Rhino.FileIO.File3dm.Read(file)
    L = x.Layers
    layerStates = [(layer,False) for layer in L]
    LL = rs.CheckListBox(layerStates)
    for n in range(len (LL)):
        if LL[n][1]:


Just to be clear, conflicts should be resolved in favor of the current file you have open and are editing.
The imported file loses.

1 Like

Hi Jonnie,

Pascal already sent you an elegant solution. Here is another one with two rvb scripts (SaveLayers and LoadLayers)
SaveLayers saves the layer names, state and color into a text file.
LoadLayers retrieves the same information from a text file. It restores the layer structure and skips the layers if they are already in the document.
A good thing is that you can create a layer structure template in a text file and load it or share it when necessary.

Does this help?

SaveLayers.rvb (954 Bytes)

LoadLayers.rvb (2.4 KB)


That sounds great, many thanks, I will give it a go after the weekend, Jonnie

Yes !
Also, I often miss a way to select layers, and then get the list of the selected layers.

Layers are what I use in Rhino files to organize objects and often to work on them,
and I appreciate a lot the fact that layers now can be organized in a hierarchical way.

Unfortunately working with layers is not yet as easy as working with regular geometric objects.


Ciao Emilio! :smile:

What are you missing in particular? Doesn’t the Rhinoscript command Rhino.GetLayers does exactly that?

Dim arrLayers, strLayer

arrLayers = Rhino.GetLayers("Select Layers")

If IsArray(arrLayers) Then

  For Each strLayer in arrLayers

    Call Rhino.Print(strLayer)


End If

Yes, that makes perfect sense

Ciao Marco ! :smiley:

BTW … I agree but these are Wim’s words, not mine … :smile:

About layers selection … you’re right, I wasn’t clear … I’ll try to explain that a little more.

I think what I miss is a Selected/Unselected state for layers, just like what we have for geometric objects.
Yes, I can select layers in the Layers panel, but I cannot read those layers’ names in any way from a script, nor select or unselect them from a script.
I can do these things for objects, but not for layers.
Or I can input a list of layers from a script (your sample shows that), but I cannot read that list from a different script (without saving the list somewhere).
Also, but I think this is probably my fault, I sort of remember where the layers are in the Layers panel and can find them there (and select them) pretty easily.
Having to select them in the window shown by Rhino.GetLayer() is somehow more difficult for me … :blush:

These problems in handling layers make my poor scripts harder to write and less powerful … :frowning:

Ciao, grazie

OK, I knew there something more…

So you mean when the layers are highlighted in the layers panel? I noticed that too.

Yes, it seems you need to save it - either to an external file or in some document data… which might work but it’s a bit convoluted.

Thanks for explaining!