Sg2.9
Grid Generator
Recent RSS
Creator:  Shanfan Huang
Date:  4. January 2012, 11:04

This is a very straight forward tool that generates four kinds of grid. You type in the number of rows and columns, and the size of the unit, then click a button.

While those grids might seem basic to mathematicians, I thought it'd be handy to have something like this in AI for graphic artists. Something looking basic at first can be creatively altered and became something interesting. I attached two quick-dirty mockups just to demonstrate some possibilities.

My favorite trick is to use the raster.getAverageColor() function to layout a rich and abstract color combination. If you feel like to try, copy the code below to the end of my scripts:

  • -----------------------------------

// Pickup colors from a raster//
//NOTE: An image must be placed within the artboard and rasterized//

var rasters = document.getItems({
type: Raster,
selected: true
});

var paths = document.getItems({
type: Path,
selected: true
});

if(rasters.length >0 && paths.length >0){
var raster = rasters[0];
for(var i=0; i<paths.length; i++) {
var path = paths[i];
var color = raster.getAverageColor(path);
path.fillColor = color;
}
}else{
Dialog.alert('Please select at least one rasterized image and one path overlapping on top.');
}

  • -------------------------------------------

UPDATE: 01/10/2012
I uploaded the above lines as a separate script.

Re: Grid Generator
Date:  3. July 2013, 19:02

if you can see this menu then the script is installed ok

  • Make - will create a grid - you do not make a shape first.

An error I sometimes make is to have the pen colour in white :-)
Try looking in Outline Mode not Preview ?

Re: Grid Generator
Date:  3. July 2013, 19:07

if that works then you can try the -Raster-
make a raster under the grid you have made ;
select the raster and the grid;
click -Raster-

or you can colour the grid using other scripts
Variator and Themed Colours recommended

Re: Grid Generator
From:  Jess
Date:  4. July 2013, 04:05

Thx for the tips, but my problem is more complicated, I think. [?]

I always receive this message:
"Error 22: Palette does not have a constructor.
Line: 174

  • > var palette = new palette('Grid Generator', components,def);"

I already tried to install the scriptographer but my Illustrator is CS6 and the CS5 version of the scriptographer doesnt work. ):

I don't have problems with the other scripts, only with it. ):

Re: Grid Generator
Date:  4. July 2013, 08:03

bad news then .. scriptographer does not work with CS6.
It's a disappointment for all of us users but the effort for the designers to keep up with Adobe changes was too great.
I am staying with CS5 as long as I can.

Re: Grid Generator
From:  Kio
Date:  20. September 2013, 20:37

Why not use rasterColor.js ?

Re: Grid Generator
From:  rahman
Date:  22. January 2014, 18:52

Hi
i am asking your permission cause i add a button to creat square grid to your js in case someone need it

Thanks

Re: Grid Generator
Date:  22. January 2014, 20:53

Sounds like a good idea!

Re: Grid Generator
From:  echu
Date:  21. July 2014, 12:03

Hi, I'm getting only black coloured shapes after trying out rasterColour. Any ideas?

Re: Grid Generator
Date:  21. July 2014, 13:33

before clicking on raster
1 you turned the image to a raster
2 the raster is below the generated grid shapes
3 both raster and shapes are selected

also try RasterColor.js in case there is something funny in my version of it.

if still a problem , send me a mail so I can look at your image?

Re: Grid Generator
From:  Andrew A.
Date:  19. March 2015, 05:57

Does this magic script work in Illustrator CS3? Thanks!

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