Hello,I have a Feature Linked Annotation class with 3 subtypes.What I need is, for each selected feature in the linked class, to create the corresponding annotation.My code now works for almost everything, except two things:When I set the SharedSymbol on each single created ISymbolCollectionElement, some attributes are not passed, like flip angle or the positioning, and I see non flipped annotations as a result;The second problem is, if i try to annotate the features from ArcMap (selection, right click, annotate selected features), the third subtype creates annotations wich are flipped and with an offset, if I debug the code, i see that the symbol loaded from the SymbolCollection does not have the same properties ad because of that, even if the problem 1 was solved, the annotation will be in the wrong place.I have searched everywhere on Google but I cannot find the right workflow to create new feature linked annotations, someone can point me in the right direction please?Also, what is the right geometry to pass to the ISymbolCollectionElement?What i need is to be able to completely automate the "Annotate Selected Features" command from ArcMap, only on specific subtypes.My code (with only the important pieces) is below:
//get the parser and the symbol
ISymbolIdentifier pIdentifier = null;
IAnnotationExpressionParser pAnnoParser = GetAnnoParser(pAnnoFClass.Extension as IAnnoClass, subtypeName, subtypeID, out pIdentifier);
IFeature pNewFeature = pAnnoFClass.CreateFeature();
IAnnotationFeature2 pAnnoFeature = pNewFeature as IAnnotationFeature2;
//link to the original feature
pAnnoFeature.LinkedFeatureID = pInterruttore.OID;
pAnnoFeature.Status = esriAnnotationStatus.esriAnnoStatusPlaced;
//subtype of the annotation
pAnnoFeature.AnnotationClassID = subtypeID;
//new element
ISymbolCollectionElement sce = new TextElementClass() as ISymbolCollectionElement;
sce.Geometry = pInterruttore.ShapeCopy;
sce.Text = GetAnnotationString(pAnnoParser, pInterruttore);
sce.set_SharedSymbol(pIdentifier.ID, pIdentifier.Symbol); // pIdentifier.Symbol have Angle set, but resulting "sce" does not
pAnnoFeature.Annotation = sce as IElement;
pNewFeature.Store();