<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Create New Feature Linked Annotation in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/create-new-feature-linked-annotation/m-p/307254#M8000</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a Feature Linked Annotation class with 3 subtypes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I need is, for each selected feature in the linked class, to create the corresponding annotation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My code now works for almost everything, except two things:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, what is the right geometry to pass to the ISymbolCollectionElement?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What i need is to be able to completely automate the "Annotate Selected Features" command from ArcMap, only on specific subtypes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My code (with only the important pieces) is below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
//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();

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Nov 2013 12:17:48 GMT</pubDate>
    <dc:creator>FrancescoGiovinazzo</dc:creator>
    <dc:date>2013-11-04T12:17:48Z</dc:date>
    <item>
      <title>Create New Feature Linked Annotation</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/create-new-feature-linked-annotation/m-p/307254#M8000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a Feature Linked Annotation class with 3 subtypes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I need is, for each selected feature in the linked class, to create the corresponding annotation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My code now works for almost everything, except two things:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, what is the right geometry to pass to the ISymbolCollectionElement?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What i need is to be able to completely automate the "Annotate Selected Features" command from ArcMap, only on specific subtypes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My code (with only the important pieces) is below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
//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();

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Nov 2013 12:17:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/create-new-feature-linked-annotation/m-p/307254#M8000</guid>
      <dc:creator>FrancescoGiovinazzo</dc:creator>
      <dc:date>2013-11-04T12:17:48Z</dc:date>
    </item>
  </channel>
</rss>

