- 积分
- 24557
- 明经币
- 个
- 注册时间
- 2004-3-17
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2010-12-31 17:44:49
|
显示全部楼层
- public static void DisplayAll(Transaction tr, Editor ed, string name, ObjectId id, int rank)
- {
- var obj = tr.GetObject(id, OpenMode.ForRead);
- ed.WriteMessage("\n{0}Name:{1} Type:{2}", new string(' ', rank * 4), name, obj.GetType().Name);
- var dict = obj as DBDictionary;
- if (dict != null)
- {
- foreach (DBDictionaryEntry entry in dict)
- {
- DisplayAll(tr, ed, entry.Key, entry.m_value, rank + 1);
- }
- }
- }
- [CommandMethod("t2")]
- public static void Test2()
- {
- var doc = Application.DocumentManager.MdiActiveDocument;
- var db = doc.Database;
- var ed = doc.Editor;
- using (var tr = db.TransactionManager.StartTransaction())
- {
- DisplayAll(tr, ed, "根字典", db.NamedObjectsDictionaryId, 0);
- }
- }
|
|