Group curves parts and keep objects properties

Hi guys!

I do some CNC furniture and I need to group curves that correponds to the same furniture parts
I have managed to create a script that groups these curves by identifying curves that are inside each other.

Now I need to maintain the original objetcts properties, such as layers and colors. Do you know how can I do it?

GroupContained 2.gh (25.3 KB) GroupContained 2.3dm (3.3 MB)