plaer 发表于 2007-4-29 15:59:00

请问如何设置选择过滤,请看这段代码的问题。

<p>&nbsp;&nbsp;&nbsp;Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;<br/>&nbsp;&nbsp;&nbsp;Autodesk.AutoCAD.DatabaseServices.TypedValue[] tv = new TypedValue;<br/>&nbsp;&nbsp;&nbsp;tv=new TypedValue(0,"POLYLINE");<br/>&nbsp;&nbsp;&nbsp;Autodesk.AutoCAD.EditorInput.SelectionFilter sf = new SelectionFilter(tv);<br/>&nbsp;&nbsp;&nbsp;PromptSelectionOptions opts =new PromptSelectionOptions();<br/>&nbsp;&nbsp;&nbsp;opts.AllowDuplicates = true;<br/>&nbsp;&nbsp;&nbsp;opts.MessageForAdding="请选择一条等高线:";<br/>&nbsp;&nbsp;&nbsp;PromptSelectionResult&nbsp; res = ed.GetSelection(opts,sf);<br/>&nbsp;&nbsp;&nbsp;if(res.Status!=PromptStatus.OK)<br/>&nbsp;&nbsp;&nbsp;&nbsp;return;<br/>&nbsp;&nbsp;&nbsp;Autodesk.AutoCAD.EditorInput.SelectionSet ss = res.Value;<br/>&nbsp;&nbsp;&nbsp;ObjectId[] oids = ss.GetObjectIds();<br/>&nbsp;&nbsp;&nbsp;for(int i=0;i&lt;oids.Length;i++)<br/>&nbsp;&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;ed.WriteMessage("\n"+oids.ToString());<br/>&nbsp;&nbsp;&nbsp;}</p><p>以上代码想实现只选择多段线,但是却选不到多段线。是什么问题呢??</p>

sbydo 发表于 2007-8-26 19:43:00

<p>你的等高线是否 “拟合”过,如果拟合过应该可以。</p><p>如果没有拟合过,那么就是lwpolyline:&nbsp;&nbsp;&nbsp;&nbsp; tv=new TypedValue(0,"LWPOLYLINE");轻多义线</p>
页: [1]
查看完整版本: 请问如何设置选择过滤,请看这段代码的问题。