在AU社区中搜索到的帖子,
留存备忘。
代码复制至此:
public static class ViewportExtensions { /// <summary> /// Returns the Viewort type: /// 0 = undefined, /// 1 = Plan, /// 2 = Profile, /// 3 = Section /// </summary> /// <param name="vp"></param> /// <returns></returns> public static short GetViewportType(this Viewport vp) { short vptype = 0; var xArray = vp.XData.AsArray(); int i = -1; foreach (TypedValue tv in xArray) { i++; try { if ((string)tv.Value == "AeccPlanProd50ViewportType") { vptype = (short)xArray[i + 1].Value; break; } } catch { } } return vptype; }
感谢Jeff_M!