Copy link to clipboard
Copied
var AddPolygon = app.activeWindow.activePage.polygons.add(
{
fillColor:"Black",
}).paths[0].entirePath = [[0,0], [10,0], [10,10],[0,10]];
alert( AddPolygon );
Hi
I want to get polygon object variable.
But, polygon add function return values have coordinates.
How to get Polygon object variable?
Thanks in advance.
That's because you are editing the object property at the declaration stage thus returning the value of the property.
var AddPolygon = app.activeWindow.activePage.polygons.add(
{
fillColor:"Black",
});
AddPolygon.paths[0].entirePath = [[0,0], [10,0], [10,10],[0,10]];
alert( AddPolygon );
Copy link to clipboard
Copied
That's because you are editing the object property at the declaration stage thus returning the value of the property.
var AddPolygon = app.activeWindow.activePage.polygons.add(
{
fillColor:"Black",
});
AddPolygon.paths[0].entirePath = [[0,0], [10,0], [10,10],[0,10]];
alert( AddPolygon );
Copy link to clipboard
Copied
By the way what's the point of declaring a polygon which turns to be a rectangle ?
Something like this would have outputted the same result:
var AddShape = app.activeWindow.activePage.rectangles.add(
{
fillColor:"Black",
geometricBounds:[0,0,10,10],
});
alert( AddShape );
Copy link to clipboard
Copied
It is just sample coordinates..
Thank you