Move objects on sublayers to a different parent layer

Hi Pascal GolaypascalMcNeel

Hi Pascal

Me again.
Sorry to be insisting.

If found your other script “MergeLayers.py”
Does work partially
Should add prompts (for source and target)
eg. added to script
MergeLayers_AKT.py (1.3 KB)

Partially because it will ONLY copy elements from one source layer to target then delete source (if empty)
But NOT when Source Entities are part of groups or blocks

The script should be called MoveFromSource2TargetLayer
Not Merge
Merging is merging :slight_smile:

This “Merge” layer script Could have 3 options

  • Merge to Selected Target layer
  • Merge to Default Target layer (“Default” '“Layer_0” …)
  • Delete

This way it can remove any entities laying in Source to Default target and delete Source Layer.
An excellent way to get rid (purge) “polluting” layers.
Very often there are no entities directly set in a “Source” layer, but only entities nested into blocks or groups. You cannot get rid of this “Source” layer, unless you purge blocks and groups containing entities in this “Source” layer. But usually, you do NOT want to delete these blocks nor groups, and can’t afford to edit all blocks and groups to remove those entities manually.

SU has this function, when you right clic a layer and choose “Delete layer” It is very efficient.
3 options : Move to Current, move to default, delete…

Please let me know if feasible in PY.
I could aks some one…

Best regards