autocad.net 图元名柄handle保存为string格式后再转换成objectid的函数
#region 将handle转换为objectid /// <summary> /// 将handle转换为objectid /// </summary> /// <param name="db">database</param> /// <param name="handle">handle字符串</param> /// <returns>ObjectId</returns> public static ObjectId GetObjectId(this Database db, string handle) { Handle h = new Handle(Int64.Parse(handle, NumberStyles.AllowHexSpecifier)); ObjectId id = ObjectId.Null; db.TryGetObjectId(h, out id); return id; } #endregion