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


ISketchOperation Interface (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Editor > ESRI.ArcGIS.Editor > Interfaces > IS > ISketchOperation Interface
ArcGIS Developer Help

ISketchOperation Interface

Provides access to members that control undo/redo capabilities for edit sketch modifications.

Product Availability

Available with ArcGIS Desktop.

When To Use

Use sketch operations to provide undo and redo capabilities when making modifications to the edit sketch. For example, if you wanted to insert a new point in the middle of the edit sketch, create a sketch operation so the edit can be undone.

ISketchOperation derives from IOperation giving these additional methods: CanRedo, CanUndo, Do, Redo, Undo.

Members

Name Description
Read-only property CanRedo Indicates if the operation can be redone.
Read-only property CanUndo Indicates if the operation can be undone.
Method Do Performs the operation.
Method Finish Finishes the operation and puts it into the operation stack. Call this after the sketch has been modified.
Write-only property MenuString The text that appears in the undo menu choice.
Read-only property MenuString The menu string.
Method Redo Redoes the operation.
Method Start Starts the operation, caching the existing sketch. Call this before modifying the sketch.
Method Undo Undoes the operation.

Inherited Interfaces

Interfaces Description
IOperation Provides access to members that control Operations.

Classes that implement ISketchOperation

Classes Description
SketchOperation Provides undo/redo capabilities for edit sketch modifications.

Remarks

Sketch operations are very similar to Editor operations. First, call Start to flag the beginning of the Sketch operation. Use the MenuString property to give the operation a name. Perform the edits. Call Finish to complete the edit operation. Finish requires an envelope parameter that is used to invalidate/refresh the display.

[C#]

The follwing code can be used in the ICommand::OnClick method before the sketch operation.
The editor was declared as a class field and set in the OnCreate method.

...

    m_editor.StartOperation();
    ISketchOperation sketchOperation = new SketchOperationClass();
    sketchOperation.MenuString_2 = "specificSketchOperation";
    sketchOperation.Start(m_editor);

//do sketchOperation...

See Also

IEditor Interface | IEditAttributeProperties Interface | IEnvelope Interface | IOperation Interface

.NET Samples

Points along line construction tool ViperPin tool