# Best way to create an array of objects in Illustrator?

I often find myself needing to create an array of objects, either in a straight line, rotated around a centre point, or angled along a path. At the moment I'm using all sorts of different and no-doubt stupid ways to do it, usually one at a time with a little head-math and the transform palette- And I know it's the dumb way to do it. Can anybody point me to the correct way, or to a plugin if it's not possible in Illustrator?

• ain't this a question for StackOverFlow? – rzlines Feb 25 '10 at 4:09
• Hrm... I don't think this questions really fits into the scope of SuperUser, as it is more of an arty, photoshoppy kind of question. – Josh Hunt Feb 25 '10 at 4:13
• I think it's ok - it's a question about "computer software" as per the faq, not much different than asking about excel tricks or video editing. – dsolimano Feb 25 '10 at 4:18
• grrrr. one of these days i'll learn to read the question before voting to close. no, don't send this to stackoverflow.... – quack quixote Feb 25 '10 at 4:40

Go to Effects -> Distort/Trasnform -> Transform... Add amount of copies you want then play with the array controls

• This won't do mapping along a curve by the look of it, but it's pretty useful, cheers :) – Sophistifunk Dec 12 '11 at 1:05

There are a few ways to achieve this...

• The quickest method is to translate, scale, or rotate an object while duplicating it. To duplicate an object in Windows, hold down the 'alt' key*. The transformation and duplication can then be repeated by pressing CTRL + D.

• For greater precision, select a transformation tool from the toolbox and press enter. A dialogue should then appear, allowing you to enter numerical values, and has a 'copy' button. Again, once the dialogue has closed, you can press CTRL + D to repeat.

• The Blend tool can 'step' objects, which also has an option for rotating objects to match a path.

• The 'Actions' palette can record and playback multiple transformations.

• Illustrator supports a number of languages for scripting, and this offers the most flexible solution but is generally more time consuming to learn and set up.

*Mac key combinations may differ slightly.

• Transform works for simple cases, but you can't rotate around a custom point using any of the transform dialogs (as far as I know) and it's no use at all when you want the new objects to follow a path. I'll look into the Blend tool though, cheers. – Sophistifunk Feb 25 '10 at 6:34
• I suspect you're right. It's possible to set the point of rotation visually by holding down the ALT key, then clicking. The rotation dialogue will then appear, enabling you to specify the rotation angle. – AffineMesh Feb 25 '10 at 7:26

You can also use scripting. For example, this is how you can create 20 path items with random rotation and position from center.

// creating a document
var doc = app.documents.add();
// adding a new layer
var layer = doc.layers.add();

// variable declarations
var i, ray, displacement, dx, dy;

// creating 20 path items in a loop and setting their parameters
for (i = 0; i < 20; i++) {
// adding a path item and saving it to the "ray" variable
// defining path points
ray.setEntirePath([ [0, 0], [0, 10]]);

// generating a random angle for rotation
// note: rotation in Illustrator is counter-clockwise
ray.rotation = Math.round(Math.random() * 360);
// applying rotation to the path, using its bottom as the origin point
ray.rotate(ray.rotation, true, true, true, true, Transformation.BOTTOM);

// moving the path away from the center of the document by "displacement" amount
displacement = 10 + Math.random() * 10;
// calculating x and y coordinates from "displacement"
// (which is basically a hypotenuse)
dx =   displacement * Math.sin( (180 + ray.rotation) * Math.PI / 180 );
dy = - displacement * Math.cos( (180 + ray.rotation) * Math.PI / 180 );
// translating the path
ray.translate(dx, dy);
}


You can then save this as "somefile.js" and execute by File->Scripts->Other script... Or paste it into the ExtendScript toolkit and run it from there.

• Never thought of that, cheers. – Sophistifunk Jun 17 '11 at 9:38

I find using a technical vector based programs to be the best.

I have Illustrator and AutoCAD open at the same time and can copy clip vector lines into Illustrator. If you know how to use both, you can fly through geometric design work.

Easiest way I found:

1. With the select tool (black arrow icon or V in keyboard), select the thing you want to array.

2. Click the rotate tool (rotating arrow icon or R in keyboard), hold Alt and select the center of rotation.

3. Pop up box will appear. Enter the angle of rotation (example: if you want three of the things to array in a circle, then divide 360 by three). Click Copy.

4. You will notice that only one of the things appeared. Click Ctrl+D to duplicate the thing with the number of copies you want.

Hope this helped!