1

I find a strange thing occasionally, I have a validate topology function developed by vb.net arcobjects. It work not properly. The case is:

  1. open arcmap
  2. start editing
  3. use my validate topology function, nothing happen, no error find (there really several errors)
  4. set the extent to global and use arcmap topology toolbar 'validate topology in current extent' tool to validate topology
  5. open error inspector and get errors list (4 errors)
  6. change the current extent and use arcmap topology toolbar 'validate topology in current extent' tool to validate topology
  7. open error inspector and get errors list (2 errors)
  8. remain the same extent as step 6, use validate topology function developed by vb.net arcobjects, all errors displayed in error inspector.

I want to know is it my code bug or operator issue?

My code:

    ' Step 1 - access a topology
Dim topoUiD As UID = New UIDClass
topoUiD.Value = "esriEditorExt.TopologyExtension"
Dim m_application As IApplication = My.ArcMap.Application
Dim topologyExt As ITopologyExtension = CType(m_application.FindExtensionByCLSID(topoUiD), ITopologyExtension)  'original code from esri
Dim topology As ITopology

topology = CType(topologyExt.CurrentTopology, ITopology)
MsgBox("successfully access current topology")

' Step 2 - Finding topology errors
Dim geoDS As IGeoDataset = CType(topology, IGeoDataset)
Dim errorContainer As IErrorFeatureContainer = CType(topology, IErrorFeatureContainer)
Dim eErrorFeat As IEnumTopologyErrorFeature
eErrorFeat = errorContainer.ErrorFeaturesByRuleType(geoDS.SpatialReference, esriTopologyRuleType.esriTRTLineCoveredByLineClass, Nothing, True, False)
Dim topoError As ITopologyErrorFeature

' check the eErrorFeat length to determine whether has error
topoError = eErrorFeat.Next

topologyExt.ClearActiveErrors(esriTEEventHint.esriTENone)     
topologyExt.DelayEvents(True)

Do While Not (topoError Is Nothing)
    MsgBox("Topology error exists!")
    topologyExt.AddActiveError(topoError, esriTEEventHint.esriTENone)
    topoError = eErrorFeat.Next
Loop

topologyExt.DelayEvents(False)

Another thing is if I am not in editing session and use validate topology tool developed by vb.net arcobjects, the map will crash.

  • Hello everyone, It is the topology issue. I delete the topology from arccatalog, and re-create it. It works properly. – ppLily Sep 9 '14 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.