FieldDefinition.Get 方法以字典形式获取指定字段的要素图层字段属性。
声明
public Dictionary<string, object> Esri.ArcGISForAutoCAD.FieldDefinition.Get(Document doc, string flName, string name, string sublayerName = null)
参数
| 类型 | 名称 | 描述 | 必填 |
|---|---|---|---|
文档 | doc | 要进行操作的 AutoCAD 文档。 | 必填 |
string | flName | 工程图中现有的要素图层名称。 | 必填 |
string | name | 字段名称。 | 必填 |
string | sublayerName | 子图层名称。 如果您希望获取可能与父要素图层不同的目标子图层的相应字段定义,则此参数为必需项。 | 可选 |
返回
| 类型 | 描述 |
|---|---|
Dictionary<string, object> | 字段属性的字典。 下表描述了字典的键和值。 |
| 键 | 类型 | 值描述 |
|---|---|---|
"NAME" | string | 字段名称。 |
"TYPE" | string | 字段类型 |
"READONLY" | bool | 指定字段是否为只读(true = 只读)。 |
"LENGTH" | int | 字段 X 的长度。 |
"VALUE" | IConvertible | 字段定义的默认值,其类型与字段类型相同。 如果字段具有编码值属性域,则默认值为索引值,而不是描述值。 |
"DOMAIN" | string | 字段属性域定义的名称。 |
错误条件备注
如果参数无效,则此方法可能会抛出异常或者返回 null。
示例
打印 UtilityPoles 要素图层 Steel 子类型的 PoleType 字段的字段属性。// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
// Get the field definition properties
var fieldProperties = Esri.ArcGISForAutoCAD.FieldDefinition.Get(doc, "UtilityPoles", "PoleType", "Steel");
// Print the field definition properties
foreach (var property in fieldProperties)
{
doc.Editor.WriteMessage("\n{0}: {1}", property.Key, property.Value);
}
/* Example output
NAME: PoleType
TYPE: Short
READONLY: False
LENGTH: -1
VALUE: 1
DOMAIN: UtilityPoles_TypeDomain
*/
另请参阅
esri_fielddef_get - 此 AutoLISP 函数以关联列表形式获取要素图层的要素图层字段属性。