Problem with Z snapping

722
0
08-17-2016 05:54 AM
viktorknajbel
New Contributor

Hi,

I am implementing own extension for Z snapping.

I have followed an example on arcgis site: http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#fa9c9ab8-05d4-4fbd-8e39-14ce1f7cab3f...

My problem is, the Z snapping is not working on another PCs.

It only works on my machine. And I noticed, when I change pixels to map units in snapping tolerance or I set properties SnapZTolerance and UseSnapZTolerance=true, it stop working on my PC too.

I also tested Z Management Toolbar, but it is not working.

http://www.arcgis.com/home/item.html?id=bb2ca737ef7f43d1a02a503c7966059d

Thanks for any advice.

My system:

Windows 8.1 Pro SK

ArcGIS 10.4 for Desktop

ArcGIS 10.4 for Desktop Runtime Error R6034 Patch

ArcGIS 10.4 for Desktop ModelBuilder Regional Language Display Patch

ArcObjects SDK for the Microsoft .NET Framework 10.4.5524

Visual Studio 2013

Example code:

private void EnableZSnapping(IEditor editor)
{
    ISnapEnvironment3 snapEnvironment = (ISnapEnvironment3)editor;

    for (int i = snapEnvironment.SnapAgentCount - 1; i >= 0; i--)
    {
        ISnapAgent snapAgent = snapEnvironment.get_SnapAgent(i);
        var featureSnapAgent = snapAgent as IFeatureSnapAgent2;

        if (featureSnapAgent == null)
        {
            continue;
        }

        featureSnapAgent.HitType = ESRI.ArcGIS.Geometry.esriGeometryHitPartType.esriGeometryPartBoundary
            | ESRI.ArcGIS.Geometry.esriGeometryHitPartType.esriGeometryPartVertex
            | ESRI.ArcGIS.Geometry.esriGeometryHitPartType.esriGeometryPartEndpoint
            | ESRI.ArcGIS.Geometry.esriGeometryHitPartType.esriGeometryPartMidpoint;

        IFeatureClass featureClass = featureSnapAgent.FeatureClass;
        IGeometryDef geometryDef = GetGeometryDef(featureClass);
        if ((geometryDef != null) && geometryDef.HasZ)
        {
            featureSnapAgent.ZSnappingEnabled = true;
        }
    }
}

0 Kudos
0 Replies