Create Diagram (Schematics)

Zusammenfassung

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.

Verwendung

Syntax

CreateDiagram_schematics (out_location, out_name, diagram_type, {in_data}, {builder_options})
ParameterErläuterungDatentyp
out_location

Schematic dataset or schematic folder in which the diagram will be created.

VorsichtVorsicht:

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
(optional)

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:

  • For diagram templates that work with the Standard builder configured to operate from a geometric network, the Input Data parameter must at least reference a feature layer, feature class, or object table.
  • For diagram templates that work with the Network Dataset builder, the Input Data parameter 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 related to the XML builder, the Input Data parameter is optional when the data for the diagram generation is provided by an external component. But when no external component is defined for the builder properties, the Input Data must reference an XML file. In both cases, the input XML data must be built according to the XMLBuilderDiagram XML Schema file.
  • For diagram templates that work with the Standard builder configured to operate from custom queries, no input data is required.
VorsichtVorsicht:

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
(optional)

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.

  • MERGE_NODESSpecifies the network element junctions, which are taken several times along the resultant route of a route analysis to be represented by a single schematic feature node in the generated schematic diagram. It also allows you to merge midspanjunction elements when they are at the same position in a service area analysis.
  • NO_MERGE_NODESSpecifies that no schematic feature node will be merged (default).
String

Codebeispiel

Sample 1: CreateDiagram and Standard builder working on geometric network data

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
Sample 2: CreateDiagram and Network Dataset builder

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
Sample 3: CreateDiagram and XML builder

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
Sample 4: CreateDiagram and Standard builder working from custom queries

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

Umgebungen

Verwandte Themen

Lizenzinformationen

ArcView: Erfordert Schematics
ArcEditor: Erfordert Schematics
ArcInfo: Erfordert Schematics

7/10/2012