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
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"
...Copy link to clipboard
Copied
Can you share an example?
Copy link to clipboard
Copied
sure
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.
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;
}
}
Copy link to clipboard
Copied
thans a lot
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Works perfectly, thanks