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() Else m_csc = New StraightConstructorClass() End If m_csc.Initialize(m_editor) m_edSketch.ShapeConstructor = m_csc m_csc.Activate() 'set the current task to null m_editor.CurrentTask = Nothing End Sub
Bob,
Any luck with this?
Its a little late, but here's the methodology.
Your project will have two classes.
The first class is the annotation constructor which implements IAnnotationConstructor and is registered in the AnnotationConstructors component category. The implementation of this class hasn't changed from ArcGIS 9 to 10, it just doesn't show up anywhere on the UI at 10.
The second class is the tool that provides the sketch and sets the annotation constructor. This is a regular feature construction tool that you can create with the new item wizard. This needs to be registered in the FeatureConstructionAnnotationTools component category. This appears as an annotation construction tool in the UI.
The following code snippet (back when VB was cool) shows a sketch tool using the point shape constructor feeding sketch points to a custom anno constructor.
Public Overrides Sub OnClick() Try m_edSketch = TryCast(m_editor, IEditSketch3) m_csc = New PointConstructorClass() m_csc.Initialize(m_editor) m_edSketch.ShapeConstructor = m_csc m_csc.Activate() 'Set the custom anno constructor Dim pID As New UIDClass() pID.Value = "esriEditor.AnnotationEditExtension" Dim AnnonEditExt As IAnnotationEditExtension = m_editor.FindExtension(pID) Dim AnnoConstructs As IEnumAnnotationConstructor = AnnonEditExt.AnnotationConstructors Dim rach As IAnnotationConstructor = AnnoConstructs.Next Do Until rach Is Nothing If rach.Name = "Curved (Custom)" Then AnnonEditExt.CurrentConstructor = rach rach = AnnoConstructs.Next Loop 'Show annotation construction window pID.Value = "esriEditor.AnnotationConstructionWindow" Dim annoConWindow As IAnnotationConstructionWindow = m_editor.FindExtension(pID) annoConWindow.Visible = True
The rest of the tool is stock from the wizard.