Create Diagram (Schematics)
Zusammenfassung
Creates a schematic diagram.
Depending on the schematic builder, diagram creation can be based on feature layers, feature classes, object tables, a network analysis layer, or XML data.
Verwendung
-
If the output schematic diagram name already exists, it may be deleted before being re-created. To avoid this deletion, you can uncheck the Overwrite the outputs of geoprocessing operations box from the Geoprocessing Options dialog box.
-
Depending on the schematic builder related to the diagram template specified for the diagram to be created, the Input Data parameter is required or not:
- For a diagram template based on the Standard builder when it is configured to operate from a geometric network or a network dataset, the parameter is mandatory. The specified input tables may be feature layers, feature classes, or object tables.
- For a diagram template based on the Network Dataset builder, a unique network analysis layer must be specified for the Input Data parameter.
- For a diagram template based on the XML builder, a unique XML file must be specified for the Input Data parameter.
- For a diagram template based on the Standard builder when it is configured to operate from custom queries, no input data is expected.
Syntax
Parameter | Erläuterung | Datentyp |
out_location |
Schematic dataset or schematic folder in which the diagram will be created. Achtung: This container must already exist. | Schematic Dataset;Schematic Folder |
out_name |
Name of the schematic diagram to be created. | String |
diagram_type [diagram_type,...] |
Schematic diagram template of the schematic diagram to be created. | String |
in_data [in_data,...] (optional) |
The input data to generate the diagram. The Input Data parameter specifies the elements on which the diagram generation will be based. It must be specified for most of the predefined schematic builders:
Achtung: For diagram templates that work with the Standard builder when it is configured to operate from a geometric network or network dataset, XML builder, and Network Dataset builder, if no input data is specified, the diagram cannot be generated. | Table View;Data Element;Layer |
builder_options (optional) |
The schematic builder creation parameters. These parameters are required only for diagrams based on the Network Dataset builder to specify whether nodes will be merged.
| String |
Codebeispiel
Create sample schematic diagrams from GIS 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: CreateDiagramStd.py
# Description: Create schematic diagrams sample from GIS features organized into a geometric network
# Requirement: Erweiterung "ArcGIS Schematics"
# import system modules
import arcpy
msgNoLicenseAvailable = "Erweiterung "ArcGIS Schematics" license required"
try:
# Checks out the Erweiterung "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"
# CreateDiagram from a feature class, Feeder
arcpy.CreateDiagram_schematics("ElecDemo", "FeederDiagram", "GeoSchematic", "ElectricNetwork\Feeder")
# CreateDiagram from a feature layer
# 1) Creates a layer with the selection
InputLayer = arcpy.MakeFeatureLayer_management("ElectricNetwork\PrimaryLine","PrimaryLineLayer", "PHASECODE =135")
# 2) Uses the layer as input of CreateDiagram
arcpy.CreateDiagram_schematics("ElecDemo", "ElectricMainNetworkDiagram", "GeoSchematic", InputLayer)
# Returns the Erweiterung "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 occured on line %i" % tb.tb_lineno
print str(e)
Create sample schematic diagrams from a solved network analysis layer.
How to run 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.
- Press ENTER.
# Name : CreateDiagramNDS.py
# Description : Create a schematic diagram from the network dataset builder
# Requirement: Erweiterung "ArcGIS Schematics",Erweiterung "ArcGIS Network Analyst"
# import system modules
import arcpy
msgNoLicenseSchematicsAvailable = "Erweiterung "ArcGIS Schematics" license required"
msgNoLicenseNetworkAnalystAvailable = "Erweiterung "ArcGIS Network Analyst" license required"
try:
# Checks out the Erweiterung "ArcGIS Schematics" licence
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseSchematicsAvailable)
# Checks out the Erweiterung "ArcGIS Network Analyst" licence
if arcpy.CheckExtension("Network") == "Available":
arcpy.CheckOutExtension("Network")
else:
raise Exception(msgNoLicenseNetworkAnalystAvailable)
# Sets environnement settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\Network_Dataset\NetworkAnalyst_Schematics.gdb"
# CreateDiagram from a solved route network analysis layer
# 1) Solves the route network analysis layer, Tour1
arcpy.Solve_na("Routes\Tour1")
# 2) Creates diagrams from this solved route network analysis layer
# a - DiagramTour_MERGED diagram, where a single schematic feature node is created to represent a network junction which is crossed N times along the resultant route (MERGE_NODES option)
arcpy.CreateDiagram_schematics("NA_SchematicDataset", "DiagramTour_MERGED", "NADiagrams", "Routes\Tour1", "MERGE_NODES")
# b - DiagramTour_NOTMERGED diagram, where N schematic nodes are created to represent a network junction which is crossed N times along the resultant route (NOT_MERGE_NODES option)
arcpy.CreateDiagram_schematics("NA_SchematicDataset", "DiagramTour_NOTMERGED", "NADiagrams", "Routes\Tour1", "NO_MERGE_NODES")
# 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 occured on line %i" % tb.tb_lineno
print str(e)
Create 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: CreateDiagramXML.py
# Description: Create a sample schematic diagram based on the XML builder
# Requirement: Erweiterung "ArcGIS Schematics"
# import system modules
import arcpy
msgNoLicenseAvailable = "Erweiterung "ArcGIS Schematics" license required"
try:
# Checks out the Erweiterung "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, SampleNetworkData.xml file
arcpy.CreateDiagram_schematics("XMLDataset", "XMLDiagramSample", "XMLDiagrams", "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data\SampleNetworkData.xml")
# Returns the Erweiterung "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 occured on line %i" % tb.tb_lineno
print str(e)
Create a sample schematic diagram from custom queries.
How to use this Python script example:
- Start ArcCatalog.
- This script works on a copy of the ElecDemo tutorial geodatabase to avoid overwriting the original inside plant diagram:
- Navigate to the C:\ArcGIS\ArcTutor\Schematics\Schematics_In_ArcMap folder in the Catalog tree.
- Copy and paste the ElecDemo geodatabase. The newly created ElecDemo_1 geodatabase is the one on which the script sample is going to process.
- Copy and paste the following script in the ArcCatalog or ArcMap Python window.
- Press ENTER.
# Name: CreateDiagramCustomQuery.py
# Description: Create a schematic diagram from custom queries
# Requirement: Erweiterung "ArcGIS Schematics"
# import system modules
import arcpy
msgNoLicenseAvailable = "Erweiterung "ArcGIS Schematics" license required"
try:
# Checks out the Erweiterung "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_1.gdb"
# CreateDiagram from a diagram template, InsidePlants, which is configured to generate diagrams from custom queries
arcpy.CreateDiagram_schematics("ElecDemo\Inside Plants", "Substation 08", "InsidePlants")
# Returns the Erweiterung "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 occured on line %i" % tb.tb_lineno
print str(e)