兰州人 发表于 2008-11-9 15:45:00

选择集应用一列

<p>通过选择交叉实体,返回选择集内包括文本实体。</p><p>Function CreateSelectionSetCrossingText(pt1 As Variant, pt2 As Variant) As AcadSelectionSet<br/>&nbsp;&nbsp; On Error Resume Next<br/>&nbsp;&nbsp; Dim sSet As AcadSelectionSet<br/>&nbsp;&nbsp; 'Dim SSet As AcadSelectionSet<br/>&nbsp;&nbsp; If Not IsNull(ThisDrawing.SelectionSets.Item("SelectEntity")) Then<br/>&nbsp;&nbsp;&nbsp;&nbsp; Set sSet = ThisDrawing.SelectionSets.Item("SelectEntity")<br/>&nbsp;&nbsp;&nbsp;&nbsp; sSet.Delete<br/>&nbsp;&nbsp; End If<br/>&nbsp;&nbsp; Set sSet = ThisDrawing.SelectionSets.Add("SelectEntity")<br/>&nbsp;&nbsp; Dim gpCode(0) As Integer<br/>&nbsp;&nbsp; Dim dataValue(0) As Variant<br/>&nbsp;&nbsp; gpCode(0) = 0<br/>&nbsp;&nbsp; dataValue(0) = "Text"<br/>&nbsp;&nbsp; <br/>&nbsp;&nbsp; sSet.Select acSelectionSetCrossing, pt1, pt2, gpCode, dataValue</p><p>&nbsp;&nbsp; Set CreateSelectionSetCrossingText = sSet</p><p>End Function</p><p><br/>Sub lsls()<br/>&nbsp; Dim pt1, pt2<br/>&nbsp; Dim sSet As AcadSelectionSet<br/>&nbsp; pt1 = ThisDrawing.Utility.GetPoint(, "Input First Point")<br/>&nbsp; pt2 = ThisDrawing.Utility.GetCorner(pt1, "Input First Point")<br/>&nbsp; Set sSet = CreateSelectionSetCrossingText(pt1, pt2)<br/>&nbsp; Dim objText As AcadText<br/>&nbsp; For ii = 0 To sSet.Count - 1<br/>&nbsp;&nbsp;&nbsp; Set objText = sSet.Item(ii)<br/>&nbsp;&nbsp;&nbsp; Debug.Print objText.TextString<br/>&nbsp; Next ii<br/>End Sub</p><p></p>

robbin840311 发表于 2008-11-11 08:02:00

本帖最后由 作者 于 2008-11-11 8:03:10 编辑 <br /><br /> <strong><font face="Verdana" color="#da2549">兰州人发贴,属于精品,顶。</font></strong>
页: [1]
查看完整版本: 选择集应用一列