サマリー
入力テーブルのサブタイプに、デフォルトの値またはコードを設定します。
使用法
- デフォルト コードを設定する前に、入力テーブルにはサブタイプ コードが含まれている必要があります。サブタイプ コードを作成するには、[サブタイプの追加 (Add Subtype)] および [サブタイプ フィールドの設定 (Set Subtype Field)] ツールを使用します。 
- フィーチャクラスまたはテーブルのサブタイプは、ArcCatalog で管理することも可能です。データセットの [プロパティ] ダイアログ ボックスにある サブタイプ プロパティ ページを使って、サブタイプを作成および変更することができます。 
構文
SetDefaultSubtype_management (in_table, subtype_code)
| パラメーター | 説明 | データ タイプ | 
| in_table | サブタイプのデフォルト値を設定する、入力テーブルまたはフィーチャクラス。 | Table View | 
| subtype_code | サブタイプのデフォルトの個別値。 | Long | 
コードのサンプル
Set Default Subtype (デフォルト サブタイプの設定) の例 (Python ウィンドウ)
次の Python ウィンドウ スクリプトは、Set Default Subtype (デフォルト サブタイプの設定) 関数をイミディエイト モードで使用する方法を、例を挙げて示したものです。
import arcpy
arcpy.env.workspace = "C:/data/Montgomery.gdb"
arcpy.SetDefaultSubtype_management("water/fittings", 5)
Set Default Subtype (デフォルト サブタイプの設定) の例 2 (スタンドアロン スクリプト)
次のスタンドアロン スクリプトは、サブタイプをフィールドに追加するワークフローの一部として、Set Default Subtype (デフォルト サブタイプの設定) 関数を使用する方法を示しています。
#Name: ManageSubtypes.py
# Purpose: Create a subtype definition
# Import system modules
import arcpy
 
try:
    # Set the workspace (to avoid having to type in the full path to the data every time)
    arcpy.env.workspace =  "C:/data/Montgomery.gdb"
    
    # Set local parameters
    inFeatures = "water/fittings"
 
    # Process: Set Subtype Field...
    arcpy.SetSubtypeField_management(inFeatures, "TYPECODE")
     
    # Process: Add Subtypes...
    # Store all the suptype values in a dictionary with the subtype code as the "key" and the 
    # subtype description as the "value" (stypeDict[code])
    stypeDict = {"0": "Unknown", "1": "Bend", "2": "Cap", "3": "Cross", "4": "Coupling",\
                 "5": "Expansion joint", "6": "Offset", "7":"Plug", "8": "Reducer",\
                 "9": "Saddle", "10": "Sleeve", "11": "Tap", "12": "Tee", "13": "Weld", "14": "Riser"} 
    
    # use a for loop to cycle through the dictionary
    for code in stypeDict:
        arcpy.AddSubtype_management(inFeatures, code, stypeDict[code])     
			
    # Process: Set Default Subtype...
    arcpy.SetDefaultSubtype_management(inFeatures, "4")
 
except Exception as err:
    print(err.args[0])
環境
ライセンス情報
- ArcGIS Desktop Basic: はい
- ArcGIS Desktop Standard: はい
- ArcGIS Desktop Advanced: はい