Update Diagram (Schematics)
Resumen
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.
Uso
-
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.
Sintaxis
Parámetro | Explicación | Tipo de datos |
in_diagram |
The schematic diagram layer to be updated. | Schematic Layer |
in_data [in_data,...] (Opcional) |
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 [builder_options,...] (Opcional) |
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 |
Ejemplo de código
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: Extensión ArcGIS Schematics
# import system modules
import arcpy
msgNoLicenseAvailable = "Extensión ArcGIS Schematics license required"
try:
# Checks out the Extensión ArcGIS Schematics license
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseAvailable)
# Sets environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_In_ArcMap\ElecDemo.gdb"
# UpdateDiagram by only refreshing the attributes on schematic features contained in the input diagram; builder_options=REFRESH
arcpy.UpdateDiagram_schematics("ElecDemo\Inside Plants\Substation 08", "#", "REFRESH")
# UpdateDiagram by fully synchronizing the diagram content regarding the custom queries; no udpate parameters required
arcpy.UpdateDiagram_schematics("ElecDemo\Inside Plants\Substation 08")
# Returns the Extensión ArcGIS Schematics 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)
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: Extensión ArcGIS Schematics
# import system modules
import arcpy
msgNoLicenseAvailable = "Extensión ArcGIS Schematics license required"
try:
# Checks out the Extensión ArcGIS Schematics license
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseAvailable)
# Sets environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_In_ArcMap\ElecDemo.gdb"
# Creates some new diagrams that will be used to exemplify the UpdateDiagram command:
arcpy.CreateDiagram_schematics("ElecDemo", "FeederDiagram", "GeoSchematic", "ElectricNetwork\Feeder")
arcpy.CreateDiagram_schematics("ElecDemo", "FeederDiagramBIS", "GeoSchematic", "ElectricNetwork\Feeder")
arcpy.CreateDiagram_schematics("ElecDemo", "WholeElectricNetworkDiagram", "GeoSchematic", "ElectricNetwork\PrimaryLine;ElectricNetwork\SecondaryLine")
InputLayer = arcpy.MakeFeatureLayer_management("ElectricNetwork\PrimaryLine","PrimaryLineLayer", "PHASECODE =135")
arcpy.CreateDiagram_schematics("ElecDemo", "PrimaryLinesDiagram", "GeoSchematic", InputLayer)
# UpdateDiagram by fully synchronizing the diagram content regarding the original network features that were used to initially generate it; no udpate parameters required
arcpy.UpdateDiagram_schematics("ElecDemo\Feeders\Feeder 0801-Rice Creek")
# UpdateDiagram by only refreshing the attributes on schematic features contained in the input diagram; builder_options=REFRESH
arcpy.UpdateDiagram_schematics("ElecDemo\Feeders\Feeder 0802-Goldmine", "#", "REFRESH")
# UpdateDiagram by rebuilding the input diagram from a feature class; builder_options=REBUILD;KEEP_MANUAL_MODIF or REBUILD;NO_KEEP_MANUAL_MODIF
arcpy.UpdateDiagram_schematics("ElecDemo\WholeElectricNetworkDiagram", "ElectricNetwork\PrimaryLine", "REBUILD;KEEP_MANUAL_MODIF")
# UpdateDiagram by appending new features to the input diagram with a partial synchronization of the diagram content; builder_options=APPEND_QUICK;KEEP_MANUAL_MODIF or APPEND_QUICK;NO_KEEP_MANUAL_MODIF
arcpy.UpdateDiagram_schematics("ElecDemo\FeederDiagram", "ElectricNetwork\Substation", "APPEND_QUICK;KEEP_MANUAL_MODIF")
# UpdateDiagram by appending new features to the input diagram with a full synchronization of the diagram content; builder_options=APPEND;KEEP_MANUAL_MODIF or APPEND;NO_KEEP_MANUAL_MODIF
arcpy.UpdateDiagram_schematics("ElecDemo\FeederDiagramBIS", "ElectricNetwork\ServiceLocation", "APPEND;KEEP_MANUAL_MODIF")
# UpdateDiagram by rebuilding the input diagram from an input layer; builder_options=REBUILD;KEEP_MANUAL_MODIF or REBUILD;NO_KEEP_MANUAL_MODIF
arcpy.UpdateDiagram_schematics("ElecDemo\PrimaryLinesDiagram", InputLayer, "REBUILD;KEEP_MANUAL_MODIF")
# Returns the Extensión ArcGIS Schematics 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)
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: Extensión ArcGIS Schematics
# import system modules
import arcpy
msgNoLicenseAvailable = "Extensión ArcGIS Schematics license required"
try:
# Checks out the Extensión ArcGIS Schematics license
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseAvailable)
# Sets environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data\GISDatabaseForXML.gdb"
# CreateDiagram from a XML file, SampleNetworkFeeder1.xml
arcpy.CreateDiagram_schematics("XMLDataset", "XMLDiagramFeeder1", "XMLDiagrams", "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data\SampleNetworkFeeder1.xml")
# Updates the XMLDiagramFeeder1 diagram from another XML file, SampleNetworkUpdatedFeeder1.xml
arcpy.UpdateDiagram_schematics("XMLDataset\XMLDiagramFeeder1", "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data\SampleNetworkUpdatedFeeder1.xml")
# Returns the Extensión ArcGIS Schematics 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)
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: Extensión ArcGIS Schematics,Extensión ArcGIS Network Analyst
# import system modules
import arcpy
msgNoLicenseSchematicsAvailable = "Extensión ArcGIS Schematics license required"
msgNoLicenseNetworkAnalystAvailable = "Extensión ArcGIS Network Analyst license required"
try:
# Checks out the Extensión ArcGIS Schematics licence
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseSchematicsAvailable)
# Checks out the Extensión ArcGIS Network Analyst licence
if arcpy.CheckExtension("Network") == "Available":
arcpy.CheckOutExtension("Network")
else:
raise Exception(msgNoLicenseNetworkAnalystAvailable)
# Sets environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\Network_Dataset\NetworkAnalyst_Schematics.gdb"
# UpdateDiagram from a solved route network analysis layer
# 1) Solves the route network analysis layer,
arcpy.Solve_na("Routes\Tour2")
# 2) Creates diagrams from this solved route network analysis layer
# a - DiagramTour_A diagram, created with merged nodes to represent network junctions which are crossed several times along the resultant route (MERGE_NODES option)
arcpy.CreateDiagram_schematics("NA_SchematicDataset", "DiagramTour2_A", "NADiagrams", "Routes\Tour2", "MERGE_NODES")
# b - DiagramTour_B diagram, without merged nodes (NO_MERGE_NODES option)
arcpy.CreateDiagram_schematics("NA_SchematicDataset", "DiagramTour2_B", "NADiagrams", "Routes\Tour2", "NO_MERGE_NODES")
# 3) Updates those diagrams from the same solved route network analysis layer by changing the merge nodes option
arcpy.UpdateDiagram_schematics("NA_SchematicDataset\DiagramTour2_A", "Routes\Tour2", "NO_MERGE_NODES;KEEP_MANUAL_MODIF")
arcpy.UpdateDiagram_schematics("NA_SchematicDataset\DiagramTour2_B", "Routes\Tour2", "MERGE_NODES;KEEP_MANUAL_MODIF")
# 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)