ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Data.NetworkDiagrams Namespace / NetworkDiagram Class / GetConsistencyState Method
Example

In This Topic
    GetConsistencyState Method
    In This Topic
    Gets the NetworkDiagramConsistencyState of the network diagram. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public NetworkDiagramConsistencyState GetConsistencyState()
    Public Function GetConsistencyState() As NetworkDiagramConsistencyState

    Return Value

    The NetworkDiagramConsistencyState of the network diagram.
    Exceptions
    ExceptionDescription
    A geodatabase-related exception has occurred.
    Example
    Get a list of Network Diagrams with inconsistent ConsistencyState
    public List<NetworkDiagram> GetInconsistentDiagrams(UtilityNetwork utilityNetwork)
    {
      // Get the DiagramManager from the utility network
    
      using (DiagramManager diagramManager = utilityNetwork.GetDiagramManager())
      {
        List<NetworkDiagram> myList = new List<NetworkDiagram>();
    
        // Loop through the network diagrams in the diagram manager
    
        foreach (NetworkDiagram diagram in diagramManager.GetNetworkDiagrams())
        {
          NetworkDiagramInfo diagramInfo = diagram.GetDiagramInfo();
    
          // If the diagram is not a system diagram and is in an inconsistent state, add it to our list
    
          if (!diagramInfo.IsSystem && diagram.GetConsistencyState() != NetworkDiagramConsistencyState.DiagramIsConsistent)
          {
            myList.Add(diagram);
          }
          else
          {
            diagram.Dispose(); // If we are not returning it we need to Dispose it
          }
        }
    
        return myList;
      }
    }
    Get Diagram from DiagramLayer
    public void GetDiagram(DiagramLayer diagramLayer)
    {
      // note - methods need to run on MCT
    
      NetworkDiagram diagram = diagramLayer.GetNetworkDiagram();
    
      // get the consistency state from the layer
      DiagramLayerConsistencyState dlState = diagramLayer.ConsistencyState;
    
      // or from the diagram
      NetworkDiagramConsistencyState ndState = diagram.GetConsistencyState();
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also