# Horizontally distribute along path

How can I horizontally distribute objects along a path? `Blend` and `Brushes` don't work for me because they distribute objects evenly according to the distance along the path.

I began by using the `Blend` method from this question. However, as shown below, the points aren't horizontally distributed as I would like. How do I get to the path and and objects displayed at the bottom of the figure below?

If you can use a scripting environment that can detect bezier intersections, this is very easy to achieve. Unfortunately, Adobe does not include these methods in their scripting toolkit. Instead, I mainly use Scriptographer or Paper.js, but I believe Inkscape can find bezier intersections as well. Here's Mike Kamermans's excellent primer on the math for those interested: Bezier curve intersections.

The following is a script for paper.js / scriptographer that aligns a set of ungrouped, selected objects to the first intersection of the top-most selected path:

``````var sel = document.selectedItems;
var sel0 = sel[0];
sel.splice( 0, 1 );
var pathOffset = new Point( 0, 500 );
var line = new Path.Line( sel[0].position + pathOffset, sel[0].position - pathOffset );
for ( i = 0; i < sel.length; i++ ) {
line.position = sel[i].position;
lineIntersections = line.getIntersections(sel0);
if (lineIntersections !== null && lineIntersections.length > 0) {
sel[i].position = lineIntersections[0].point;
}
}
line.remove();
``````

Here's a .gif of the process and result:

• Thanks! I didn't even know paper.js existed. It's also solves some other problems I've had. – Kevin Jan 1 '14 at 14:06

You can easily distribute all the points so the space between them is even. Simply select the points and click the Distribute Horizontal Space button on the Align Panel. You'll then have to manually move the points vertically to meet your line.

If you do not see the Distribute Spacing options on the Align panel, Choose `Show Options` from the Align Panel menu.

There is no method, I'm aware of, which will evenly distribute objects horizontally while at the same time following a vertical contour without distorting the objects themselves.

Brushes will distort objects in 99.5% of cases. Blends, while capable of even distribution along their spine, are not capable of distribution which ignores the blend spine (which is what you are after).

I don't know if this fits your needs, but what about simply using a Dashed Stroke?

You could alter the gap distances where needed.

• Thanks, you've answered my question. Unfortunately for me, as you've pointed out, the answer is "No, it's not possible". – Kevin Dec 31 '13 at 18:58
• Objects are distributed horizontally, but it's the vertical space which is changed. I should remove the "vertically" it's merely confusing there. – Scott Dec 31 '13 at 19:00
• The dashed stroke idea is clever. It's like a brush but without the distortion. However, horizontal distribution of the points along the bottom of the page are a must have for me. The dashed line doesn't accomplish that without manually editing alot of gaps. I have 100+ objects for several files; manual editing just isn't an option. – Kevin Dec 31 '13 at 19:09