Add Rule (Utility Network)

Summary

Adds a rule to a utility network.

All rules created within a utility network are based on network classes at the asset group and asset type levels and can be used to control some behaviors in the utility network.

Usage

  • The network topology must be disabled.

  • The following requirements must be met when working with an enterprise geodatabase:

Syntax

arcpy.un.AddRule(in_utility_network, rule_type, from_class, from_assetgroup, from_assettype, to_class, to_assetgroup, to_assettype, {from_terminal}, {to_terminal}, {via_class}, {via_assetgroup}, {via_assettype}, {via_terminal})
ParameterExplanationData Type
in_utility_network

The utility network for which the rule will be added.

Utility Network; Utility Network Layer
rule_type

The type of rule to be created.

  • JUNCTION_JUNCTION_CONNECTIVITYCreates a junction-junction connectivity rule allowing two point features to connect via a connectivity association (features are offset geometrically).
  • CONTAINMENTCreates a containment rule where the from parameters are the container and the to parameters are the contents in a containment association.
  • STRUCTURAL_ATTACHMENTCreates a structural attachment rule where the from parameters are the structure features and the to parameters are the attachment features in a structural attachment association.
  • JUNCTION_EDGE_CONNECTIVITYCreates an edge-junction connectivity rule allowing edge and junction features to connect via geometric coincidence (features are at the same x,y,z location).
  • EDGE_JUNCTION_EDGE_CONNECTIVITYCreates an edge-junction-edge connectivity rule allowing a edge to connect to either side of a junction feature.
String
from_class

The from utility network feature class or table that will be included in the rule.

Structural attachment and containment association rules require that the container or structure feature be in this parameter.

Ordering is irrelevant for the junction-junction, junction-edge, and edge-junction-edge connectivity rules.

String
from_assetgroup

An asset group for the from_class to which the rule will apply.

String
from_assettype

An asset type for the from_class to which the rule will apply.

String
to_class

The to utility network feature class or table that will be included in the rule.

Structural attachment and containment associations rules require that the content or attachment feature be in this parameter.

Ordering is irrelevant for the junction-junction, junction-edge, and edge-junction-edge connectivity rules.

String
to_assetgroup

An asset group for the to_class to which the rule will apply.

String
to_assettype

Specifies an asset type for the to_class to which the rule will apply.

String
from_terminal
(Optional)

The from terminal to which the rule will apply. This will be a terminal in the from_class. When creating a connectivity rule for feature with terminals to connect to another feature, the terminal side to connect from must be specified, for example, the high-side terminal on a transformer.

This parameter is required if the asset type has terminals. It is ignored for structural attachment or containment rule types.

String
to_terminal
(Optional)

The to terminal to which the rule will apply. This will be a terminal in the to_class. When creating a connectivity rule for feature to connect to another feature with terminals, the terminal side to connect to must be specified, for example, the low-side terminal on a transformer.

This parameter is required if the asset type has terminals. It is ignored for structural attachment or containment rule types.

String
via_class
(Optional)

The junction utility network feature class or table to which the rule will apply. This parameter can be specified only for the EDGE_JUNCTION_EDGE_CONNECTIVITY rule_type, since three feature classes or tables are required to participate in edge-junction-edge connectivity.

String
via_assetgroup
(Optional)

An asset group of the via_class to which the rule will apply. This parameter can only be specified for the EDGE_JUNCTION_EDGE_CONNECTIVITY rule_type parameter value.

String
via_assettype
(Optional)

An asset type of the via_class to which the rule will apply. This parameter can only be specified for the EDGE_JUNCTION_EDGE_CONNECTIVITY rule_type parameter value.

String
via_terminal
(Optional)

The terminal from the via_class to which the rule will apply. This parameter can only be specified for the EDGE_JUNCTION_EDGE_CONNECTIVITY rule_type parameter value.

String

Derived Output

NameExplanationData Type
out_utility_network

The updated utility network.

Utility Network

Code sample

AddRule example 1 (Python window)

This sample creates a junction-junction connectivity association rule to allow the load side of circuit breakers to connect to the high side of transformers in an electric distribution network.

import arcpy
arcpy.AddRule_un("Distribution Network", "JUNCTION_JUNCTION_CONNECTIVITY", 
                 "ElectricDistributionDevice", "CircuitBreaker", "Air powered", 
                 "ElectricDistributionLine", "Transformer", "High")
AddRule example 2 (Python window)

This sample creates a junction-edge connectivity rule to allow the load side of circuit breakers to connect to medium-voltage lines in an electric distribution network.

import arcpy
arcpy.AddRule_un("Utility Network", "JUNCTION_EDGE_CONNECTIVITY", 
                 "ElectricDistributionDevice", "CircuitBreaker", "Air powered", 
                 "ElectricDistributionLine", "Medium Voltage", 
                 "Single Phase Overhead")
AddRule example 3 (Python window)

This sample script creates a containment association rule to allow a junction box to contain an elbow.

import arcpy
arcpy.AddRule_un("Electric Network", "CONTAINMENT", "StructureJunction", 
                 "JunctionBox", "Junction Box", "ElectricDistributionDevice", 
                 "Fuse", "Underground Single Phase Load Break Elbow")
AddRule example 4 (Python window)

This sample script creates a structural attachment association rule to allow a switch to be structurally attached to a pole.

import arcpy
arcpy.AddRule_un("Electric Network", "STRUCTURAL_ATTACHMENT", 
                 "StructureJunction", "Pole", "Wood", 
                 "ElectricDistributionDevice", "Switch", 
                 "Overhead Low Voltage Single Phase Disconnect")

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics