Here you go:
public class GroupCreator
{
[CommandMethod("mygroup")]
public void DoIt()
{
Editor ed =
Application.DocumentManager.MdiActiveDocument.Editor;
PromptSelectionResult res = ed.GetSelection();
if (res.Status != PromptStatus.OK)
return;
Database db =
Application.DocumentManager.MdiActiveDocument.Database;
using (Transaction t = db.TransactionManager.StartTransaction())
{
DBDictionary groupDict =
(DBDictionary)t.GetObject(db.GroupDictionaryId,OpenMode.ForWrite);
//create group
using (Group gr = new Group("This is Mikko's example
group",true))
{
groupDict.SetAt("Mikko",gr);
t.AddNewlyCreatedDBObject(gr,true);
ObjectId[] ids = res.Value.GetObjectIds();
for (int i=0;i
gr.Append(ids);
}
t.Commit();
}
}
}
wrote in message news:4865255@discussion.autodesk.com...
Anybody got a few lines of code to create a group and add entities to it?
Thanks