AnsweredAssumed Answered

ArcObjects (C#.Net) - How to copy and move Annotation Feature with ITransform2D?

Question asked by mik1971 on Aug 15, 2019
Latest reply on Jan 7, 2020 by mik1971

We need to copy an annotation feature (not feature linked) and move 10 metres.

Two issues:

  • A new annotation is drawn behind old one
  • A new annotation is not moved

 

IFeatureClass pFeatCls = pSourceAnnotationFeature.Class as IFeatureClass;
IFeature pNewAnnoFeature = pFeatCls.CreateFeature();
CopyAttributes(pSourceAnnotationFeature, ref pNewAnnoFeature);

IClone pCloneGeometry = (IClone)pSourceAnnotationFeature.Shape;
IGeometry pShapeCopyGeometry = (IGeometry)pCloneGeometry.Clone();
ITransform2D pTransform2D = pShapeCopyGeometry as ITransform2D;
pTransform2D.Move( 10, 0);
pNewAnnoFeature.Shape = pShapeCopyGeometry;
(pNewAnnoFeature as IAnnotationFeature).Annotation.Geometry = pShapeCopyGeometry;
pNewAnnoFeature.Store();

ArcMap.Document.ActiveView.Refresh();

Outcomes