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

distributing all elements evenly

Explorer ,
Jun 02, 2023 Jun 02, 2023

Copy link to clipboard

Copied

Hello everyone,
I am looking for a method or script to distribute many different elements/symbols evenly on a grid. What I mean is how to scale the length and height without scaling the objects themselves. Thanks for your tips!

Pict01.png

 

 

TOPICS
Draw and design , Feature request , Scripting , Third party plugins

Views

521

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

correct answers 2 Correct answers

Community Expert , Jun 02, 2023 Jun 02, 2023

You are welcome, Bob.

 

"calculating the percentual ratio"

 

You can leave the calculation to Illy (job description Adobe Illustrator), by inserting the quotient itself, instead of calculating it.

 

As I mentioned, if you wish to go from x to y, you just write 100y/x, in other words writing 100 times y followed by / and followed by x, just adding 00 after y if it is a whole number, otherwise moving the decimal point/comma two places to the right (and add 0 if y only has one decimal place.

 

To s

...

Votes

Translate

Translate
Guide , Jun 02, 2023 Jun 02, 2023

This is a quick script implementation of @Jacob Bugge's idea. 

// select relevant page items
var doc = app.activeDocument;

var array1 = [];
for (var i = 0; i < doc.selection.length; i++) {
    array1.push(doc.selection[i]);
}
array1.sort(function (a, b) {
    return a.left - b.left;
});
var bounds1 = array1[0].geometricBounds;
var x1 = bounds1[0] + ((bounds1[2] - bounds1[0]) / 2);

var array2 = [];
for (var i = 1; i < array1.length; i++) {
    var bounds2 = array1[i].geometricBounds;
    var x2 
...

Votes

Translate

Translate
Adobe
Community Expert ,
Jun 02, 2023 Jun 02, 2023

Copy link to clipboard

Copied

Bob,

 

You can scale them up by y/x, then scale each down again with Object>Transform>Transform Each, using the reverse scaling factor x/y.

 

Specifically, you can select all of them, then:

 

1) Start with the Transform panel by multiplying the W or H value by y/x, or the with Object>Transform>Scale by inserting 100y/x as Uniform (100 because it works in %),

2) End with the Object>Transform>Transform Each by inserting 100x/y in both directions (100 because it also works in %).

 

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
Explorer ,
Jun 02, 2023 Jun 02, 2023

Copy link to clipboard

Copied

Hi Jacob,

Thanks for your tip - it works, indeed; I have used this trick before. However, it's only sometimes useful, especially not when I got many elements in many different compositions to change - it just takes a lot of time, especially calculating the percentual ratio. I want to use something like Transform Each, with the option to skip the scaling vector itself.

Best

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 02, 2023 Jun 02, 2023

Copy link to clipboard

Copied

You are welcome, Bob.

 

"calculating the percentual ratio"

 

You can leave the calculation to Illy (job description Adobe Illustrator), by inserting the quotient itself, instead of calculating it.

 

As I mentioned, if you wish to go from x to y, you just write 100y/x, in other words writing 100 times y followed by / and followed by x, just adding 00 after y if it is a whole number, otherwise moving the decimal point/comma two places to the right (and add 0 if y only has one decimal place.

 

To show some samples with the changes to y shown bold red underlined, this means that if you wish to:

 

Scale up from x = 13 to y = 36, you just write 3600/13

 

Scale up from x = 13 to y = 36.723, you just write 3672.3/13

 

Scale up from x = 13 to y = 36.7, you just write 3670/13

 

 

And the opposite for Transform Each, just swapping x and y.

 

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 02, 2023 Jun 02, 2023

Copy link to clipboard

Copied

Bob,

 

Remembering and rereading your OP (Original Post) with this, "I am looking for a method or script", I am convinced that it would be easy to create a script that performs those tranformations; for a scripter that is.

 

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 02, 2023 Jun 02, 2023

Copy link to clipboard

Copied

This is a quick script implementation of @Jacob Bugge's idea. 

// select relevant page items
var doc = app.activeDocument;

var array1 = [];
for (var i = 0; i < doc.selection.length; i++) {
    array1.push(doc.selection[i]);
}
array1.sort(function (a, b) {
    return a.left - b.left;
});
var bounds1 = array1[0].geometricBounds;
var x1 = bounds1[0] + ((bounds1[2] - bounds1[0]) / 2);

var array2 = [];
for (var i = 1; i < array1.length; i++) {
    var bounds2 = array1[i].geometricBounds;
    var x2 = bounds2[1] + ((bounds2[3] - bounds2[1]) / 2);
    if (x2 > bounds1[3] && x2 < bounds1[1]) {
        array2.push(array1[i]);
    }
}
array2.sort(function (a, b) {
    return a.left - b.left;
});
var bounds2 = array2[0].geometricBounds;
var x2 = bounds2[0] + ((bounds2[2] - bounds2[0]) / 2);

var x = x2 - x1;
var y = Number(prompt("", "", "y (points)"));

var group = doc.groupItems.add();
for (var i = 0; i < doc.selection.length; i++) {
   doc.selection[i].moveToEnd(group);
}
group.resize(100 * y/x, 100 * y/x);

for (var i = group.pageItems.length - 1; i > -1 ; i--) {
    group.pageItems[i].resize(100 * x/y, 100 * x/y);
    group.pageItems[i].moveAfter(group);
}

 

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 02, 2023 Jun 02, 2023

Copy link to clipboard

Copied

LATEST

Excellent, Femke.

 

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