Script for sorting blocks

Recently cleaned up a document which took ages because of alot of blocks that where assigned to layers that I wanted to get rid of. Usually when working the layer structure changes slightly so it is hard to commit to a 100 % method of sorting blocks on layers. Usually I have some nested objects which are set to layer, these are then placed in a block with additional objects - all of these is objects/blocks are then set to ByParent.

It would be usefull with a script that sets objects inside a block (first level deep) to ByParent but leaves the content in the nested block be. It is possible to do that with a slight modification of Pascals Script

MoveBlockObjectstoLayer.py (1.3 KB)

Hi @nilceros,

Here is a sample I wrote a while back. Perhaps it helps or is at least a good starting point.

test_byparent.py (2.0 KB)

– Dale

Really Nice would it be possible to set the layer from a list also?