Search code examples
adobeadobe-illustrator

Evenly distribute objects within another object


Is there a simpler way to even distribute multiple objects within the bounds of another object?

I've included a picture to help illustrate what I want done.

enter image description here

The green portion is my artboard, the gray portion is the main body and I would like item1-6 to be even distributed within the bounds of the white box. Typically to achieve the desired result I have to create additional objects (represented by the red lines) and place one at the left end of my box, one at the right end, and one between each item, and then use the distribute evenly button and remove the red lines afterwards.

I imagine there is a faster way but I can't seem to find it. Any ideas are appreciated.


Solution

  • Okay, this is slightly fiddly, but hopefully this will seem quite inuitive once you've done it once or twice.

    Short version;

    1. Find the width of your container.
    2. Select container and objects - then set container to Key Object.
    3. Enter width of container into Align window: Distribute Spacing, divide the figure by the number of objects, then click Horizontal Distribute Center.
    4. Group your objects and center them to your container. Ungroup them again, if desired.

    Long version;

    1. Work out the width of your containing box (or artboard, if you are distributing your items to that). If, for example, you have a rectangle you can simply select it and look at the 'W' (width) value at the top of the window (click on Transform to reveal the info if you're working on a smaller screen). Just remember this number - nothing else.

    find the width value of your container

    2. Select all of your items AND your container. Click on the container again to make it the 'Key Object' (you should see that its selection edge becomes distinctly fatter).

    select all items and container - then set Key Object

    3. If necessary, open up your ALIGN window (Window > Align). With the window visible, you should see three rows or sections from which to choose - 'Align Objects', 'Distribute Objects' and 'Distribute Spacing'. If the latter is missing, you may need to click on the little up/down arrow symbol next to the 'Align' tab title a few times in order to expand all of the options.

    enter image description here

    4. Ensuring that you still have all of your items selected and your container set as the Key Object (The 'Align To' box should automatically be set to 'Align to Key Object' in recognition of this), enter the container width you took note of earlier into the 'Distribute Spacing' box - and append /x where x = the number of items you have. So, if your box is 200 pts wide, and you have 5 items, you would enter 200/5 - this will just save you having to do the maths. Illustrator will automatically divide your starting figure and (in the case of this example), it would change to 40 pt (200 divided by 5).

    enter the container width, followed by the number of items you wish to divide it by

    5. Now click on the Horizontal Distribute Center button and all of your items will be set to the correct spacing. They probably WON'T be properly aligned with your container, though, so ...

    Use Horizontal Distribute Center

    6. In order to prevent your nicely spaced items being messed up by the next step, DE-SELECT the container (so only your items are selected), group them together - either with the keyboard shortcut CTRL+G (or COMMAND+G on Mac), or by going to Object > Group.

    Group the items

    7. With the items grouped, re-select your container (so container AND group of objects are selected), make the container the Key Object again - if you don't want to see it move) and click on Horizontal Align Center. Your items will now be properly centered in your container and can be safely ungrouped if you wish (Ctrl+Shift+G / Command+Shift+G).

    Use Horizontal Align Center