• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Aligning in Illustrator

Engaged ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

Capture.PNG

Is there an easy way in Illustrator to "push" overlapping vectors so that the Right shape is butted up against the Left shape, without moving the Left Shape at all?

 

Thank you! 

TOPICS
Scripting

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guide ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

For the simplest case

 

// select 2 path items
if (app.selection[0].left > app.selection[1].left) {
    var right = selection[0], left = selection[1];
} else {
    var left = selection[0], right = selection[1];
}
if(right.left < left.controlBounds[2]) {
    right.left = left.controlBounds[2];
}

 

If you want to test for overlap beforehand, see

https://community.adobe.com/t5/illustrator/geometric-test-functions/m-p/12080581

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

@femkeblanco  how can I center horizontal and vertical, an object into artboard?

help will be appreciated!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

// select path
var x = app.activeDocument.width / 2;
var y = -app.activeDocument.height / 2;
var sel = app.activeDocument.selection[0];
sel.position = [x - sel.width / 2, y + sel.height / 2];

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

alignment is good, but I need the object can be inside of the artboard

 

GerssonDelgado_0-1623876061764.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

If you're using CS4 or earlier, remove the minus sign from

var y = -app.activeDocument.height / 2;

 

 The coordinate system changed in CS5. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

awesome!

Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 17, 2021 Jun 17, 2021

Copy link to clipboard

Copied

@femkeblanco 

step1.PNG

step2.PNG

step3.PNG

step4.PNG

step 5.PNG

     

I'm looking to automate this if possible with an Action or Script.

I'd like to manually select a row of shapes then automate

Group All but the left-most shape selected

Set the left-most shape as the key object

Distribute Spacing Horizontally .0235 in

Ungroup the selection

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 17, 2021 Jun 17, 2021

Copy link to clipboard

Copied

Do you mean something like this? 

 

Untitled.png

If so, try this:

 

// select path items
var dx = 0.0235 * 72;
var paths = [];
for (var i = 0; i < selection.length; i++) {
    paths.push(selection[i]);
}
paths.sort(function(a, b) {return a.left - b.left;})
for (var i = 1; i < paths.length; i++) {
    var s = paths[i].strokeWidth;
    paths[i].left = paths[i - 1].geometricBounds[2] - s / 2 + dx;
}

 

This will have to be modified if you are dealing with groups, including compound paths. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 17, 2021 Jun 17, 2021

Copy link to clipboard

Copied

That is definitely a piece of it yes!   It would just be really nice to select the shapes (Outlined Text) and then hit a button to make the needed spacing adjustment between 2 letters without adjusting the spacing of the other letters on that line. 

 

Thank you!

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 17, 2021 Jun 17, 2021

Copy link to clipboard

Copied

Is each letter a compound path?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 17, 2021 Jun 17, 2021

Copy link to clipboard

Copied

We break down the letters to see any "pinch points" so there are no Compound paths. 

For the example of a Lower Case "e"  we convert every letter into individual paths with a transparent stroke so we can see where the letters come too close together. 

Where ever there is an overlap I select all the characters to the right of the overlap and then nudge everything to the right until the overlap is gone.   Then I move to the next pinch point and do it again.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 17, 2021 Jun 17, 2021

Copy link to clipboard

Copied

I'm afraid I don't follow.  Paths with holes, such as the letter "e", have to be compound paths (or groups).  Could you show the full breakdown of the letter "e" in the layers panel? 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 17, 2021 Jun 17, 2021

Copy link to clipboard

Copied

Bryan,

 

Based on your latest clarifications, I have come to doubt whether it is meaningful to automate beyond the selection of everything to the right in connexion with each adjustment.

 

What looks right is right. And you(r eyes) must be the judge of that, using the time and care needed.

 

An overlap is only one aspect of what may fail to look/be right, the avoidance of too much space being equally important. And since overlap/too little space as well as too much space applies to other directions than horizontal, a simple horizontal measure is inadequate in any case.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 18, 2021 Jun 18, 2021

Copy link to clipboard

Copied

Sorry I am doing a bad job of explaining this.

Maybe this example will help.

I have outlined text that reads "Arts Council," 

I identify Pinch Points for my CNC tool between the "A" and "r" as well as between the "r" and "t".

I then manually adjust to fix those 2 Pinch Points while preserving the space between all the other letters.

 

arts council.PNG

 Is there any way I can automate that process?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 18, 2021 Jun 18, 2021

Copy link to clipboard

Copied

Bryan,

 

Based on your CNC post, which seems to imply the need for a certain clearance between the letter shapes, here is an elaboration and a suggestion, limited to the avoidance of pinch points/obtaining of clearance.

 

As I said, pinch points can to apply other directions than horizontal so a simple horizontal measure is inadequate in (m)any case(s).

 

If the ti part of your longtime friends sample had contained pinch points, these would be far from vertical/horizontal so a much greater movement/push/nudge would be required to get a clearance.

 

At the same time, the movement must obviously be horizontal.

 

All this brings me back to let you(r eyes) be the judge, and forth to a new approach which may be either too silly and simple or silly and simple enough; no need to apply any strokes.

 

You can, for each line of Ungrouped outlined letters:

 

0) In the General Preferences set the Keyboard Increment to a suitably/sufficiently low value depending on the size you are working with;

1) Select all the letters and Effect>Path>Offset Path by half the required clearance; the tiniest overlap will show a pinch point/insufficient clearance, whereas the tiniest hairline of white between the offset paths will show a sufficient clearance;

2) If/as long as there is a pinch point, select all the letters to the right, then use the right Arrow key to nudge until you have the required clearance; you can go back and forth between the left and right Arrows to make sure;

3) When done throughout the line, select all and remove the Offset (in the Appearance panel).

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 18, 2021 Jun 18, 2021

Copy link to clipboard

Copied

Hey Jacob,

The 3 step process you detailed are the steps that I am taking now 🙂  I'm just doing a bad job of explaining that. 

I really need a way to go line by line and automate as much of this a possible because it is a real, time suck.

 

Thank you for the assist!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 18, 2021 Jun 18, 2021

Copy link to clipboard

Copied

LATEST

You are welcome, Bryan.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

Bryan,

 

As I (mis)understand it, you can:

 

1) Select both squares/whatever, then click the leftmost one once more to make it the key (unmoveable) object;

2) In the Align panel, first centre align vertically, then distribute spacing horizontally with the distance set to 0.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 17, 2021 Jun 17, 2021

Copy link to clipboard

Copied

Jacob,

You are definitely going in the right direction for me.  I'm looking to automate this if possible with an Action or Script.

I'd like to manually select a row of shapes then automate

Group All but the left-most shape selected

Set the left-most shape as the key object

Distribute Spacing Horizontally .0235 in

Ungroup the selection

 

Would that be possible?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 17, 2021 Jun 17, 2021

Copy link to clipboard

Copied

Bryan,

 

I am sure that Femke, or another scripting friend, will soon see, and post a script for that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines