各位大侠:
环境(vs2010+cad2010)
nuutma5oqf0.png
在上图中:选择整个图形,然后按照一个基点(或者就是以左下角坐标为基点)旋转90或-90。选择所有对象的代码如下:
- public static DBObjectCollection Collection()
- {
- Document doc = Autodesk..ApplicationServices.Application.DocumentManager.MdiActiveDocument;
- Database db=doc. Database;
- Editor ed=doc. Editor;
- Entity entity=null;
- DBObjectCollection entityCollection=new DBObjectCollection();
- PromptSelectionResult ents = ed.GetSelection();
- if (ents.Status == PromptStatus. OK)
- {
- using (Transaction transaction = db.TransactionManager.StartTransaction())
- {
- SelectionSet SS = ents.Value;
- foreach (ObjectId id in SS.GetObjectIds())
- {
- entity = (Entity)transaction.GetObject(id, OpenMode.ForWrite, true);
- if (entity != null)
- entityCollection.Add(entity);
- }
- transaction.Commit();
- }
- }
- return entityCollection;
- }
所有对象的返回值是DBObjectCollection类型的,但怎么对这个类型以指定的基点进行旋转
|