Hi James,
re:
> Is there a script property that returns the center point of polygons (regular & nonregular)
> and ellipses, just as does “Center” Object Snap?
For an ellipse see the isEllipse and conicFrame properties listed above. You'd do something like:
if ( crv.isEllipse )
{
var center = crv.conicFrame.origin;
...
For a polygon there is not any single property for that but it can be computed the same way MoI does by the centroid of the polygon vertices.
You'd do something like look at .isClosed and .isPlanar and if both of those are true get the curve segments by crv.getSubObjects() then go through all segments testing .isLine on each one, if all are lines go through them and add together all the segment start point coordinates and divide by the number of points to get the centroid.
- Michael
|