Quantcast
Channel: Adobe Community : Unanswered Discussions - Illustrator
Viewing all articles
Browse latest Browse all 41949

Centerlines on All Artboards

$
0
0

Hello Everyone,

 

I'm trying to create some simple vertical centerlines to be drawn in the same spot on all existing artboards in my document.  What I have so far is creating the proper amount of centerlines but only drawing them in the correct spot on half of the artboards while the other half are being drawn in the space between the artboards.  Here's what I have so far.

 

 

function addCenterLines() {    var doc = app.activeDocument;     for (var i = 0; i < doc.artboards.length; i++) {     var abRect = doc.artboards[i].artboardRect;      {// Add top line    var line = doc.pathItems.add();    line.stroked = true;    line.setEntirePath( Array( Array(abRect[2]/2, abRect[1]-10), Array(abRect[2]/2, abRect[1]-20) ) );    };      {// Add bottom line    var line = doc.pathItems.add();    line.stroked = true;    line.setEntirePath( Array( Array(abRect[2]/2, abRect[3]+10), Array(abRect[2]/2, abRect[3]+20) ) );    };      }} 

 

Here's a screenshot showing the top of a couple of the artboards and the misplaced centerlines in between.

 

abTop.jpg

 

I think I have a great misunderstanding of how the abRect coordinates work, as in which side is [0],[1],[2] and [3], which may be leading to my inability to get this right.  If someone could point me in the right direction so I can sort out my centerlines, I would be greatly appreciative!

 

Thank you,

Ben

 

NOTE: The centerlines provided in the print dialog are not an option in this case.


Viewing all articles
Browse latest Browse all 41949

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>