标注 | 说明 | 数据类型 |
输入表 | 包含要设置为子类型字段的字段的输入表或要素类。 | Table View |
字段名 (可选) | 将存储子类型编码的整型字段。 | Field |
清除值 (可选) | 指定是否清除子类型字段。
| Boolean |
派生输出
标注 | 说明 | 数据类型 |
更新的输入表 | 已更新的表或要素类。 | Table View |
定义输入表或要素类中存储子类型代码的字段。
标注 | 说明 | 数据类型 |
输入表 | 包含要设置为子类型字段的字段的输入表或要素类。 | Table View |
字段名 (可选) | 将存储子类型编码的整型字段。 | Field |
清除值 (可选) | 指定是否清除子类型字段。
| Boolean |
标注 | 说明 | 数据类型 |
更新的输入表 | 已更新的表或要素类。 | Table View |
arcpy.management.SetSubtypeField(in_table, {field}, {clear_value})
名称 | 说明 | 数据类型 |
in_table | 包含要设置为子类型字段的字段的输入表或要素类。 | Table View |
field (可选) | 将存储子类型编码的整型字段。 | Field |
clear_value (可选) | 指定是否清除子类型字段。
| Boolean |
名称 | 说明 | 数据类型 |
out_table | 已更新的表或要素类。 | Table View |
以下 Python 窗口脚本演示了如何在即时模式下使用 SetSubtypeField 函数。
import arcpy
arcpy.env.workspace = "C:/data/Montgomery.gdb"
arcpy.management.SetSubtypeField("water/fittings", "TYPECODE")
以下独立脚本演示了如何在将子类型添加到字段的工作流中使用 SetSubtypeField 函数。
# Name: ManageSubtypes.py
# Purpose: Create a subtype definition
# Import system modules
import arcpy
# 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.management.SetSubtypeField(inFeatures, "TYPECODE")
# Process: Add Subtypes...
# Store all the subtype 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.management.AddSubtype(inFeatures, code, stypeDict[code])
# Process: Set Default Subtype...
arcpy.management.SetDefaultSubtype(inFeatures, "4")
以下 Python 窗口脚本演示了如何在即时模式下使用 SetSubtypeField 函数来清除子类型字段。
import arcpy
arcpy.env.workspace = "C:/data/Montgomery.gdb"
arcpy.management.SetSubtypeField("water/fittings", "", "CLEAR_SUBTYPE_FIELD")