ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data.UtilityNetwork.Trace Namespace / TraceArgument Class / TraceArgument Constructor / TraceArgument Constructor(IEnumerable<Element>)
A set of starting locations from which to originate the trace.
Example

In This Topic
    TraceArgument Constructor(IEnumerable<Element>)
    In This Topic
    Initializes a new instance of the TraceArgument class using startingLocations.
    Syntax

    Parameters

    startingLocations
    A set of starting locations from which to originate the trace.
    Exceptions
    Example
    Create a Trace Argument
    {
      // This routine creates a TraceArgument object and assigns a TraceConfiguration to it
      static void CreateTraceArgument()
      {
        IReadOnlyList<Element> startingPointList = new List<Element>();
    
        // Code to fill in list of starting points goes here...
        TraceArgument traceArgument = new TraceArgument(startingPointList);
    
        TraceConfiguration traceConfiguration = new TraceConfiguration();
    
        // Code to fill in trace configuration goes here...
        traceArgument.Configuration = traceConfiguration;
      }
    }
    Trace a utility network with the digitized direction
    {
      // This routine demonstrates how to perform a trace using the digitized direction of features
      static void TraceWithDigitizedDirection(UtilityNetwork utilityNetwork, Element startElement)
      {
        using TraceManager traceManager = utilityNetwork.GetTraceManager();
    
        // Trace configuration with digitized direction
        TraceConfiguration traceConfiguration = new TraceConfiguration()
        {
          IncludeIsolatedFeatures = true,
          IncludeBarriersWithResults = true,
          UseDigitizedDirection = true
        };
    
        // Trace argument
        List<Element> startElements = new List<Element> { startElement };
    
        TraceArgument traceArgument = new TraceArgument(startElements);
        traceArgument.Configuration = traceConfiguration;
    
        // Results
        DownstreamTracer downstreamTracer = traceManager.GetTracer<DownstreamTracer>();
    
        IReadOnlyList<Result> traceResults = downstreamTracer.Trace(traceArgument);
        foreach (Result traceResult in traceResults)
        {
          // Iterate trace results
        }
      }
    }
    Trace a utility network using a named trace configuration
    {
      // This routine demonstrates how to perform a trace using a named trace configuration from a utility network
      static void TraceUtilityNetworkUsingNamedTraceConfiguration(UtilityNetwork utilityNetwork, NamedTraceConfiguration namedTraceConfiguration, Element startElement)
      {
        // Get the trace manager from the utility network
        using (TraceManager traceManager = utilityNetwork.GetTraceManager())
        {
          // Get a tracer from the trace manager using the named trace configuration
          Tracer upstreamTracer = traceManager.GetTracer(namedTraceConfiguration);
    
          // Trace argument holding the trace input parameters
          TraceArgument upstreamTraceArgument = new TraceArgument(namedTraceConfiguration, new List<Element> { startElement });
    
          // Trace results
          IReadOnlyList<Result> upstreamTraceResults = upstreamTracer.Trace(upstreamTraceArgument);
        }
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also