Update Diagram (Schematics)

License Level:BasicStandardAdvanced

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 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:

  • 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 analysis 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 a geometric network or a network dataset, when the Input Data parameter is not specified, the Update Diagram tool works from the initial set of network features/objects used to generate the diagram or from the updated geometric network 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.

Table View;Data Element;Layer
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, NO_KEEP_MANUAL_MODIF, or REFRESH.
  • 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): NO_MERGE_NODES;KEEP_MANUAL_MODIF, NO_MERGE_NODES;NO_KEEP_MANUAL_MODIF, MERGE_NODES;KEEP_MANUAL_MODIF or MERGE_NODES;NO_KEEP_MANUAL_MODIF.
  • Diagrams generated from features organized into a geometric network or a network dataset (Standard builder):
    • When the Input Data parameter is not specified—KEEP_MANUAL_MODIF, NO_KEEP_MANUAL_MODIF, or REFRESH
    • When the Input Data parameter is specified—REBUILD;KEEP_MANUAL_MODIF, REBUILD;NO_KEEP_MANUAL_MODIF, APPEND;KEEP_MANUAL_MODIF, APPEND;NO_KEEP_MANUAL_MODIF, APPEND_QUICK;KEEP_MANUAL_MODIF or APPEND_QUICK;NO_KEEP_MANUAL_MODIF

  • KEEP_MANUAL_MODIFDefault option for diagram based on the XML builder or on the Standard builder when no input data is set. Use it to synchronize the input diagram content either against the original selection/trace/query used to initially generate this diagram—Standard diagram—or from an updated version of the XML input data initially used to generate it—XML diagram—whereas the schematic features that may have been manually removed/reduced/reconnected are kept in the updated diagram.
  • NO_KEEP_MANUAL_MODIFOption available for diagrams based on the XML builder or on the Standard builder when no input data is set. Use it to synchronize the input diagram content either against the original selection/trace/query used to initially generate this diagram—Standard diagram—or from an updated version of the XML input data initially used to generate it—XML diagram—whereas the schematic features that may have been manually removed/reduced/reconnected are restored in the updated diagram.
  • REFRESHOption available for diagrams based on the Standard builder when no input data is set. Use it to simply refresh the attributes for all schematic features in the input diagram to the current state of the related network features in the geometric network or network dataset feature classes.
  • REBUILD;KEEP_MANUAL_MODIFDefault option available for diagrams based on the Standard builder when input data is set. Use this option if you want the input diagram to be completely rebuilt according to the specified input feature layers, feature classes, or object tables, whereas the schematic features that may have been manually removed/reduced/reconnected are kept in the updated diagram.
  • REBUILD;NO_KEEP_MANUAL_MODIFOption available for diagrams based on the Standard builder when input data is set. Use this option if you want the input diagram to be completely rebuilt according to the specified input feature layers, feature classes, or object tables, whereas the schematic features that may have been manually removed/reduced/reconnected are restored in the updated diagram.
  • APPEND;KEEP_MANUAL_MODIFOption available for diagrams based on the Standard builder when input data is set. Use this option if you want to append schematic features associated with the specified input feature layers, feature classes, or object tables with a full synchronization of the input diagram content, whereas the schematic features that may have been manually removed/reduced/reconnected are kept in the updated diagram.
  • APPEND;NO_KEEP_MANUAL_MODIFOption available for diagrams based on the Standard builder when input data is set. Use this option if you want to append schematic features associated with the specified input feature layers, feature classes, or object tables with a full synchronization of the input diagram content, whereas the schematic features that may have been manually removed/reduced/reconnected are restored in the updated diagram.
  • APPEND_QUICK;KEEP_MANUAL_MODIFOption available for diagrams based on the Standard builder when input data is set. Use this option if you want to append schematic features associated with the specified input feature layers, feature classes, or object tables with a partial synchronization of the input diagram content, whereas the schematic features that may have been manually removed/reduced/reconnected are kept in the updated diagram.
  • APPEND_QUICK;NO_KEEP_MANUAL_MODIFOption available for diagrams based on the Standard builder when input data is set. Use this option if you want to append schematic features associated with the specified input feature layers, feature classes, or object tables with a partial synchronization of the input diagram content, whereas the schematic features that may have been manually removed/reduced/reconnected are restored in the updated diagram.
  • NO_MERGE_NODES;KEEP_MANUAL_MODIFDefault option for diagrams based on the Network Dataset builder. Use this option to update the input diagram from the specified solved network analysis layer without merging nodes that occur several times in this layer, whereas the schematic features that may have been manually removed/reduced/reconnected are kept in the updated diagram.
  • NO_MERGE_NODES;NO_KEEP_MANUAL_MODIFOption available for diagrams based on the Network Dataset builder. Use this option to update the input diagram from the specified solved network analysis layer without merging nodes that occur several times in this layer, whereas the schematic features that may have been manually removed/reduced/reconnected are restored in the updated diagram.
  • MERGE_NODES;KEEP_MANUAL_MODIFOption available for diagrams based on the Network Dataset builder. Use it to update the input diagram from the specified solved network analysis layer and merge nodes that occur several times in this layer, whereas the schematic features that may have been manually removed/reduced/reconnected are kept in the updated diagram.
  • MERGE_NODES;NO_KEEP_MANUAL_MODIFOption available for diagrams based on the Network Dataset builder. Use it to update the input diagram from the specified solved network analysis layer and merge nodes that occur several times in this layer, whereas the schematic features that may have been manually removed/reduced/reconnected are restored in the updated 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:

  1. Start ArcCatalog or ArcMap with a new empty map.
  2. Copy and paste the following script in the Python window.
  3. 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:

  1. Start ArcCatalog or ArcMap with a new empty map.
  2. Copy and paste the following script in the Python window.
  3. 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:

  1. Start ArcCatalog.
  2. 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.
  3. Copy and paste the following script in the ArcCatalog or ArcMap Python window.
  4. 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:

  1. Start ArcMap.
  2. Open the ParisTours.mxd file stored in C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\Network_Dataset.
  3. Click Geoprocessing > Geoprocessing Options.
  4. Uncheck Enable on the Background Processing section, and click OK.
  5. 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

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Requires Schematics
ArcGIS for Desktop Standard: Requires Schematics
ArcGIS for Desktop Advanced: Requires Schematics
3/4/2014