ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data.NetworkDiagrams Namespace / NetworkDiagram Class / GetDiagramInfo Method
Example

In This Topic
    GetDiagramInfo Method
    In This Topic
    Get NetworkDiagramInfo from the network diagram. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function GetDiagramInfo() As NetworkDiagramInfo
    public NetworkDiagramInfo GetDiagramInfo()

    Return Value

    The NetworkDiagramInfo of the network diagram.
    Exceptions
    ExceptionDescription
    A geodatabase-related exception has occurred.
    Example
    Get a list of Network Diagrams with inconsistent ConsistencyState
    {
      static List<NetworkDiagram> GetInconsistentDiagrams(UtilityNetwork utilityNetwork)
      {
        // Get the DiagramManager from the utility network
        using (DiagramManager diagramManager = utilityNetwork.GetDiagramManager())
        {
          List<NetworkDiagram> networkDiagrams = 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)
            {
              networkDiagrams.Add(diagram);
            }
            else
            {
              diagram.Dispose(); // If we are not returning it we need to Dispose it
            }
          }
    
          return networkDiagrams;
        }
      }
    }
    Editing Network Diagram
    {
      // Various editing operations on a network diagram
      static void EditDiagram(NetworkDiagram diagram, List<Guid> globalIDs)
      {
        // These routines generate their own editing transaction, and therefore cannot be wrapped
        // in a separate transaction. Because the editing performed by these routines cannot
        // be undone, thise routines can also not be called within an editing session. All
        // edits in the current edit session must be saved or discarded before calling these
        // routines.
    
        // Refresh the diagram - synchronizes it based on the latest network topology
        diagram.Update();
    
        // Append features to the diagram
        diagram.Append(globalIDs);
    
        // Overwrite the diagram with a set of features
        diagram.Overwrite(globalIDs);
    
        NetworkDiagramInfo info = diagram.GetDiagramInfo();
        if (info.CanExtend)
        {
          diagram.Extend(NetworkDiagramExtendType.ExtendByContainment);
    
          // or extend for only a set of utility network globalIDs
          diagram.Extend(NetworkDiagramExtendType.ExtendByContainment, globalIDs);
        }
        // Delete a diagram
        diagram.Delete();
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also