Excluding layers from snapping

Discussion created by Cammarere0 on Sep 9, 2011
Latest reply on May 21, 2014 by sean_jones-esristaff
I'm working with ArcObjects in C#, and am trying to exclude all map layers but one (the only one I want to snap to) from the snapping environment. I'm using the ISnappingEnvironment and IPointSnapper interfaces. I've put the following code in the OnClick method of the tool I'm using:

m_Snapper = m_SnappingEnvironment.PointSnapper;
ISet anExclLyrSet = new SetClass();
m_Snapper.ExcludedLayers(ref anExclLyrSet);
   ...loop through all map layers, adding all but the one of interest to anExclLyrSet

Basically, I'm getting poor snapping performance due to the presence of a basemap layer that contains multiple feature layers. If I turn that layer off (make invisible), the performance is good.

I've confirmed that all the layers (for composite type layers, I add each sub-layer to the exclusion as well) are being added to the exclusion set, but I can't seem to get the performance to improve without turning off that basemap layer. I'm not sure what I'm doing wrong - does the cache need to be cleared after each individual layer is excluded? I'd appreciate insights anyone might have regarding this. Thanks!

Mark C.