This document is archived and information here might be outdated.  Recommended version.


ISketchTool Interface (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Editor)  

ISketchTool Interface

Provides access to members that control the main sketch tool.

Product Availability

Available with ArcGIS Desktop.

When To Use

Use ISketchTool when you want to set and get specific information about the sketch tool.

Members

Description
Method AddPoint Adds a point to the sketch.
Read-only property Anchor The anchor of the sketch.
Read/write property AngleConstraint The sketch's angular constraint.
Read/write property Constraint The sketch constraint.
Read/write property DistanceConstraint The sketch's distance constraint.
Read/write property IsStreaming Indicates whether stream mode digitizing is enabled.
Read-only property Location The current location of the mouse.

Remarks

The SketchTool object is the default sketch tool on the Editor toolbar. This sketch tool has its own context menu with commands such as Direction, Distance, and Parallel. Add your own custom commands or macros to the Sketch Tool context menu using the Customize dialog box.

Use ISketchTool when you want to set and get specific information about the Sketch tool. For example, when creating a custom Sketch tool menu item, you may need to get the Sketch tool�s current location or the edit sketch anchor point. For example, the Parallel command uses the Location property to find the feature on which the sketch tool was rightclicked before the command was selected.

[C#]

This sample shows how to set the angle constraint on the sketch tool. In a custom sketch tool the IApplication app is a field class and set using the hook parameter of the ICommand::OnCreate procedure.

private void SetAngleConstraint()
  {
    IEditor aEditor=app.FindExtensionByName("ESRI Object Editor") as IEditor;
    double dPi=Math.PI;
    IMxApplication mxApp=app as IMxApplication;
    
    ISketchTool sketchTool=app.CurrentTool.Command as ISketchTool;
    INumberDialog angleDialog=new NumberDialogClass();
    if (angleDialog.DoModal("AngleConstraint", 0, 4, aEditor.Display.hWnd))
    {
      sketchTool.AngleConstraint=angleDialog.Value * dPi / 180;
      sketchTool.Constraint=esriSketchConstraint.esriConstraintAngle;
    }
  }

See Also

IPoint Interface | IEditSketch Interface | IEditProperties Interface | IEditAttributeProperties Interface