Create Diagram (Schematics)

Lizenzstufe:BasicStandardAdvanced

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

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.

AchtungAchtung:

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:

  • For diagram templates that work with the Standard builder configured to operate from a geometric network or network dataset, 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.
AchtungAchtung:

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.

  • 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

CreateDiagram and Standard builder working on geometric network data - Example 1 (Stand-alone Python script)

Create sample schematic diagrams from GIS 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: 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)
CreateDiagram and Network Dataset builder - Example 2 (Stand-alone Python script)

Create sample schematic diagrams from a solved network analysis layer.

How to run 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.
  6. 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)
CreateDiagram and XML builder - Example 3 (Stand-alone Python script)

Create 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: 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)
CreateDiagram and Standard builder working from custom queries - Example 4 (Stand-alone Python script)

Create a sample schematic diagram from custom queries.

How to use this Python script example:

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

Umgebung

Verwandte Themen

Lizenzierungsinformationen

ArcGIS for Desktop Basic: Erfordert Schematics
ArcGIS for Desktop Standard: Erfordert Schematics
ArcGIS for Desktop Advanced: Erfordert Schematics
9/11/2013