Merge Layers

Is there a way to merge two layers into one layer?

Would be a great function to make some order after you had to import several files in different formats and find yourself with too many layers.

3 Likes

One way is: 1) select the levels you want to merge. 2) right click> select objects on level 3) click on the layer you want to use (or create a new layer). 4) right click> move objects on this level.

-Simon.

Hey Zsimon.
The way merging layers without first selecting the objects on that layer is very helpful since these objects might be nested in multiple blocks…

AUTOCAD has this function and it helps a lot in managing layers…

I also hope to see this feature/script. Thumbs up.

5 Likes

Any new solutions to this issue?
Having this functionality would be great!

3 Likes

Hello - this script should do what I think you are asking, but it will not work if there are block definition items on the layers.

MergeLayers.py (1.3 KB)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"

If blocks are an issue, you can first try this script to move block definitions onto a particular layer.

MoveBlockObjectstoLayer.py (2.2 KB)

-Pascal

4 Likes

Hi pascal

I’ve used your 2 scripts - both fine
But still would like one unique script to manage to

  • merge or a set of source layers to a target layer
  • including layers in blocks
  • delete merged layers as default option
  • and best of all, no merge - just delete all source layers !

I’ve written my 1st script that can operate only on all blocks in a Rhino Doc
(not only chosen or inserted instances)
Script works with a “Layer 01” source name embedded in the script.
KT_block_layer_merge_06_ok.py (1.5 KB)

I was about to “add” my script to your " MergeLayers.py" script.
kk_MergeLayers_01_wont_work.py (2.3 KB)

But has an issue with “LayerID” and “LayerIndex”
I can’t find how to retrieve the LayerIndex !

Here is my test file
block_script_layer01_00.3dm (351.1 KB)

Would you please help me out

:slight_smile:

Hi Pascal and all ones looking for a merge layer that works with blocks

I finally managed to script a “full” merge layers from both or your scripts

Script Process

  • Choose Source layers that will be merged
  • Choose a unique target layer
  • All Source Layers are merged to target
  • All Source Layers in blocs and nested blocks are merged to target
  • Prompt “Yes No” to Purge empty layers

I would LOVE to add an option for a complete layer deletion, even in nested blocks…
Enjoy (and help if possible)
Best regards

Test file and script
MergeLayersAndBlockLayers_v01.py (2.4 KB)

block_script_layer01_00.3dm (351.1 KB)

5 Likes

I came here from a search on how to merge Layers of an imported DWG drawing, this worked like a charm – and on Mac! Thanks a lot

thanks IVEx
I’d like someone to help me out with DELETING a layer even in blocs
Cant manage to understand how Pytonscrip manages the elements in the blocks
Looks like you have to make a list of what you keep, and recreate the block
Delete method doesn’t work…

:slight_smile:

Wow, I’ve tried many other scripts to merge layers without any luck if blocks are involved. And this works very well, thank you! (Unfortunately I can’t help with the rest.)