ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Snapping Class / GetOptions Method
Example

In This Topic
    GetOptions Method
    In This Topic
    Gets the snapping options for the specified map. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public static SnappingOptions GetOptions( 
       Map map
    )
    Public Shared Function GetOptions( _
       ByVal map As Map _
    ) As SnappingOptions

    Parameters

    map

    Return Value

    The snapping options, or null if something went wrong trying to read the CIM snapping options
    Exceptions
    ExceptionDescription
    if map is null
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    Snapping options are stored within the CIM.
    Example
    var options = Snapping.GetOptions(map); // obtains a local copy of the options
    options.IsZToleranceEnabled = true; // change the IsZToleranceEnabled property within the local copy
    Snapping.SetOptions(map, options); //commits the local copy into the project
    Snap Options
    //Set snapping options via get/set options
    var snapOptions = ArcGIS.Desktop.Mapping.Snapping.GetOptions(myMap);
    //At 2.x - snapOptions.SnapToSketchEnabled = true;
    snapOptions.IsSnapToSketchEnabled = true;
    snapOptions.XYTolerance = 100;
    //At 2.x - snapOptions.ZToleranceEnabled = true;
    snapOptions.IsZToleranceEnabled = true;
    snapOptions.ZTolerance = 0.6;
    
    //turn on snap tip display parts
    snapOptions.SnapTipDisplayParts = (int)SnapTipDisplayPart.SnapTipDisplayLayer + (int)SnapTipDisplayPart.SnapTipDisplayType;
    
    //turn off all snaptips
    //snapOptions.SnapTipDisplayParts = (int)SnapTipDisplayPart.SnapTipDisplayNone;
    
    //turn on layer display only
    //snapOptions.SnapTipDisplayParts = (int)SnapTipDisplayPart.SnapTipDisplayLayer;
    
    //At 2.x - snapOptions.GeometricFeedbackColor = ColorFactory.Instance.RedRGB;
    snapOptions.SnapTipColor = ColorFactory.Instance.RedRGB;
    
    ArcGIS.Desktop.Mapping.Snapping.SetOptions(myMap, snapOptions);
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also