Sg2.9
new art object while first la...
Recent RSS
new art object while first layer locked -> error
Date:  2. May 2006, 18:53

Okay, this is quite an obscure one..

AFAIK when you create a new art object, you can only define the document that it will be put into.
It is automatically created in the first layer in the document, even if you want it to be in another layer.
So I use the append function to move it over.

The thing is, that when the first layer is locked, it produces an error.

With the following sample code, I have the first layer locked and the second layer selected:

activeDocument.activeLayer.append(new Group(activeDocument));

It could be nice if we were able to make new Art objects like:

new Group(activeDocument.activeLayer);

But like I said, it's obscure - and maybe I'm wrong!

Re: new art object while first layer locked -> error
From:  
Date:  11. May 2006, 15:28

this also happens when the first layer is set to unvisible

Re: new art object while first layer locked -> error
From:  Jürg Lehni
Date:  29. September 2006, 22:45

This is finally fixed in the upcoming version 2.0.018.

Objects are now created on the active layer. If the layer is hidden or locked, an error is thrown.

Layers are created above the active layer.

I hope it is more intuitive like this? I prefer this behavior to passing even more arguments to concstructors. It is easy to choose were to create objects by activating other layers from a script.

I also removed all the Art constructors (Path, CompoundPath, Group, etc) that took a document parameter. If objects need to be created in another document, the document should be activated first. There is also the possibility to call document.createGroup / createComoundPath, etc.

Does this feel concise?

Re: new art object while first layer locked -> error
Date:  30. September 2006, 13:00

Thanks for the fix.. activeLayer is the way to go!

I agree about the Art constructors.. Esp. if you can accomplish the same thing with document.createGroup etc. Makes things much easier!

But but but, any chance cloning between documents will be possible one of these days? This way we can use other documents as libraries.. ; D

Re: new art object while first layer locked -> error
From:  Jürg Lehni
Date:  1. October 2006, 17:07

Cloning is still a bit further down on the todo list, but you should be already able to achieve this by using the selected state of objects and Document.copy() / Document.paste(). Did you try this?

Re: new art object while first layer locked -> error
Date:  1. October 2006, 19:59

Thanks for the tip, I'll try it out soon!

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Mosaic Staple Raster 24.03.10