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

Searching for old stacking order script

Engaged ,
Nov 09, 2020 Nov 09, 2020

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 , Scripting
664
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 2 Correct answers

Community Expert , Nov 09, 2020 Nov 09, 2020

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/6714168?page=1#M153489

Translate
Engaged , Nov 17, 2020 Nov 17, 2020

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;
 
...
Translate
Adobe
Community Expert ,
Nov 09, 2020 Nov 09, 2020

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...

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
Engaged ,
Nov 09, 2020 Nov 09, 2020

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.

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
Engaged ,
Nov 17, 2020 Nov 17, 2020
LATEST

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.
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