Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Make sizes more accurate?

$
0
0

This script should make a rectangle the same size as the artboard.

 

However if the artboard is 210mm wide the rectangle ends up being 210.002mm, is there any way to make this more precise?

 

#target illustrator
var docRef = app.activeDocument;
var artboardRef = docRef.artboards;
var activeAB = docRef.artboards[docRef.artboards.getActiveArtboardIndex()]; // get active AB

//get artboard size
var left = activeAB.artboardRect[0];
var top = activeAB.artboardRect[1] ;
var width = activeAB.artboardRect[2]-activeAB.artboardRect[0];
var height = activeAB.artboardRect[1]-activeAB.artboardRect[3];

//create box
var box = docRef.pathItems.rectangle (top, left, width, height);
box.fillColor = box.strokeColor = new NoColor();

Viewing all articles
Browse latest Browse all 12845

Trending Articles



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