CreateScratchName

サマリ

Creates a unique scratch path name for the specified data type. If no workspace is given the current workspace is used.

構文

CreateScratchName ({prefix}, {suffix}, {dataType}, {workspace})
パラメータ説明データ タイプ
prefix

The prefix that is added to the scratchname. By default, a prefix of xx is used.

(デフォルト値は xx)

String
suffix

The suffix added to the scratchname. This can be an empty double-quoted string.

String
dataType

The data type which will be used to create the scratchname. Valid datatypes are:

  • CoverageOnly valid Coverage names are returned.
  • DatasetOnly valid Dataset names are returned.
  • FeatureClassOnly valid FeatureClass names are returned.
  • FeatureDatasetOnly valid FeatureDataset names are returned.
  • FolderOnly valid Folder names are returned.
  • GeodatasetOnly valid Geodataset names are returned.
  • GeometricNetworkOnly valid Geometric Network names are returned.
  • ArcInfoTableOnly valid ArcInfo Table names are returned.
  • NetworkDatasetOnly valid Network Dataset names are returned.
  • RasterBandOnly valid Raster Band names are returned.
  • RasterCatalogOnly valid Raster Catalog names are returned.
  • RasterDatasetOnly valid Raster Dataset names are returned.
  • ShapefileOnly valid Shapefile names are returned.
  • TerrainOnly valid Terrain names are returned.
  • WorkspaceOnly valid Workspace scratchnames are returned.
String
workspace

The workspace used to determine the scratch name to be created. If not specified, the current workspace is used.

String
リターン
データ タイプ説明
String

The unique scratch path name.

コードのサンプル

CreateScratchName example

Create a unique scratch name for the derived output of the Buffer tool. This scratch name is then used as input to the Clip tool.

import arcpy
from arcpy import env

# Set workspace
#
env.workspace = "C:/Data/Municipal.gdb"

# Create a scratch name for the Buffer tool derived output.
#   The scratch name created will be "C:/Data/xxxx0.shp",
#   If xxxx0.shp already exists, the number will be incremented
#   until the name is unique in the workspace.
#
scratch_Name = arcpy.CreateScratchName("xxxx", "", "Shapefile", "C:/Data")

# Execute Buffer tool, using scratch name for output
#
arcpy.Buffer_analysis("Roads", scratch_Name, "1000 feet")

# Execute Clip tool, using scratch name for input
#
arcpy.Clip_analysis(scratch_Name, "CityBoundary", "CityRoads")

# Delete scratch dataset
arcpy.Delete_management(scratch_Name)

関連項目


7/10/2012