Skip navigation
Currently Being Moderated

weird positioning issues

Jun 14, 2012 8:48 PM

trying to set the height of a groupItem to the height of aa artboard so it is flush up to the top of it. for some reason it is acting funny, I have had this before but have avoided it by not getting into negative numbers and using Math.abs(); but this seems like a terrible fix.

 

here is what I am using:

 

 

$.writeln(app.activeDocument.groupItems[0].top);
$.writeln(app.activeDocument.artboards[2].artboardRect[0]);
app.activeDocument.groupItems[0].top = app.activeDocument.artboards[2].artboardRect[0];

 

 

and it prints:

-1008.0224609375

-789

Result: -789

 

yet in illustrator it is clearly not even close, its at 1028.5 which really weirds me out because I am printing the values right there...?

 
Replies
  • Currently Being Moderated
    Jun 15, 2012 2:05 AM   in reply to hilukasz

    What you need to remember is that there 2 sets of measurements going on… Document and Artboard… When working with Artboards its much easier to set the apps script property to suit… See this…

    #target illustrator
     
    topAlign();
     
    function topAlign() {
        app.coordinateSystem = CoordinateSystem.ARTBOARDCOORDINATESYSTEM;
        var doc = app.activeDocument;
        var grp = doc.groupItems[0];
        doc.artboards.setActiveArtboardIndex(1);
        grp.top = 0;
    };
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points