Highlighted

Searching for old stacking order script

Engaged ,
Nov 09, 2020

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.

runninghead_design_0-1604924096944.png

 

TOPICS
Draw and design, How to, Scripting

Views

71

Likes

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

Searching for old stacking order script

Engaged ,
Nov 09, 2020

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.

runninghead_design_0-1604924096944.png

 

TOPICS
Draw and design, How to, Scripting

Views

72

Likes

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
Nov 09, 2020 0
Adobe Community Professional ,
Nov 09, 2020

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]

 

https://community.adobe.com/t5/illustrator/optimize-objects-stacking-order-for-vinyl-cutting/m-p/671...

Likes

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
Reply
Loading...
Nov 09, 2020 1
Engaged ,
Nov 09, 2020

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.

Likes

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
Reply
Loading...
Nov 09, 2020 0
Engaged ,
Nov 17, 2020

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.

Likes

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
Reply
Loading...
Nov 17, 2020 0
Resources