tiger0101 发表于 2005-9-13 21:44:00

如何实现复合选择(如选择图层为"zd",红色的多段线)

<P>如何实现复合选择(如选择图层为"zd",红色的多段线)</P>
<P>cad的帮助写的太简略了</P>
<P>ssObj.select语句,它的过滤条件不知道怎么写</P>
<P>请高手相助,我想应该能够一次选中吧?</P>

alin 发表于 2005-9-13 22:31:00

<P>Sub Example_Select()</P>
<P>&nbsp;&nbsp;&nbsp; Dim ssetObj As AcadSelectionSet<BR>&nbsp;&nbsp;&nbsp; On Error Resume Next<BR>&nbsp;&nbsp;&nbsp; Set ssetObj = ThisDrawing.SelectionSets.Add("SSET")<BR>&nbsp;&nbsp;&nbsp; If Err &lt;&gt; 0 Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set ssetObj = ThisDrawing.SelectionSets.Item("SSET")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ssetObj.Clear<BR>&nbsp;&nbsp;&nbsp; End If<BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Dim mode As Integer<BR>&nbsp;&nbsp;&nbsp; Dim obj As AcadEntity<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; mode = acSelectionSetAll</P>
<P>&nbsp;&nbsp;&nbsp; Dim gpCode(2) As Integer<BR>&nbsp;&nbsp;&nbsp; Dim dataValue(2) As Variant<BR>&nbsp;&nbsp;&nbsp; gpCode(0) = 0<BR>&nbsp;&nbsp;&nbsp; dataValue(0) = "LWPOLYLINE"<BR>&nbsp;&nbsp;&nbsp; gpCode(1) = 8<BR>&nbsp;&nbsp;&nbsp; dataValue(1) = "zd"<BR>&nbsp;&nbsp;&nbsp; gpCode(2) = 62<BR>&nbsp;&nbsp;&nbsp; dataValue(2) = 1<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Dim groupCode As Variant, dataCode As Variant<BR>&nbsp;&nbsp;&nbsp; groupCode = gpCode<BR>&nbsp;&nbsp;&nbsp; dataCode = dataValue<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; ssetObj.Select mode, , , groupCode, dataCode<BR>&nbsp;&nbsp;&nbsp; MsgBox "图中有" &amp; ssetObj.Count &amp; "个图元已加入到选择集SSET中。"<BR>&nbsp;&nbsp;&nbsp; For Each obj In ssetObj<BR>&nbsp;&nbsp;&nbsp;&nbsp; obj.Highlight True<BR>&nbsp;&nbsp;&nbsp; Next<BR>&nbsp;&nbsp;&nbsp; <BR>End Sub</P>

tiger0101 发表于 2005-9-14 22:57:00

3ku vermuch
页: [1]
查看完整版本: 如何实现复合选择(如选择图层为"zd",红色的多段线)