Update Diagram (Schematics)

Summary

Updates a schematic diagram. Depending on the schematic builder, the diagram update can be based on feature layers, feature classes, object tables, a solved network analysis, or an XML file.

Usage

Syntax

UpdateDiagram_schematics (in_diagram, {in_data}, {builder_options})
ParameterExplanationData Type
in_diagram

The schematic diagram to be updated.

Schematic Diagram; Schematic Layer
in_data
[in_data,...]
(Optional)

The input data on which the diagram update will be based.

The Input Data parameter is not required for all predefined builders; it's an optional parameter:

  • For diagram templates that work with the Standard builder configured to operate from custom queries, no input tables must be set.
  • For diagram templates that work with the XML builder, the Input Data parameter must reference an XML file.
  • For diagram templates that work with the Network Dataset builder, the input data must be specified. It must reference a unique network analyst layer. If the related network analysis is not performed, Schematics tries to perform it before using the solved analysis layer as input.
  • For diagram templates that work with the Standard builder configured to operate from geometric networks, when the Input Data parameter is not specified, the Update Diagram tool works from the initial set of features/objects used to generate the diagram or from the updated trace result based on the trace parameters that persisted in the schematic database if the diagram was generated from a highlighted trace. When the Input Data parameter is specified, it must reference at least a feature layer, feature class, or object table so the update operates on this data according to the Builder Options value.

TableView; Layer; Data Element
builder_options
[builder_options,...]
(Optional)

The schematic builder update options. Update options are optional. They depend on the builder related to the diagram template that implements the specified schematic diagram.

Diagrams generated from custom queries (Standard builder): KEEP_MANUAL_MODIF or NO_KEEP_MANUAL_MODIF.

Diagrams generated from XML data (XML builder): KEEP_MANUAL_MODIF or NO_KEEP_MANUAL_MODIF.

Diagrams generated from solver results on network datasets (Network Dataset builder): MERGE_NODES or NO_MERGE_NODES, KEEP_MANUAL_MODIF or NO_KEEP_MANUAL_MODIF

Diagrams generated from features organized into a geometric network (Standard builder): REBUILD or APPEND, KEEP_MANUAL_MODIF or NO_KEEP_MANUAL_MODIF.

  • KEEP_MANUAL_MODIFDefault option. Use this if you want the schematic features that have been removed/reduced from the diagram to not reappear and the edited connections to be kept in the updated diagram.
  • NO_KEEP_MANUAL_MODIFUse this if you want those removed/reduced schematic features and the reconnected schematic feature links to be restored after the update.
  • NO_MERGE_NODESDefault option for diagrams based on the Network Dataset builder. Use it so no schematic feature node is merged in the updated diagram.
  • MERGE_NODESOption available for diagrams based on the Network Dataset builder. Use it so network element junctions that occur several times along the resultant route of a route analysis can be represented by a single schematic feature node in the updated schematic diagram. This option also allows you to merge midspan junction elements when they are at the same position in the case of a service area analysis.
  • REBUILDDefault option available for diagrams based on the Standard builder when input data is set. Use this option if you want the specified schematic diagram to be completely rebuilt according to the specified input feature layers, feature classes, or object tables.
  • APPENDOption available for diagrams based on the Standard builder when input data is set. Use this option if you want to keep all the schematic features that have been initially used to generate the specified schematic diagram; add schematic objects associated with the specified input feature layers, feature classes, or object tables; and update all the diagram content
String

Code Sample

Sample 1: UpdateDiagram and Standard builder working from custom queries

Update a schematic diagram entirely built from custom queries. In this case, only the diagram name parameter is required.

# Name: UpdateDiagramCustomQuery.py
# Description: Update a schematic diagram entirely built from custom queries
# Author: ESRI

# import system modules
import arcpy
msgNoLicenseAvailable = "Schematics license required"

try:
	# Check out the ArcGIS Schematic extension license
	if arcpy.CheckExtension("Schematics") == "Available":
		arcpy.CheckOutExtension("Schematics")
	else:
		raise Exception(msgNoLicenseAvailable)
	
	# Set environment settings
	arcpy.OverWriteOutput = True
	arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_In_ArcMap\ElecDemo.gdb"

	#Process: Update the 'Substation 08' schematic diagram.
	arcpy.UpdateDiagram_schematics("ElecDemo\Inside Plants\Substation 08")

	# Returns the schematic license
	arcpy.CheckInExtension("Schematics")

except Exception as exc:
		print exc
Sample 2: UpdateDiagram and Standard builder working on geometric network data

Update schematic diagrams built from features organized into a geometric network.

# Name: UpdateDiagramStd.py
# Description: Update schematic diagrams built from features organized into a geometric network
# Author: ESRI

# import system modules
import arcpy
msgNoLicenseAvailable = "Schematics license required"

