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

align rectangular objects

Explorer ,
Oct 03, 2024 Oct 03, 2024

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
969
Translate
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"

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

Can you share an example?

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

Hanschrs_0-1727972104694.png

sure

Translate
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

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.

Translate
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

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

thans a lot

 

Translate
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

Simple, No script

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

Works perfectly, thanks

Translate
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