atomaly

snapping in custom tools (ArcGIS Engine C#.net)

Discussion created by atomaly on Sep 26, 2012
Latest reply on Oct 1, 2012 by atomaly
Hi,
I'm kindof new to ArcObjects development but i'm working in the ArcGIS Engine environment (C#.net) and
trying to create a custom tool with snapping. currently having a problem getting the snapping extension..

in the documentation it says to use IHookHelper2    -> however I don't seem to be able to CAST the hook into the IHookHelper2..
comes back with a null...

m_hookHelper2 = (IHookHelper2)hook;   <- does not work...

I also tried to get the IApplication / mapDocument from the hook... which also did not work :(


(this is the documentation code..... need to know where / how to get the m_hookHelper2)

[C#]
IExtensionManager extensionManager = m_hookHelper2.ExtensionManager;
if (extensionManager != null)
{
    UID guid = new UIDClass();
    guid.Value = "{E07B4C52-C894-4558-B8D4-D4050018D1DA}"; //Snapping extension.
    IExtension extension = extensionManager.FindExtension(guid);
    m_SnappingEnvironment = extension as ISnappingEnvironment;
}

Outcomes