怎么获取选择集?
<p>C#2005+CAD2007</p><p>怎么获取我在图中选择的对象集合?再对这些集合进行下一步处理呢?</p> <p>//获取Editor对象<br/> Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;</p><p> // 定义选择集选项<br/> PromptSelectionOptions selectionOp = new PromptSelectionOptions();<br/> //创建选择集过滤器,只选择块对象<br/> TypedValue[] filList = new TypedValue;<br/> filList = new TypedValue((int)DxfCode.Start, "POINT");////获取Editor对象<br/> Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;</p><p> // 定义选择集选项<br/> PromptSelectionOptions selectionOp = new PromptSelectionOptions();<br/> //创建选择集过滤器,只选择块对象<br/> TypedValue[] filList = new TypedValue;<br/> filList = new TypedValue((int)DxfCode.Start, "POINT");//到CAD中去看到底实体的类别是什么<br/> filList = new TypedValue((int)DxfCode.LayerName, "高程点");//"20071231坡底线");//建立图层选择集<br/> SelectionFilter filter = new SelectionFilter(filList);<br/> PromptSelectionResult ssRes = ed.GetSelection(selectionOp, filter);//GetSelection用户选择<br/> //PromptSelectionResult ssRes = ed.SelectAll(filter);//SelectAll用户选择全部选择<br/> if (ssRes.Status == PromptStatus.OK)<br/> {<br/> SelectionSet SS = ssRes.Value;<br/> int nCount = SS.Count;实体的类别是什么 POINT或者其它<br/> SelectionFilter filter = new SelectionFilter(filList);<br/> PromptSelectionResult ssRes = ed.GetSelection(selectionOp, filter);//GetSelection用户选择<br/> //PromptSelectionResult ssRes = ed.SelectAll(filter);//SelectAll用户选择全部选择<br/> if (ssRes.Status == PromptStatus.OK)<br/> {<br/> SelectionSet SS = ssRes.Value;<br/> int nCount = SS.Count;<br/> //<br/> 加入自己处理代码<br/> //</p><p> }</p>
页:
[1]