/// <summary>
/// 获取对象指定注册名的XData
/// </summary>
/// <param name=”obj”>对象</param>
/// <param name=”regApptableName”>注册名</param>
/// <returns></returns>
public static ResultBuffer GetXdata(DBObject obj, string regApptableName)
{
ResultBuffer pXdata = obj.XData;
if (pXdata == null)
{
return null;
}
ResultBuffer rb = new ResultBuffer();
TypedValue[] tvs = pXdata.AsArray();
for (int i = 0; i < tvs.Length; i++)
{
TypedValue tv = tvs[i];
if (tv.TypeCode != (short)DxfCode.ExtendedDataRegAppName)
continue;
if (string.Compare(tv.Value.ToString(), regApptableName) != 0)
continue;
rb.Add(tv);
for (int j = i + 1; j < tvs.Length; j++)
{
TypedValue tv1 = tvs[j];
if (tv1.TypeCode == (short)DxfCode.ExtendedDataRegAppName)
{
return rb;
}
rb.Add(tv1);
if (j == tvs.Length – 1)
{
return rb;
}
}
}
return null;
}
CAD好帮手
-
近期文章
分类目录
简洁版
链接表
功能
分享统计