Using NamedTraceConfiguration in Pro SDK CoreHost (Headless) Application with a Utility Network

612
0
12-04-2023 03:48 PM
DrewNemecekIp
New Contributor II

 

I created named trace configurations in our utility network service from ArcGIS Pro. I can use them successfully in Pro, but when I attempt to use them from a Pro SDK CoreHost app, they don’t work.

The named trace configuration object is retrieved, and I can see its settings during runtime, and then I can create a tracer with it, and then I can plug the NTC into a trace argument, and I can see its settings as part of the trace argument, but when I plug that trace argument into the tracer I created with the NTC, and then run the trace, I get an empty result.

This is the approach I am using to retrieve the NTC, create a tracer with it, and then run the trace in code:

 

private 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);
  }
}

 

This approach is not working in my CoreHost application.

Help? Suggestions?

 

 

0 Kudos
0 Replies