Update Diagrams (Schematics)
Summary
Updates schematic diagrams stored in a schematic dataset or schematic folder.
All diagrams or a subset of diagrams (for example, diagrams related to a specific diagram template or diagrams that have not been updated for a particular number of days) can be updated.
Only diagrams based on the Standard builder—that is, diagrams built from features organized into a geometric network or network dataset and schematic diagrams built from custom queries—can be updated using this geoprocessing tool. Diagrams based on the Network Dataset builder and XML builder that require specific input data cannot be updated using this tool.
If a diagram based on the XML or Network Dataset builder is detected during the execution, an error is displayed, and the process is stopped.
Usage
-
This tool is mostly used to batch diagram updates. But, when user data has been dropped and reloaded since the diagram generations, it can also be used to resynchronize the schematic features with their related features/objects based on GUIDs.
-
If the Diagram Template parameter is specified, only the diagrams based on that template will be updated.
-
If the Number of days without update parameter is specified, only the diagrams for which the last update date meets the criterion will be updated.
-
By default, when the value specified for Input Schematic Container is a schematic folder, the update process operates recursively on all diagrams contained in that schematic folder and on all those contained in its subfolders. If you do not want the diagrams contained in the subfolders to be updated, set 0 for the recursive parameter.
Syntax
Parameter | Explanation | Data Type |
in_container |
The schematic dataset or schematic folder in which the diagrams are stored. This container must already exist. | Schematic Dataset; Schematic Folder |
builder_options (Optional) |
The schematic builder update options. They are optional.
| String |
recursive (Optional) |
| Boolean |
diagram_type [diagram_type,...] (Optional) |
The diagram template of the schematic diagram to update. | String |
last_update_criteria (Optional) |
The number of days between diagram updates. The default is zero (0), meaning all diagrams will be updated daily. | Long |
Code Sample
Update schematic diagrams contained in a specified schematic folder, implemented by a particular diagram template, or that have not been updated for a specified number of days.
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: UpdateDiagrams.py
# Description: Update schematic diagrams
# 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 environnement settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_In_ArcMap\ElecDemo.gdb"
# Updates diagrams stored on a specified schematic folder. For example, diagrams in the Feeders schematic folder
arcpy.UpdateDiagrams_schematics("ElecDemo\Feeders")
# Updates diagrams based on a specified diagram template. For example, diagrams based on the GeoSchematic diagram template
arcpy.UpdateDiagrams_schematics("ElecDemo", "#", "RECURSIVE", "GeoSchematic")
# Updates diagrams stored on a specified schematic folder that have not been updated for N days. For example, diagrams stored in the Inside_Plants schematic folder not updated for 7 days
arcpy.UpdateDiagrams_schematics("ElecDemo\Inside Plants", "#", "RECURSIVE", "#", "7")
# 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)