Make Diagram Layer (Network Diagram)

Summary

Creates a network diagram layer from a network diagram.

Usage

  • The output diagram layer can be used as input to geoprocessing tools that accept a diagram layer as input, including the Store Diagram, Update Diagram, and Apply Smart Tree Layout tools.

  • This tool must be run in ModelBuilder or Python scripts before running any tool that requires a diagram layer.

Parameters

LabelExplanationData Type
Input Network

The utility network or trace network the diagram is related to.

Utility Network; Trace Network; Utility Network Layer; Trace Network Layer
Network Diagram Name

The network diagram name.

String
Output Layer

The name of the diagram layer that will be created.

Diagram Layer; Group Layer
Make a group layer containing the feature layers
(Optional)

Specifies the type of output layer that will be created.

  • Unchecked—The output will be a diagram layer without a sublayer. Diagram layers without a sublayer can be used as input to geoprocessing tools such as the Store Diagram, Update Diagram, and Apply Smart Tree Layout tools. This is the default.
  • Checked—The output will be a group layer with sublayers. The feature sublayers can be exported to geodatabase feature classes using the Feature Class To Geodatabase tool.

Boolean

arcpy.nd.MakeDiagramLayer(in_utility_network, network_diagram_name, out_layer, {sublayers_option})
NameExplanationData Type
in_utility_network

The utility network or trace network the diagram is related to.

Utility Network; Trace Network; Utility Network Layer; Trace Network Layer
network_diagram_name

The network diagram name.

String
out_layer

The name of the diagram layer that will be created.

Diagram Layer; Group Layer
sublayers_option
(Optional)

Specifies the type of output layer that will be created.

  • DO_NOT_ADD_SUBLAYERSThe output will be a diagram layer without a sublayer. Diagram layers without a sublayer can be used as input to geoprocessing tools such as the Store Diagram, Update Diagram, and Apply Smart Tree Layout tools. This is the default.
  • ADD_SUBLAYERSThe output will be a group layer with sublayers. The feature sublayers can be exported to geodatabase feature classes using the Feature Class To Geodatabase tool.
Boolean

Code sample

MakeDiagramLayer example (stand-alone script)

The following stand-alone script uses the MakeDiagramLayer function to retrieve a stored network diagram in the database and apply the Smart Tree layout to it.

# Name: RetrieveAStoredDiagramAndApplyALayoutOnIt.py
# Description:  Retrieve a stored diagram and apply a layout to it.

# Import system modules
import arcpy

# Initialize variables
input_Network = "https://cezembre.esri.com/server/rest/services/Naperville2_Electric_SQL/FeatureServer/0"
input_DiagramName = "my1stdiagram"

# Set overwrite option
arcpy.env.overwriteOutput = True

# Retrieve a given stored diagram and transform it as a diagram layer 
arcpy.nd.MakeDiagramLayer(input_Network, input_DiagramName, "built_diagramlayer", "DO_NOT_ADD_SUBLAYERS")

# Apply the smart tree layout on this diagram 
arcpy.nd.ApplySmartTreeLayout("built_diagramlayer")

Environments

This tool does not use any geoprocessing environments.

Licensing information

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

Related topics