ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Data.NetworkDiagrams Namespace / NetworkDiagram Class / SaveLayout Method
The NetworkDiagramSubset of the geometries to save.
Indicates whether the vertices are kept when reconnecting the edges.
Example

In This Topic
    SaveLayout Method
    In This Topic
    Saves the layout of diagram elements. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void SaveLayout( 
       NetworkDiagramSubset subset,
       bool keepVertices
    )
    Public Sub SaveLayout( _
       ByVal subset As NetworkDiagramSubset, _
       ByVal keepVertices As Boolean _
    ) 

    Parameters

    subset
    The NetworkDiagramSubset of the geometries to save.
    keepVertices
    Indicates whether the vertices are kept when reconnecting the edges.
    Exceptions
    ExceptionDescription
    A geodatabase-related exception has occurred.
    Remarks
    Example
    Change the Layout of a Network Diagram
    public void DiagramElementQueryResultAndNetworkDiagramSubsetClasses(Geodatabase geodatabase, DiagramManager diagramManager, string diagramName)
    {
      // Retrieve a diagram
      using (NetworkDiagram diagramTest = diagramManager.GetNetworkDiagram(diagramName))
      {
        // Create a DiagramElementQueryByElementTypes query object to get the diagram elements we want to work with
        DiagramElementQueryByElementTypes query = new DiagramElementQueryByElementTypes();
        query.QueryDiagramJunctionElement = true;
        query.QueryDiagramEdgeElement = true;
        query.QueryDiagramContainerElement = true;
    
        // Retrieve those diagram elements
        DiagramElementQueryResult elements = diagramTest.QueryDiagramElements(query);
    
        // Create a NetworkDiagramSubset object to edit this set of diagram elements
        NetworkDiagramSubset subset = new NetworkDiagramSubset();
        subset.DiagramJunctionElements = elements.DiagramJunctionElements;
        subset.DiagramEdgeElements = elements.DiagramEdgeElements;
        subset.DiagramContainerElements = elements.DiagramContainerElements;
    
        // Edit the shapes of the diagram elements - left as an exercise for the student
        TranslateDiagramElements(subset);
    
        // Save the new layout of the diagram elements
        diagramTest.SaveLayout(subset, true);
      }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also