ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data.UtilityNetwork Namespace / UtilityNetworkDefinition Class / GetNetworkAttribute Method
The name of the NetworkAttribute to return.
Example

In This Topic
    GetNetworkAttribute Method
    In This Topic
    Gets a NetworkAttribute object with the specified name. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function GetNetworkAttribute( _
       ByVal networkAttributeName As String _
    ) As NetworkAttribute
    public NetworkAttribute GetNetworkAttribute( 
       string networkAttributeName
    )

    Parameters

    networkAttributeName
    The name of the NetworkAttribute to return.

    Return Value

    The NetworkAttribute that corresponds to networkAttributeName.
    Exceptions
    ExceptionDescription

    networkAttributeName is null or an empty string.

    -or-

    There is no NetworkAttribute that corresponds to networkAttributeName.

    A geodatabase-related exception has occurred.
    This method or property must be called within the lambda passed to QueuedTask.Run
    Remarks
    The string comparison used to find the name is case-insensitive.
    Example
    Create a Condition to compare a Network Attribute against a set of values
    {
      static void CreateNetworkAttributeComparison(UtilityNetworkDefinition utilityNetworkDefinition, TraceConfiguration traceConfiguration)
      {
        // This routine creates a NetworkAttributeComparison to compare the Lifecycle network attribute against two values: "In Design" and "In Service"
    
        const int InDesign = 4;
        const int InService = 8;
    
        // Create a NetworkAttribute object for the Lifecycle network attribute from the UtilityNetworkDefinition
        using NetworkAttribute lifecycleNetworkAttribute = utilityNetworkDefinition.GetNetworkAttribute("Lifecycle");
        // Create a NetworkAttributeComparison that stops traversal if Lifecycle <> "In Design" (represented by the constant InDesign)
        NetworkAttributeComparison inDesignNetworkAttributeComparison =
          new NetworkAttributeComparison(lifecycleNetworkAttribute, Operator.NotEqual, InDesign);
    
        // Create a NetworkAttributeComparison to stop traversal if Lifecycle <> "In Service" (represented by the constant InService)
        NetworkAttributeComparison inServiceNetworkAttributeComparison =
          new NetworkAttributeComparison(lifecycleNetworkAttribute, Operator.NotEqual, InService);
    
        // Combine these two comparisons together with "And"
        And lifecycleFilter = new And(inDesignNetworkAttributeComparison, inServiceNetworkAttributeComparison);
    
        // Final condition stops traversal if Lifecycle <> "In Design" and Lifecycle <> "In Service"
        traceConfiguration.Traversability.Barriers = lifecycleFilter;
      }
    }
    Create a Function
    {
      // This routine creates an Add function to sum the Load network attribute during a trace
      static void ApplyFunction(UtilityNetworkDefinition utilityNetworkDefinition, TraceConfiguration traceConfiguration)
      {
        // Get a NetworkAttribute object for the Load network attribute from the UtilityNetworkDefinition
        using NetworkAttribute loadNetworkAttribute = utilityNetworkDefinition.GetNetworkAttribute("Load");
        // Create a function to sum the Load
        Add sumLoadFunction = new Add(loadNetworkAttribute);
    
        // Add this function to our trace configuration
        traceConfiguration.Functions = new List<Function>() { sumLoadFunction };
      }
    }
    Create a FunctionBarrier
    {
      // This routine creates a FunctionBarrier that stops traversal when the total shape length exceeds 1000 feet
      static void CreateFunctionBarrier(UtilityNetworkDefinition utilityNetworkDefinition, TraceConfiguration traceConfiguration)
      {
        // Create a NetworkAttribute object for the Shape length network attribute from the UtilityNetworkDefinition
        using NetworkAttribute shapeLengthNetworkAttribute = utilityNetworkDefinition.GetNetworkAttribute("Shape length");
        // Create a function that adds up shape length
        Add lengthFunction = new Add(shapeLengthNetworkAttribute);
    
        // Create a function barrier that stops traversal after 1000 feet
        FunctionBarrier distanceBarrier = new FunctionBarrier(lengthFunction, Operator.GreaterThan, 1000.0);
    
        // Set this function barrier
        traceConfiguration.Traversability.FunctionBarriers = new List<FunctionBarrier>() { distanceBarrier };
      }
    }
    Create a Propagator
    {
      // This routine creates a Propagator to propagate the Phases Normal network attribute downstream during a trace
      static void CreatePropagator(UtilityNetworkDefinition utilityNetworkDefinition, TraceConfiguration traceConfiguration)
      {
        const int ABCPhase = 7;
        // Get a NetworkAttribute object for the Phases Normal attribute from the UtilityNetworkDefinition
        using NetworkAttribute normalPhaseAttribute = utilityNetworkDefinition.GetNetworkAttribute("Phases Normal");
        // Create a propagator to propagate the Phases Normal attribute downstream from the source, using a Bitwise And function
        // Allow traversal to continue as long as the Phases Normal value includes any of the ABC phases
        // (represented by the constant ABCPhase)
        Propagator phasePropagator = new Propagator(normalPhaseAttribute, PropagatorFunction.BitwiseAnd,
          Operator.IncludesAny, ABCPhase);
    
        // Assign this propagator to our trace configuration
        traceConfiguration.Propagators = new List<Propagator>() { phasePropagator };
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also