赞
踩
- Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
- Database db = doc.Database;
- Editor ed = doc.Editor;
- 选择所有元素
- //PromptSelectionResult psr = ed.SelectAll();
- //单个选择
- PromptSelectionResult psr = ed.GetSelection();
- if (psr.Status==PromptStatus.OK)
- {
- SelectionSet sSet = psr.Value;
- ObjectId[] Ids = sSet.GetObjectIds();
- using (Transaction trans = db.TransactionManager.StartTransaction())
- {
- for (int i = 0; i < Ids.Length; i++)
- {
- Entity ent = Ids[i].GetObject(OpenMode.ForWrite) as Entity;
- ent.ColorIndex = 1;
- }
- trans.Commit();
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。