Copying paths between layers

Hello,

I’m trying to write a script that copies paths from one layer (Master) to another one but I can’t figure out how to paste the content of the original layer to the destination.

For now, I’m accessing the layer I want to get the path from and using copyDecomposedLayer but after that, I’ve tried to append this object to the layer I want to paste the paths and it looks like it’s not possible. Any hint on what should I do?

Thanks.

newpaths = []
for path in layer1.paths:
    newpaths.append(path.copy())
layer2.paths.extend(newpaths)
2 Likes

Iterate through the paths and do something along the lines of receivingLayer.paths.append(path.copy())

1 Like

Thanks, guys! I didn’t know about this extend method for all paths in a layer. Iterating through all paths in layer1 and adding them to layer2 was my initial idea but I was missing this part.

Thank you so much again for your fast response.