ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Data.NetworkDiagrams Namespace / DiagramTemplate Class / GetNetworkDiagrams Method
Example

In This Topic
    GetNetworkDiagrams Method (DiagramTemplate)
    In This Topic
    Gets the list of NetworkDiagrams based on this diagram template. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public IReadOnlyList<NetworkDiagram> GetNetworkDiagrams()
    Public Function GetNetworkDiagrams() As IReadOnlyList(Of NetworkDiagram)

    Return Value

    The list of NetworkDiagrams associated with this diagram template.
    Exceptions
    ExceptionDescription
    A geodatabase-related exception has occurred.
    This method or property must be called within the lambda passed to QueuedTask.Run
    Example
    Get Network Diagrams from a Diagram Template
    public void GetNetworkDiagramFromDiagramTemplates(UtilityNetwork utilityNetwork)
    {
      using (DiagramManager diagramManager = utilityNetwork.GetDiagramManager())
      {
        // get the first templates
        DiagramTemplate template = diagramManager.GetDiagramTemplates().FirstOrDefault();
    
        // get the network diagrams fromt he template
        IEnumerable<NetworkDiagram> diagrams = template.GetNetworkDiagrams();
    
        // or get a network diagram by name
        NetworkDiagram diagram = template.GetNetworkDiagram(diagrameName);
      }
    }
    Get Network Diagram Information as JSON string
    public void GetDiagramContent(UtilityNetwork utilityNetwork)
    {
      using (DiagramManager diagramManager = utilityNetwork.GetDiagramManager())
      {
        // get a diagram by name
        NetworkDiagram diagram = diagramManager.GetNetworkDiagram(templateName);
    
        string json_content = diagram.GetContent(true, true, true, true);
      }
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also