Rotating features in python

Discussion created by mdenil on Feb 15, 2012
I have been using arcpy.mapping to set up a series of maps showing particular regions of an area. Most of the maps use rotated data frames to place each region on its individual sheet.

Querying the data frames, I can get the 'corners' of the map extent from the extent object. I put corners in quotation marks because these 'corners' (lower and upper, left and right points) WOULD be the corners IF the data frame was not rotated.

I can get the rotation from the data frame object too, of course.

However, I was trying to create a proper bounding rectangle for each data frame, and while I can use the corner points to create a polygon geometry object, and create a feature class of the reconstituted rectangles, I also need to ROTATE the resulting rectangles to the rotation of the data frame.

I have attached a small graphic to show the issue. The red outlines show the actual extents of each data frame for one of the areas where I am working; the solid colored rectangles are the polygons generated when I make polygons from the 'corners' stored in the extent object.

Obviously, I could rotate each extent interactively (and I did that to get the red outlines), but I would like to know how I can do this using python. I am guessing I would have to invoke some ArcObjects directly in the python script, but that is as far as I have come. Any actual incantation to summon the AO spirits has yet to be scripted.

Advise? Am I correct in requiring AO? Hints?