English

How To: Change the edit sketch symbols

Summary

The edit sketch is used in ArcMap when sketching new features or editing existing ones. By default, the edit sketch is a green line with green vertices. The appearance of the sketch may need to be changed to make it easier to see, such as when tracing features over a dark raster image. This article provides Visual Basic for Applications (VBA) code to change the symbols used in the edit sketch.

Procedure

Instructions provided show the code and steps for changing the edit sketch line and the sketch vertex symbols.

  1. Start ArcMap.
  2. Open the Visual Basic Editor.

    In ArcMap, select Tools > Macros > Visual Basic Editor.

  3. In the Project Explorer window, expand Project, expand ArcMap Objects. Right-click ThisDocument, and click View Code.
    [O-Image] Visual Basic Project  Explorer

    Note:
    To store the code in all the map documents, open the Normal.mxt ThisDocument code module instead.

  4. Copy and paste the following code into the code module:

    Code:
    Private Sub ChangeSketchSymbol()

    'Get a reference to the Editor extension
    Dim pEditor As IEditor
    Dim pID As New UID
    pID = "esriEditor.Editor"
    Set pEditor = Application.FindExtensionByCLSID(pID)
    Dim pEditProperties As IEditProperties
    Set pEditProperties = pEditor

    'Declare and set up the sketch line symbol
    Dim pLineSym As ILineSymbol
    Dim pLineColor As IRgbColor
    Set pLineSym = pEditProperties.SketchSymbol

    'Set up the sketch line color. The default is Red=0, Green=128, Blue=0.
    Set pLineColor = New RgbColor
    pLineColor.RGB = RGB(0, 128, 0) 'Enter new RGB values to change the sketch line color

    'Set up the sketch line symbol properties
    Set pLineSym = New SimpleLineSymbol
    With pLineSym
    .Color = pLineColor
    .Width = 1 'Enter a new value to change the sketch line width
    End With

    Set pEditProperties.SketchSymbol = pLineSym

    'Declare and set up the sketch vertex symbol
    Dim pVertexSym As ISimpleMarkerSymbol
    Dim pVertexColor As IRgbColor

    'Set up the sketch vertex color. The default is Red=0, Green=128, Blue=0.
    Set pVertexColor = New RgbColor
    pVertexColor.RGB = RGB(0, 128, 0) 'Enter new RGB values to change the sketch vertex color

    'Set up the sketch vertex symbol properties
    Set pVertexSym = New SimpleMarkerSymbol
    With pVertexSym
    .Color = pVertexColor
    .Style = esriSMSSquare 'Enter a new style to change the sketch vertex shape.
    .size = 4 'Enter a new value to change the sketch vertex size
    End With

    Set pEditProperties.SketchVertexSymbol = pVertexSym

    End Sub

  5. Run the code.

    A. Click Tools > Macros > Macros to display the Macros dialog box.
    B. Select a macro and click Run.

  6. By editing the code, the sketch line color and width, the sketch vertex color, style (shape), and size can be changed. The code comments provide instructions on which values to update. For example, to set a different color for the sketch line, enter the color's RGB values; setting pLineColor.RGB = RGB(255, 0, 0) makes the sketch line bright red. If any modifications are made, run the code again. Close the Visual Basic Editor when done.
  7. To return the sketch symbols to their defaults, run the original code from this article again.