ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Data.NetworkDiagrams Namespace / DiagramManager Class / CreateNetworkDiagram Method
The DiagramTemplate of the network diagram to create.
An enumerable containing the global IDs of the input geographic features.
Example

In This Topic
    CreateNetworkDiagram Method
    In This Topic
    Creates a NetworkDiagram based on a DiagramTemplate from a list of row GlobalIDs. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    diagramTemplate
    The DiagramTemplate of the network diagram to create.
    globalIDs
    An enumerable containing the global IDs of the input geographic features.

    Return Value

    Exceptions
    ExceptionDescription
    A geodatabase-related exception has occurred. For example, the globalIDs is invalid.
    This method or property must be called within the lambda passed to QueuedTask.Run
    Remarks
    This routine generates its own editing transaction, and therefore cannot be wrapped in a separate transaction. Because the editing performed by this routine cannot be undone, this routine can also not be called within an editing session. All edits in the current edit session must be saved or discarded before calling this routine.
    Example
    Create a Network Diagram
    public void CreateNetworkDiagram(UtilityNetwork utilityNetwork, IEnumerable<Guid> globalIDs)
    {
      using (DiagramManager diagramManager = utilityNetwork.GetDiagramManager())
      {
        // get the template
        DiagramTemplate template = diagramManager.GetDiagramTemplate(templateName);
    
        // create the diagram
        NetworkDiagram diagram = diagramManager.CreateNetworkDiagram(template, globalIDs);
      }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also