大侠们,Group怎么应用啊
各位大侠:环境(vs2010+cad2010)
我想实现:点击按钮把自定义的圆、直线,块加到一个组中,然后,点击其中任意一个实体,其他实体全部选中,然后删除。
public void test()
{
Point3d p = new Point3d(1000, 1000, 0);
BlockReference br = cadFun.t(p, "DET_004", 1, 0);//插入一个名字为“DET_004”的块参照
Line l = new Line(p,new Point3d(p.X+1000,p.Y+1000,0));
cadFun.insertModelSpace(l);
Circle acCirc = new Circle();
acCirc.SetDatabaseDefaults();
acCirc.Center = new Point3d(1590, 2000, 0);
acCirc.Radius = 500;
cadFun.insertModelSpace(acCirc);
Group gp = new Group();
gp.Selectable = false;
gp.Append(l.ObjectId);
gp.Append(br.ObjectId);
gp.Append(acCirc.ObjectId);
}
我这么写完后,选择任意一个,也不是都选中啊,具体怎么弄啊,大侠们!!!!!
Group 一样需要加入 Database
Default constructor. Initializes the group description string to NULL, Selectable to true, and the entities list to empty.
Before the Group object can be added to a database, it must have its Description property called to set a valid description string.
//新建一个组对象
Group gp = new Group(groupName, true);
gp.Append(ids);
//打开当前数据库的组字典对象以加入新建的组对象
DBDictionary dictG = (DBDictionary)trans.GetObject(db.GroupDictionaryId, OpenMode.ForWrite);
//在组字典中将组对象作为一个新条目加入,并指定它的搜索关键字为groupName
dictG.SetAt(groupName, gp);
trans.AddNewlyCreatedDBObject(gp, true);
页:
[1]