3 Replies Latest reply on Jan 21, 2013 6:37 PM by CarlosCanto

    Coordinate system in illustrator

    maguskrool

      Hi. I'm trying to build a shape in Illustrator CS6, OSX 10.7.5, using a script with setEntirePath. I begin with:

       

      var aPoints = new Array ([20, 50], [60, 30]);

      pShape = app.activeDocument.pathItems.add();

      pShape.setEntirePath(aPoints);

       

      I expected a diagonal line on my artboard but it is actually drawn outside it. From this I gathered that the y axis is considered inverted in javascript and so I have to change the code to var aPoints = new Array ([20, -50], [60, -30]); to get the intended result.

      To me this is not intuitive at all. Is there a reason this happens? And is there a way to change it so I can write the y coordinates the way they actually appear on Illustrator, with (0,0) at the top left and positive values to the right and down?

       

      Thank you.