Page 1 of 1

getlayerstyle setlayerstyle safe way to copy a layer?

Posted: Thu Aug 17, 2017 3:35 pm
by Bugala
As i couldnt find any "CopyLayer" command. I was wondering if this would be a safe way to do it:

Code: Select all

newlayerid = InsertLayer(0, #BRUSH, 1, 1, 1)
t = GetLayerStyle(layertobecopiedID)
SetLayerStyle(newlayerid, t)
Or do i have to take something into consideration, like is there some piece of information missing from layerstyle infos?

Re: getlayerstyle setlayerstyle safe way to copy a layer?

Posted: Sat Aug 19, 2017 12:14 pm
by airsoftsoftwair
Hmm, interesting approach. I'm not sure it will work 100% for all layer types, though, although in theory it should. If you have a case where it doesn't work, just post.

Re: getlayerstyle setlayerstyle safe way to copy a layer?

Posted: Thu Aug 26, 2021 9:07 pm
by airsoftsoftwair
Last but not least:

Code: Select all

- New: Added CopyLayer() command which can be used to make an identical copy of an existing layer; all
  layer attributes are cloned except the layer name (if present) because that must be unique; a new name
  for the layer can be passed in the optional table argument