Copy link to clipboard
Copied
Hi,
I used a free script a few years ago to make an isometric forest of randomised trees.
Now i can't find the script.
I had thought it was distributeStackedObjects.js but that does something else.
Anyone recall the script that does this?
It was great for reordering a lot of symbols on screen so those lower down the screen, or more to the right, would be brought to the top.
This made it ideal for isometric work where overlap is critical to the perspective.
I don't remember seeing a script as described. But I made a wild guess, try the 2 scripts in this post
[edited link, found a more recent one]
Trying to perfect this now:
#target Illustrator
var docRef = app.activeDocument;
var sel = docRef.selection;
var selLen = sel.length;
if(!sel.length) {
alert("You must make a selection.");
}
function sortByScore(a,b){
var scoreA = Math.round(Math.abs(a.top));
var scoreB = Math.round(Math.abs(b.top));
return (scoreA-scoreB);
}
function stack(sel){// Only fire this off once the sel array has been sorted.
var layer = app.activeDocument.layers[0];
var len = sel.length;
...
Copy link to clipboard
Copied
I don't remember seeing a script as described. But I made a wild guess, try the 2 scripts in this post
[edited link, found a more recent one]
Copy link to clipboard
Copied
Thanks @CarlosCanto , not the one I used but I'll give it a go tomorrow 👍
if I can find the isometric forest stacking order script I'll post a link to it here.
Any other replies most welcome in the meantime.
Copy link to clipboard
Copied
Trying to perfect this now:
#target Illustrator
var docRef = app.activeDocument;
var sel = docRef.selection;
var selLen = sel.length;
if(!sel.length) {
alert("You must make a selection.");
}
function sortByScore(a,b){
var scoreA = Math.round(Math.abs(a.top));
var scoreB = Math.round(Math.abs(b.top));
return (scoreA-scoreB);
}
function stack(sel){// Only fire this off once the sel array has been sorted.
var layer = app.activeDocument.layers[0];
var len = sel.length;
for (var i=0;i<len;i++){
var item = sel[i];
item.move(layer, ElementPlacement.PLACEATBEGINNING);
}
}
sel.sort(sortByScore);// First: Sort sel by score. This takes the sel array and runs it through the sortByScore function.
stack(sel);// Second: Restack sel in the parent now that it's sorted.