Annotation and da.UpdateCursor

Discussion created by acrateau on Nov 4, 2013
Latest reply on Nov 13, 2013 by xander_bakker

Has anyone used da.UpdateCursor on annotation feature classes?

My workflow involves copying the fields <i>HorizontalAlignment</i> and <i>VerticalAlignment</i> into place holder fields, manipulating the annotation symbology, and then copying back in the original values from the place holder fields.

I've noticed a curious behavior. The following script using the old, 10.0 cursor works as expected:

cursor = arcpy.UpdateCursor(fc)
for row in cursor:
[INDENT]row.HorizontalAlignment = row.HorzAlign2 # where HorzAlign2 is the place holder field[/INDENT]
[INDENT]row.VerticalAlignment = row.VertAlign2[/INDENT]
del row, cursor

Whereas, the same logic with the data access cursor does not:

cursor = arcpy.UpdateCursor(fc, ["HorizontalAlignment", "VerticalAlignment", "HorzAlign2", "VertAlign2"])
for row in cursor:
[INDENT]row[0]= row[2][/INDENT]
[INDENT]row[1] = row[3][/INDENT]
del row, cursor

The good news is that the data access cursor runs 3 times as fast. The bad news: though the values for each row are correct, they don't display correctly in ArcMap. For example, an annotation with HorizontalAlignment of LEFT will display with an alignment of CENTER, which is the default value. If I start an editing session and change the value from LEFT to CENTER, and then back to LEFT,, Then it displays correctly.

Any ideas?