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

align rectangular objects

Community Beginner ,
Oct 03, 2024 Oct 03, 2024

Copy link to clipboard

Copied

Hi team!, I have an urgent question: is there a script or option that would allow me to align 10 randomly distributed squares, rectangles, or other rectangular geometric shapes so that they are adjacent to each other without overlapping or leaving any gaps? I frequently perform this task and would like to see if there is a way to save some valuable seconds. Thank you very much

TOPICS
Scripting

Views

267

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 1 Correct answer

Community Expert , Oct 03, 2024 Oct 03, 2024

Based on your screenshot, the default Align palette should do it pretty effectively. Not sure if you can really save valuable seconds with any other techniques, such as using scripts.

 

Also based on your screenshot, I can imagine that you may save way more time by using some sophisticated template strategies. That would have to be clarified further, of course.

 

However, in case you may want to try another scripting approach, there is a nice script by Alexander Ladygin. It's called "Harmonizer"

...

Votes

Translate

Translate
Adobe
Community Expert ,
Oct 03, 2024 Oct 03, 2024

Copy link to clipboard

Copied

Can you share an example?

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 Beginner ,
Oct 03, 2024 Oct 03, 2024

Copy link to clipboard

Copied

Hanschrs_0-1727972104694.png

sure

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 ,
Oct 03, 2024 Oct 03, 2024

Copy link to clipboard

Copied

Based on your screenshot, the default Align palette should do it pretty effectively. Not sure if you can really save valuable seconds with any other techniques, such as using scripts.

 

Also based on your screenshot, I can imagine that you may save way more time by using some sophisticated template strategies. That would have to be clarified further, of course.

 

However, in case you may want to try another scripting approach, there is a nice script by Alexander Ladygin. It's called "Harmonizer" and you can get it on GitHub.

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 ,
Oct 03, 2024 Oct 03, 2024

Copy link to clipboard

Copied

Hi,

Based on your description, try the following snippet.

Please. make sure to select your items that you would like to arrange. Also if you want to give some space between the shapes then change the value of gap variable.

if (app.activeDocument.selection.length === 0) {
    alert("Please select at least one object.");
} else {
    var selectedObjects = app.activeDocument.selection;
    var currentX = 0; // Starting X position
    var currentY = 0; // Starting Y position
    var gap = 0;
    for (var i = 0; i < selectedObjects.length; i++) {
        var obj = selectedObjects[i];
        obj.left = currentX;
        obj.top = currentY;
        currentX += obj.width + gap;
    }
}

 

Best regards

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 Beginner ,
Oct 03, 2024 Oct 03, 2024

Copy link to clipboard

Copied

thans a lot

 

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 ,
Oct 03, 2024 Oct 03, 2024

Copy link to clipboard

Copied

Simple, No script

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 Beginner ,
Oct 03, 2024 Oct 03, 2024

Copy link to clipboard

Copied

LATEST

Works perfectly, 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