try:
	# Check out the ArcGIS Schematic extension license
	if arcpy.CheckExtension("Schematics") == "Available":
		arcpy.CheckOutExtension("Schematics")
	else:
		raise Exception(msgNoLicenseAvailable)
	
	# Set environment settings
	arcpy.OverWriteOutput = True
	arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_In_ArcMap\ElecDemo.gdb"

	#Process: CreateDiagram from the Feeder feature class: A diagram containing schematic features associated with each GIS feature stored in that feature class will be created.
	arcpy.CreateDiagram_schematics("ElecDemo", "FeederDiagram", "GeoSchematic", "ElectricNetwork\Feeder")

	#Process: CreateDiagram based on all the edge feature classes contained in a geometric network. A diagram containing schematic features associated with all the GIS features in that geometric network will be created.
	arcpy.CreateDiagram_schematics("ElecDemo", "ElectricNetworkDiagram", "GeoSchematic", "ElectricNetwork\PrimaryLine;ElectricNetwork\SecondaryLine")

	#Process: CreateDiagram based on all primary lines Phase ABC
	# 1) Create a layer with the selection 
	InputLayer = arcpy.MakeFeatureLayer_management(r'ElectricNetwork\PrimaryLine',"PrimaryLineLayer", "[PHASECODE] =135")
	# 2) Use the layer as input of CreateDiagram
	arcpy.CreateDiagram_schematics("ElecDemo", "ElectricMainNetworkDiagram", "GeoSchematic", InputLayer)

	#Process: Updating the FeederDiagram diagram without optional parameter: the update operates from the initial feature set used to initially generate the specified schematic diagram or from the updated trace result based on the trace parameters that were persisted in the schematic database if the diagram was generated from an highlighted trace.
	arcpy.UpdateDiagram_schematics("ElecDemo\FeederDiagram")

	#Process: Update the ElectricNetworkDiagram-With Removed diagram with the KEEP_MANUAL_MODIF optional parameter: the update operates from the initial feature set used to initially generate the specified schematic diagram or from the updated trace result based on the trace parameters that persisted in the schematic database if the diagram was generated from an highlighted trace, schematic features that have been manually reduced or removed, and schematic feature links that have been reconnected in the diagram after its generation being kept as removed/reduced/reconnected schematic features.
	arcpy.UpdateDiagram_schematics("ElecDemo\ElectricNetworkDiagram-WithRemoved", "#", "KEEP_MANUAL_MODIF")

	#Process: Update the ElectricNetworkDiagram diagram using a set of feature classes to rebuild it.
	arcpy.UpdateDiagram_schematics("ElecDemo\ElectricNetworkDiagram", "ElectricNetwork\PrimaryLine;ElectricNetwork\SecondaryLine", "REBUILD")

	#Process: UpdateDiagram on the FeederDiagramBIS diagram by appending new features
	arcpy.UpdateDiagram_schematics("ElecDemo\FeederDiagramBIS", "ElectricNetwork\Substation", "APPEND")

	#Process: Update the ElectricMainNetworkDiagram diagram using an updated selection of features
	InputLayer = arcpy.MakeFeatureLayer_management(r'ElectricNetwork\PrimaryLine',"PrimaryLineLayer", "[PHASECODE] =135")
	arcpy.UpdateDiagram_schematics("ElecDemo\ElectricMainNetworkDiagram", InputLayer, "REBUILD")
	
	# Returns the schematic license
	arcpy.CheckInExtension("Schematics")

except Exception as exc:
		print exc
Sample 3: UpdateDiagram and XML builder

Update a schematic diagram based on the XML builder.

# Name: UpdateDiagramXML.py
# Description: Update schematic diagrams based on the XML builder
# Author: ESRI

# import system modules
import arcpy
msgNoLicenseAvailable = "Schematics license required"

try:
	# Check out the ArcGIS Schematic extension license
	if arcpy.CheckExtension("Schematics") == "Available":
		arcpy.CheckOutExtension("Schematics")
	else:
		raise Exception(msgNoLicenseAvailable)
	
	# Set environment settings
	arcpy.OverWriteOutput = True
	arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data\GISDatabaseForXML.gdb"

	#Process: Update the XMLDiagramSample diagram from the SampleTutorialData.xml file based on the XMLBuilderDiagram XML Schema file
	arcpy.UpdateDiagram_schematics("XMLSampleSchDataset\XMLDiagramSample", "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data\SampleNetworkUpdatedFeeder1.xml")

	# Returns the schematic license
	arcpy.CheckInExtension("Schematics")

	# Returns the schematic license
	arcpy.CheckInExtension("Schematics")

except Exception as exc:
		print exc
Sample 4: UpdateDiagram and Network Dataset builder

Update schematic diagrams based on the Network Dataset builder.

# Name: UpdateDiagramNDS.py
# Description: Update schematic diagrams based on the Network Dataset builder
# Author: ESRI

# import system modules
import arcpy
msgNoLicenseAvailable = "Schematics license required"

try:
	# Check out the ArcGIS Schematic extension license
	if arcpy.CheckExtension("Schematics") == "Available":
		arcpy.CheckOutExtension("Schematics")
	else:
		raise Exception(msgNoLicenseAvailable)
	
	# Set environment settings
	arcpy.OverWriteOutput = True
	arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\Network_Dataset\NetworkAnalyst_Schematics.gdb"

	#Solving the Route network analysis layer
	arcpy.solve("Route", "HALT")

	#Process: Update the DiagramRoute1_MERGED and DiagramRoute1_NOTMERGED diagrams from the solved Route network analysis layer
	arcpy.UpdateDiagram_schematics("NA_SchematicDataset\DiagramRoute1_MERGED", "Route", "MERGE_NODES")
	arcpy.UpdateDiagram_schematics("NA_SchematicDataset\DiagramRoute1_NOTMERGED", "Route", "NO_MERGE_NODES")

except Exception as exc:
		print exc

Environments

This tool does not use any geoprocessing environments

Related Topics

Licensing Information

ArcView: Requires Schematics
ArcEditor: Requires Schematics
ArcInfo: Requires Schematics

11/18/2010