Create Diagram (Schematics)
Récapitulatif
This tool 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.
Utilisation
-
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, 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.
Syntaxe
| Paramètre | Explication | Type de données |
out_location |
Schematic dataset or schematic folder in which the diagram will be created. Attention :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. | |
in_data (Facultatif) |
The input data required to generate the diagram. The Input Data parameter specifies the elements on which the diagram generation will be based. It is a mandatory parameter for most of the predefined schematic builders:
Attention :For diagram templates that work with the Standard builder when it is configured to operate from a geometric network, XML builder, and Network Dataset builder, if no input data is specified, the diagram cannot be generated. | Tableview;Layer;Data element |
builder_options (Facultatif) |
The schematic builder creation parameters. These are optional; they are only used for diagrams based on the Network Dataset builder to specify whether nodes will be merged. No option is required for the other schematic builders.
| String |
Exemple de code
Create schematic diagrams from GIS features organized into a geometric network.
# Name: CreateDiagramStd.py
# Description: Create schematic diagrams from GIS features organized into a geometric network
# Author: ESRI
# import system modules
import arcpy
msgNoLicenseAvailable = "Schematics license required"
try:
# Check out the ArcGIS Schematic extension license
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseAvailable)
# Set environment settings
arcpy.OverWriteOutput = True
arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_In_ArcMap\ElecDemo.gdb"
#Process: CreateDiagram from the Feeder feature class: A diagram containing schematic features associated with each GIS feature stored in that feature class will be created.
arcpy.CreateDiagram_schematics("ElecDemo", "FeederDiagram", "GeoSchematic", "ElectricNetwork\Feeder")
#Process: CreateDiagram based on all primary lines Phase ABC
# 1) Create a layer with the selection
InputLayer = arcpy.MakeFeatureLayer_management(r'ElectricNetwork\PrimaryLine',"PrimaryLineLayer", "[PHASECODE] =135")
# 2) Use the layer as input of CreateDiagram
arcpy.CreateDiagram_schematics("ElecDemo", "ElectricMainNetworkDiagram", "GeoSchematic", InputLayer)
# Returns the schematic license
arcpy.CheckInExtension("Schematics")
except Exception as exc:
print exc
Create schematic diagrams from a solved network analysis layer.
# Name: CreateDiagramNDS.py
# Description: Create schematic diagrams based on the Network Dataset builder
# Author: ESRI
# import system modules
import arcpy
msgNoLicenseAvailable = "Schematics license required"
try:
# Check out the ArcGIS Schematic extension license
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseAvailable)
# Check out the Network Analyst extension license
if arcpy.CheckExtension("Network Analyst") == "Available":
arcpy.CheckOutExtension("Network Analyst")
else:
raise Exception(msgNoLicenseNetworkAnalystAvailable)
# Set environment settings
arcpy.OverWriteOutput = True
arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\Network_Dataset\NetworkAnalyst_Schematics.gdb"
#Solving the Route network analysis layer
arcpy.solve("Route", "HALT")
#Process: CreateDiagram from the solved Route network analysis layer: A diagram containing schematic features associated with each route objects in that network analysis layer will be created. Depending on the MERGE_NODES and NO_MERGE_NODES option, network element junctions which are taken several times along the resultant route will be represented by a single schematic feature node in the generated schematic diagram (MERGE_NODES) or not (NO_MERGE_NODES)
arcpy.CreateDiagram_schematics("NA_SchematicDataset", "DiagramRoute1_MERGED", "NADiagrams", "Route", "MERGE_NODES")
arcpy.CreateDiagram_schematics("NA_SchematicDataset", "DiagramRoute1_NOTMERGED", "NADiagrams", "Route", "NO_MERGE_NODES")
# Returns the schematic license
arcpy.CheckInExtension("Schematics")
arcpy.CheckInExtension("Network Analyst")
except Exception as exc:
print exc
Create a schematic diagram based on the XML builder.
# Name: CreateDiagramXML.py
# Description: Create a schematic diagram based on the XML builder
# Author: ESRI
# import system modules
import arcpy
msgNoLicenseAvailable = "Schematics license required"
try:
# Check out the ArcGIS Schematic extension license
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseAvailable)
# Set environment settings
arcpy.OverWriteOutput = True
arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data\GISDatabaseForXML.gdb"
#Process: CreateDiagram from the SampleNetworkData.xml file based on the XMLBuilderDiagram XML Schema file: A diagram containing schematic features associated with each element stored in that XML file will be created.
arcpy.CreateDiagram_schematics("XMLSampleSchDataset", "XMLDiagramSample", "XMLDiagrams", "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data\SampleNetworkFeeder1.xml")
# Returns the schematic license
arcpy.CheckInExtension("Schematics")
except Exception as exc:
print exc
Create a schematic diagram from custom queries.
# Name: CreateDiagramCustomQuery.py
# Description: Create a schematic diagram from custom queries
# Author: ESRI
# import system modules
import arcpy
msgNoLicenseAvailable = "Schematics license required"
try:
# Check out the ArcGIS Schematic extension license
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseAvailable)
# Set environment settings
arcpy.OverWriteOutput = True
arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_In_ArcMap\ElecDemo.gdb"
#Process: CreateDiagram from the InsidePlants diagram template.
arcpy.CreateDiagram_schematics("ElecDemo\Inside Plants", "Substation 08", "InsidePlants")
# Returns the schematic license
arcpy.CheckInExtension("Schematics")
except Exception as exc:
print exc
