Advertise    Write for Us


How to distribute shapes within another shape in Illustrator

posted by: Iaroslav Lazunov, in Illustrator Tips / Techniques/ Comments: 6

A dozen of times I came across this question which is conformable to the topic of the present tutorial. I also participated in discussions couple of times trying to solve this problem. And only today I’ve got the answer the key question - How? I’m sure, some designers distribute objects within another object manually, but we’d prefer to do everything quickly and automatically, wouldn’t we?

To distribute objects inside another object we’ll need three scripts, which will be introduced in the process of their application. In the meanwhile, download the zip archive with scripts by clicking on the Download button. Unpack the archive and place its contents into the system folder with scripts, for example:

For Windows: C:\Program Files\Adobe\Adobe Illustrator CS5\Presets\en_GB\Scripts

For Mac: Applications / Adobe\Adobe Illustrator CS5\Presets\en_GB\Scripts

Restart Adobe Illustrator in case it was running at the time of scripts’ installation. All the scripts were successfully tested in Adobe Illustrator CS5, CS6 and CC.

Create a path with no fill; we will place our objects inside it.

After our scripts were installed, their names appeared in the menu File > Script > …. Select the created path (by the way, it can be open and compound path), then go to the File > Script > Circle Fill. In the opened dialog box set the maximum and the minimum value of circles as percentage to the size of an external object and a minimal distance between the circles.

You also have an opportunity to choose the color of circles from the drop down list; however, this option won’t be useful in this tutorial.

Click OK.

A cool effect was obtained within a couple of seconds, but we’d like to use other objects to fill space within the form. Let’s create an object with which we want to replace the circle. First, I created a very simple soap bubble, which is a group of black circle and a white highlight form. Before using the next script, please make sure that our bubble is placed above the circles and that these circles are not grouped. These obligatory conditions allow our script to work.

Select the circle and the bubble, then go to the File > Script > FindAndReplaceGraphic_TransformToFit.

As you can see, the object switch was performed successfully, while the size of initial circles, which formed a shape of heart, was taken into consideration.

And now let’s try to replace the circles with an object of a more complex shape. The most important is that the height and the width of this object were not equal.

Select all the objects, then go to the File > Script > FindAndReplaceGraphic_TransformToFit.

As you can see, after replacement the objects were deformed. This deformation will be higher, the bigger the difference between the height and width of the replacing object. To get rid of this deformation, I suggest your attention one trick. Create a circle with no fill and no stroke, so the object is located inside this circle.

Group the object and the circle with no fill and no stroke, then repeat the circles’ switch (File > Script > FindAndReplaceGraphic_TransformToFit). Now, we have no deformation.

Don’t forget that you can always rotate and move the received objects in random order with the help of the Transform Each function (Object > Transform > Transform Each…)

If you came across similar illustrations, then you know that the outer form is often filled with a couple of objects, and not with one as in our case. No problem. The Random Select script can select all the objects in random order (File > Script > Random Select). After the script starts, the Script prompt opens, where you need to enter a percentage ratio of selected objects.

Select a new object while keeping the earlier objects selected.

Start the script FindAndReplaceGraphic.

Personally, I’d like to receive higher dense objects inside a filled form. That’s why if you have other solutions of this problem, please share your experience with us.

Total comments: 4
0   Spam
1 zandor   (2013 Nov 08 09:03)
Very good tut, will help a lot!

Thanks! up

0   Spam
2 TmariettaR   (2014 Jan 04 23:19)
Very helpful...thanks!

0   Spam
3 Joyce   (2014 Aug 26 13:12)
This is so helpful! Thank you very much.
Instead of random circles sizes that fit inside the heart shape, is there a way to set the circles to 2 exact sizes only? Let say I want to them to be 2mm and 4mm circles.

0   Spam
4 K. Kabuto   (2014 Aug 27 17:51)
Thanks. But how can I make all the objects the same size? In the CircleFill dialogue box, even if I set the max size and min size as the same number, the circles differ in size. Thanks again.

Only registered users can add comments.
[ Registration | Login ]
Subscribe Now!
RSS feed twitter
Recent Consultations
How to use Rasterino and Illustrator in web design
How to split vector objects into parts corresponding to specific data in Adobe Illustrator