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
The Input Data parameter is mandatory for diagrams working with the Network Dataset builder and XML builder. It is optional for diagrams working with the Standard builder when it is configured to operate from a geometric network or network dataset. It must not be specified for diagrams that work with the Standard builder when it is configured to operate from custom queries.
When using the Update Diagram tool on diagrams implemented by the Standard builder that have been generated from a geometric network trace, the update operates from the updated trace result based on the trace parameters that persisted in the schematic dataset the first time the diagram was generated from a highlighted trace.
When the update must operate from features that compose a geometric network or network dataset, it is not necessary to specify all the feature layers in the Input Data parameter. If the Add connected nodes option is specified for the Standard builder properties, only the feature layers related to edge features or edge network elements can be specified, even if all the feature layers related to the geometric network or network dataset (junctions and edges) will be used for update.
If a particular layout was saved for the specified schematic diagram, the schematic features that were in the diagram before updating are displayed according to their last saved position, and new schematic features that may have been introduced during the update are positioned at their geographic coordinates.
Syntax
arcpy.schematics.UpdateDiagram(in_diagram, {in_data}, {builder_options})
Parameter | Explanation | Data Type |
in_diagram | The schematic diagram layer to be updated. | 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:
| Table View;Data Element;Layer |
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:
| String |
Code sample
UpdateDiagram and Standard builder working from custom queries example 1 (stand-alone Python script)
Updates a sample schematic diagram entirely built from custom queries. In this case, only the diagram name parameter is required.How to run this Python script example:
- Start ArcCatalog or ArcMap with a new empty map.
- Copy and paste the following script in the Python window.
- Press ENTER.
# Name: UpdateDiagramCustomQuery.py
# Description: Update a schematic diagram entirely built from custom queries
# Requirement: ArcGIS Schematics extension
# import system modules
import arcpy
msgNoLicenseAvailable = "ArcGIS Schematics extension license required"
try:
# Checks out the ArcGIS Schematics extension license
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseAvailable)
# Sets Schematics general settings
dataLocation="C:/ArcGIS/ArcTutor/Schematics/Schematics_In_ArcMap"
gdbName="ElecDemo.gdb"
in_schDataset="ElecDemo"
in_schFolder="Inside Plants"
in_diagName="Substation 08"
builder_option1="REFRESH"
# Sets environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = dataLocation + "/" + gdbName
# UpdateDiagram by only refreshing attributes on the input diagram's schematic features
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_schFolder + "/" + in_diagName, "#", builder_option1)
# UpdateDiagram by fully synchronizing the input custom queries-based diagram (no parameters required)
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_schFolder + "/" + in_diagName)
# Returns the ArcGIS Schematics extension license
arcpy.CheckInExtension("Schematics")
print "Script completed successfully"
except Exception as e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "An error occurred on line %i" % tb.tb_lineno
print str(e)
UpdateDiagram and Standard builder working on geometric network data example 2 (stand-alone Python script)
Updates sample schematic diagrams built from features organized into a geometric network.How to run this Python script example:
- Start ArcCatalog or ArcMap with a new empty map.
- Copy and paste the following script in the Python window.
- Press ENTER.
# Name: UpdateDiagramStd.py
# Description: Update schematic diagrams built from features organized into a geometric network
# Requirement: ArcGIS Schematics extension
# import system modules
import arcpy
msgNoLicenseAvailable = "ArcGIS Schematics extension license required"
try:
# Checks out the ArcGIS Schematics extension license
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseAvailable)
# Sets Schematics general settings
dataLocation="C:/ArcGIS/ArcTutor/Schematics/Schematics_In_ArcMap"
gdbName="ElecDemo.gdb"
in_schDataset="ElecDemo"
in_schFolder="Feeders"
in_diagTempName="GeoSchematic"
# Sets variables used for the A/ UpdateDiagram sample
in_diagAName="Feeder 0801-Rice Creek"
# Sets variables used for the B/ UpdateDiagram sample
in_diagBName="Feeder 0802-Goldmine"
# Sets variables used for the C/ UpdateDiagram sample
in_diagCName="WholeElectricNetworkDiagram"
input_ForCDiag="ElectricNetwork/PrimaryLine;ElectricNetwork/SecondaryLine"
input_FC1="ElectricNetwork/PrimaryLine"
# Sets variables used for the D/ UpdateDiagram sample
in_diagDName="FeederDiagram"
input_ForDDiag="ElectricNetwork/Feeder"
input_FC2="ElectricNetwork/Substation"
# Sets variables used for the E/ UpdateDiagram sample
in_diagEName="FeederDiagramBIS"
input_ForEDiag="ElectricNetwork/Feeder"
input_FC3="ElectricNetwork/ServiceLocation"
# Sets variables used for the F/ UpdateDiagram sample
input_LayerName="PrimaryLineLayer"
input_Filter="PHASECODE=135"
in_diagFName="PrimaryLinesDiagram"
# Sets builder_options variables for diagram Update
# - For simply refreshing the diagram's attributes only
U_option1="REFRESH"
# - For rebuilding the diagram from a different input
U_option2="REBUILD;KEEP_MANUAL_MODIF"
U_option2BIS="REBUILD;NO_KEEP_MANUAL_MODIF"
# - For appending new features to the diagram with a partial synchronization of its content
U_option3="APPEND_QUICK;KEEP_MANUAL_MODIF"
U_option3BIS="APPEND_QUICK;NO_KEEP_MANUAL_MODIF"
# - For appending new features to the diagram with a full synchronization of its content
U_option4="APPEND;KEEP_MANUAL_MODIF"
U_option4BIS="APPEND;NO_KEEP_MANUAL_MODIF"
# Sets environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = dataLocation + "/" + gdbName
# Creates some new diagrams that will be used to exemplify the C/, D/, E/ and F/ UpdateDiagram samples
arcpy.CreateDiagram_schematics(in_schDataset, in_diagCName, in_diagTempName, input_ForCDiag)
arcpy.CreateDiagram_schematics(in_schDataset, in_diagDName, in_diagTempName, input_ForDDiag)
arcpy.CreateDiagram_schematics(in_schDataset, in_diagEName, in_diagTempName, input_ForEDiag)
InputLayer = arcpy.MakeFeatureLayer_management(input_FC1, input_LayerName, input_Filter)
arcpy.CreateDiagram_schematics(in_schDataset, in_diagFName, in_diagTempName, InputLayer)
# A/ UpdateDiagram by fully synchronizing the diagram content; no udpate parameters required
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_schFolder + "/" + in_diagAName)
# B/ UpdateDiagram by only refreshing attributes on the input diagram's schematic features
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_schFolder + "/" + in_diagBName, "#", U_option1)
# C/ UpdateDiagram by rebuilding the input diagram from a feature class
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_diagCName, input_FC1, U_option2)
# D/ UpdateDiagram by appending new features to the input diagram with a partial synchronization
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_diagDName, input_FC2, U_option3)
# E/ UpdateDiagram by appending new features to the input diagram with a full synchronization
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_diagEName, input_FC3, U_option4)
# F/ UpdateDiagram by rebuilding the input diagram from an input layer
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_diagFName, InputLayer, U_option2)
# Returns the ArcGIS Schematics extension license
arcpy.CheckInExtension("Schematics")
print "Script completed successfully"
except Exception as e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "An error occurred on line %i" % tb.tb_lineno
print str(e)
UpdateDiagram and XML builder example 3 (stand-alone Python script)
Updates a sample schematic diagram based on the XML builder.How to run this Python script example:
- Start ArcCatalog.
- Create and configure the schematic dataset used during the sample script:
- Navigate to the C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data folder in the Catalog tree.
- Right-click the GISDatabaseForXML geodatabase, point to New, then click Schematic Dataset.
- Type XMLDataset for the newly created schematic dataset's name, and press ENTER.
- Right-click the XMLDataset schematic dataset and click Edit.
- Right-click the XMLDataset entry in the Dataset Editor tree and click New Schematic Diagram Template.
- Type XMLDiagrams in the Name text box.
- Choose XML Builder in the Schematic Builder section.
- Click Schematic Builder Properties, and check Automatic schematic feature class creation.
- Close the Builder Properties dialog box.
- Click OK.
- Click Save on the Schematic Dataset Editor toolbar, and close the Schematic Dataset Editor.
- Copy and paste the following script in the ArcCatalog or ArcMap Python window.
- Press ENTER.
# Name: UpdateDiagramXML.py
# Description: Update schematic diagrams based on the XML builder
# Requirement: ArcGIS Schematics extension
# import system modules
import arcpy
msgNoLicenseAvailable = "ArcGIS Schematics extension license required"
try:
# Checks out the ArcGIS Schematics extension license
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseAvailable)
# Sets Schematics general settings
dataLocation="C:/ArcGIS/ArcTutor/Schematics/Schematics_Configuration/XML_Data"
gdbName="GISDatabaseForXML.gdb"
in_schDataset="XMLDataset"
in_diagName="XMLDiagramFeeder1"
in_diagTempName="XMLDiagrams"
input_XmlFile1="SampleNetworkFeeder1.xml"
input_XmlFile2="SampleNetworkUpdatedFeeder1.xml"
# Sets environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = dataLocation + "/" + gdbName
# CreateDiagram from a XML file, SampleNetworkFeeder1.xml
arcpy.CreateDiagram_schematics(in_schDataset, in_diagName, in_diagTempName, dataLocation + "/" + input_XmlFile1)
# Updates the XMLDiagramFeeder1 diagram from another XML file, SampleNetworkUpdatedFeeder1.xml
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_diagName, dataLocation + "/" + input_XmlFile2)
# Returns the ArcGIS Schematics extension license
arcpy.CheckInExtension("Schematics")
print "Script completed successfully"
except Exception as e:
# If an error occurred, print line number and error message import traceback, sys
tb = sys.exc_info()[2]
print "An error occured on line %i" % tb.tb_lineno
print str(e)
UpdateDiagram and Network Dataset builder example 4 (stand-alone Python script)
Updates schematic diagrams based on the Network Dataset builder.How to use this Python script example:
- Start ArcMap.
- Open the ParisTours.mxd file stored in C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\Network_Dataset.
- Click Geoprocessing > Geoprocessing Options.
- Uncheck Enable on the Background Processing section, and click OK.
- Copy and paste the following script in the Python window.
# Name: UpdateDiagramNDS.py
# Description: Update sample schematic diagrams based on the Network Dataset builder
# Requirement: ArcGIS Schematics extension,ArcGIS Network Analyst extension
# import system modules
import arcpy
msgNoLicenseSchematicsAvailable = "ArcGIS Schematics extension license required"
msgNoLicenseNetworkAnalystAvailable = "ArcGIS Network Analyst extension license required"
try:
# Checks out the ArcGIS Schematics extension licence
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseSchematicsAvailable)
# Checks out the ArcGIS Network Analyst extension licence
if arcpy.CheckExtension("Network") == "Available":
arcpy.CheckOutExtension("Network")
else:
raise Exception(msgNoLicenseNetworkAnalystAvailable)
# Sets general settings
dataLocation="C:/ArcGIS/ArcTutor/Schematics/Schematics_Configuration/Network_Dataset"
gdbName="NetworkAnalyst_Schematics.gdb"
in_schDataset="NA_SchematicDataset"
in_diagAName="DiagramTour2_A"
in_diagBName="DiagramTour2_B"
in_diagTempName="NADiagrams"
in_NALayerName="Routes/Tour2"
# builder_options variables for diagram Generation and Update
G_option1="MERGE_NODES"
G_option2="NO_MERGE_NODES"
U_option1="NO_MERGE_NODES;KEEP_MANUAL_MODIF"
U_option2="MERGE_NODES;KEEP_MANUAL_MODIF"
# Sets environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = dataLocation + "/" + gdbName
# UpdateDiagram from a solved route network analysis layer
# 1) Solves the route network analysis layer,
arcpy.Solve_na(in_NALayerName)
# 2) Creates diagrams from this solved route network analysis layer
# a - A diagram where a single node is created to represent a GIS point crossed N times along this route (G_option1)
arcpy.CreateDiagram_schematics(in_schDataset, in_diagAName, in_diagTempName, in_NALayerName, G_option1)
# b - A diagram where N nodes are created to represent a GIS point crossed N times along this route (G_option2)
arcpy.CreateDiagram_schematics(in_schDataset, in_diagBName, in_diagTempName, in_NALayerName, G_option2)
# 3) Updates those diagrams from the same solved route network analysis layer by changing the merge nodes option
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_diagAName, in_NALayerName, U_option1)
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_diagBName, in_NALayerName, U_option2)
# Returns the licences
arcpy.CheckInExtension("Schematics")
arcpy.CheckInExtension("Network")
print "Script completed successfully"
except Exception as e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "An error occurred on line %i" % tb.tb_lineno
print str(e)
Environments
This tool does not use any geoprocessing environments.
Licensing information
- Basic: Requires Schematics
- Standard: Requires Schematics
- Advanced: Requires Schematics