How to wire custom Annotation Constructor to a Tool in ArcMap 10?

Discussion created by fjubb on Mar 13, 2011
Latest reply on Sep 2, 2015 by sean_jones-esristaff
I have a custom annotation constructor that I need to implement in ArcMap's editing environment and I can't figure out how.

In previous versions, you simply registered the constructor in the proper category and then you could select it on the Annotation Toolbar. Now in ArcGIS 10, with the Annotation Toolbar gone, it appears that you have to create a custom tool to register  with the FeatureConstructionAnnotationTools CATIDs, and have the tool work with the anno constructor...right?

Well, I've created the tool and registered it, and sure enough it appears as a construction tool when editing an anno layer. I have my annotation constructor, which I've been using for years, but how do you assign the annotation constructor to the editor using the tool? How do you 'turn it on'?

I've read a bunch about custom shape constructors and how they're activated by assigning them to the editsketch (see the code below for the PointAlongLine ESRI sample)....but how do you accomplish that with an anno constructor (which is not a coclass of the shape constructor)?

Can anyone point me towards any code, a sample, ANYTHING that indicates how you "activate/fire up/turn on" an annotation constructor to begin placing anno?

Thanks everyone!

Bob J.
Indianapolis, IN

Public Overrides Sub OnClick()
    Private m_csc As IShapeConstructor
    m_edSketch = TryCast(m_editor, IEditSketch3)

    'Restrict to line constructors (for this tool)
    m_edSketch.GeometryType = esriGeometryType.esriGeometryPolyline

    'Activate a shape constructor based on the current sketch geometry
    If m_edSketch.GeometryType = esriGeometryType.esriGeometryPoint Then
      m_csc = New PointConstructorClass()
      m_csc = New StraightConstructorClass()
    End If
    m_edSketch.ShapeConstructor = m_csc

    'set the current task to null
    m_editor.CurrentTask = Nothing
End Sub