用C#语言基于ActiveX二次开发AutoCAD时,想实现选择CAD界面的一个圆,能返回程序中该圆的原点坐标。希望大神们教教我!
1条回答 默认 最新
- 依然如昨 2018-01-10 06:21关注
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
PromptSelectionResult selectionRes = ed.SelectImplied();
PromptSelectionOptions selectionOpts = new PromptSelectionOptions();
selectionOpts.MessageForAdding = "\n选择圆: ";
selectionRes = ed.GetSelection(selectionOpts);
if (selectionRes.Status == PromptStatus.OK)
{SelectionSet SS = selectionRes.Value; ObjectId[] idArray = SS.GetObjectIds(); for (int i = 0; i < idArray.Length; i++) { if(Tools.GetDBObject(idArray[i]).ObjectName == "AcDbCircle" ) { AcadCircle circle = (AcadCircle)Tools.GetDBObject(idArray[i]); double[] d= (double[])circle.Center; String s="圆心坐标是:" + "X= " + d[0] + " Y= " + d[1] + " Z= " + d[2] ; } }
}
解决 无用评论 打赏 举报