Sg2.9
isValid()
Recent RSS
isValid()
Date:  4. June 2010, 09:00

I have made a script that does the following:

1. I create an art object(s) and assign it/them a value that is stored in an array.
2. The script creates a sub-layer to which the object is passed and given a unique name.
3. The array is saved to a file with JSON.
4. The script should then be able to load the arrayfile and match the objects with the values in the array allowing me to keep the values I entered earlier.

It all works kind of like a puzzle, certain objects only fit with other object if their respective values are the same.

This works to some extent but every now and then there is an error message about an isValid check. How does that work?

The thing is that there is quite a few objects that I have created and it would be a very tedious and counterproductive way to have to enter all those values every time.

Re: isValid()
From:  Jürg Lehni
Date:  4. June 2010, 12:05

Do you have an example script I could look at? I am not sure I fully understand what you are encountering.

But the issue I believe is that it is currently not possible to save actual art items to text files using Json. We once stated to partially support it, but it is a very tricky endeavour.

Re: isValid()
Date:  4. June 2010, 12:42

I am not aiming to save the actual object in a file. The objects will be saved in an ordinary .AI file but the script is going to be able to recognize the layernames in the file.

I think I will take it from the begining (much of this is inspired by Jonathan Puckeys Tile Tool):

1. At startup the script creates a layer called Tiles if it doesn't already exist.
2. Press 'New Set'-button in scripts palette to create a new layer (tileset) as a child to Tiles-layer.
3. Draw (preferrably) a square object and have it selected as you...
4. ...press Add Tile-button.
5. Dialog prompt to insert values to each side of object.

6. Values stores in an array. (This is the file that I save)
7. When enough tiles have been made...
8. ...press the Renderbutton.
9. The computer randomly distributes the tiles on the artboard in a predefined grid. Only sides of the tiles that match can lie next to each other.

The script will contain a listobject with different tilesets and as you select a set from the list the script will load the corresponding arraydata.
I'm not sure if I make any sense. Would it be better to send the script so you can look for yourself?

Re: isValid()
From:  Jürg Lehni
Date:  4. June 2010, 13:27

First of all, congrats, this looks really nice!

And yes, the best would be if you could send me the script along with a description of how to reproduce the issue to team(a)scriptographer.org. I do have an idea of what is going wrong but I would like to make sure it is that before I explain.

More on this 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
objects on paths (scatter brush) 29.07.12