Extendscript - Adobe Illustrator - Ellipse not in right location
I'm trying to do something that seems simple, but not sure how it's not working. I have a map layer and I'm trying to draw circles via Extendscript. I'm trying to test just by trying to draw a simple circle at point 100,100 (I assume top left of map is 0,0), but when I execute it, the circle appears way further down than it should be (seems close to 200,700). Below is my code I'm using...
var dotRadius = 8.136 / 2;
var testDOT = mapLayer.pathItems.ellipse(100, 100, dotRadius*2, dotRadius*2, false, false);
testDOT.strokeWidth = 0.25;
testDOT.strokeColor = getColor("MAROON"); // defined above
testDOT.fillColor = getColor("MAROON");
the getColor just creates a CYMK Color object. Can anyone give me a clue on why the 100,100 point is not where I expect it to be?
TIA!
Just in case, it looks like your script used the 'relative' coordinate system (relative to zero point of current artboard).
To made it to use 'absolute' coordinates (relative to the top-left corner of the first artboard for a new document) you can add this line at the start of your script:
app.coordinateSystem = CoordinateSystem.DOCUMENTCOORDINATESYSTEM;
Or you can use the 'relative' coordinate system:
app.coordinateSystem = CoordinateSystem.ARTBOARDCOORDINATESYSTEM;
In this case you can move zero point of any artboard with this commands:
var doc = app.activeDocument;
doc.artboards[0].rulerOrigin = [0,0];
doc.artboards[1].rulerOrigin = [200,700];
// etc