0

I have annotations feature class and need to update some field offset and alignment values

When I edits them manually at attributes table in ArcMap, new values applies to objects and they changes thrir positions at map.

And when I updates them via script:

with arcpy.da.UpdateCursor(annotations_fc, ['VerticalAlignment', 'YOffset']) as cursor:
    for row in cursor:
        row[0] = 3
        row[1] = 2.0
        cursor.updateRow(row)

del cursor

attributes table has new values but these values doesn't apply to map objects

Arcpy has UpdateAnnotation_management method for annotations updating. But as I understand, it updates field values from annotation objects when I needs reverse action - update annotation objects from fields values.

Is such method exist? If not in arcpy, at least in arcobjects.net?

Or am I doing something wrong?

0

Perhaps it's an arcpy bug - arcobjects.net code processes annotaton features perfectly.

IFeatureCursor cursor = featureClass.Update(null, false);

int vAlignField = featureClass.Fields.FindField("VerticalAlignment");
int yOffsetField = featureClass.Fields.FindField("YOffset");

IFeature feature = cursor.NextFeature();
while (feature != null)
{
    IPolygon4 poly = (IPolygon4)feature.Shape;
    IRing ring = new RingClass();
    poly.QueryExteriorRings(ref ring);
    feature.Value[vAlignField] = 3;
    feature.Value[yOffsetField] = 2.0;
    feature.Store();
    feature = cursor.NextFeature();
}

Annotation objects are shifted after code running as I expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.