ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Data.NetworkDiagrams Namespace / NetworkDiagram Class / QueryDiagramElements Method / QueryDiagramElements(DiagramElementQueryByExtent) Method
The DiagramElementQueryByExtent used to search for diagram elements.
Example

In This Topic
    QueryDiagramElements(DiagramElementQueryByExtent) Method
    In This Topic
    Query diagram elements contained in this network diagram. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Overloads Function QueryDiagramElements( _
       ByVal query As DiagramElementQueryByExtent _
    ) As DiagramElementQueryResult

    Parameters

    query
    The DiagramElementQueryByExtent used to search for diagram elements.

    Return Value

    A DiagramElementQueryResult containing the queried diagram elements.
    Exceptions
    ExceptionDescription
    A geodatabase-related exception has occurred.
    Example
    Get Diagram Elements
    public void GetDiagramElements(MapView mapView, NetworkDiagram networkDiagram)
    {
      // Create a DiagramElementQueryByExtent to retrieve diagram element junctions whose extent
      // intersects the active map extent
    
      DiagramElementQueryByExtent elementQuery = new DiagramElementQueryByExtent();
      elementQuery.ExtentOfInterest = MapView.Active.Extent;
      elementQuery.AddContents = false;
      elementQuery.QueryDiagramJunctionElement = true;
      elementQuery.QueryDiagramEdgeElement = false;
      elementQuery.QueryDiagramContainerElement = false;
    
      // Use this DiagramElementQueryByExtent as an argument to the QueryDiagramElements method
      DiagramElementQueryResult result = networkDiagram.QueryDiagramElements(elementQuery);
    
      // get the container, junction, edge elements
      //    in this case result.DiagramJunctionElements and result.DiagramEdgeElements will be empty 
      //    since elementQuery.QueryDiagramEdgeElement and elementQuery.QueryDiagramContainerElement are set to false
      IReadOnlyList<DiagramContainerElement> containerElements = result.DiagramContainerElements;
    
      IReadOnlyList<DiagramJunctionElement> junctionElements = result.DiagramJunctionElements;
    
      IReadOnlyList<DiagramEdgeElement> edgeElements = result.DiagramEdgeElements;
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also