我的测试代码很正常哈
-
-
- [CommandMethod("tt6")]
- public static void test26()
- {
- Document doc = Application.DocumentManager.MdiActiveDocument;
- Editor ed = doc.Editor;
- Database db = doc.Database;
- var resSel = ed.GetSelection();
- if (resSel.Status != PromptStatus.OK)
- return;
- using (Transaction tr = db.TransactionManager.StartTransaction())
- {
- DBDictionary groupDict = tr.GetObject(db.GroupDictionaryId, OpenMode.ForWrite) as DBDictionary;
- Group g = new Group();
- g.Append(new ObjectIdCollection(resSel.Value.GetObjectIds()));
- groupDict.SetAt("*", g);
- tr.AddNewlyCreatedDBObject(g, true);
- tr.Commit();
- }
- }
|