Sg2.8
The Coordinate System
Index RSS

In a newly created document, the coordinate system in Adobe Illustrator has its origin in the lower left corner of the page and extends to left and upwards from there.

Depending on how you set up additional art-boards or change the default one, the origin can differ, but the orientation of the coordinate system will always be the same.

Rulers and Units

To see where the origin is located, display the rulers in the Illustrator document by pressing Cmd-R. No matter what units you have set the Illustrator preferences to, the rulers always display the coordinate values in Point units (pt). This is also the unit that Scriptographer internally works with, so you might want to switch all preferences to that when working with Scripts. Hit Cmd - , to go to the Units Preferences and switch all units to Points:

Below a simple example of the relation between units in code and in the Illustrator UI. Executing the following script produces a rectangular path with the bottom left corner at {x: 50, y: 50} and with a size of {width: 100, height: 100}. Read the Working with Path Items tutorial for more information about creating path items.

var bottomLeft = new Point(50, 50);
var rectSize = new Size(100, 100);
var myRect = new Path.Rectangle(bottomLeft, rectSize);

The resulting rectangle can now be examined in multiple ways in Illustrator. Hovering over points will display their coordinates. The Transform palette will display the width and height of the object, and the coordinates of a reference point, which when set to lower left corner will be the same as the values used in the script.