兰州人 发表于 2007-12-26 14:25:00

仿qselect 命令---选择集+过滤器

<p>仿qselect 命令</p><p>练习选择集+过滤器用法。</p><p>Sub ReadEntityData()<br/>&nbsp; Dim Obj As AcadEntity<br/>&nbsp; Dim sel As AcadSelectionSet<br/>&nbsp; Dim seldata(0) As Variant, selcode(0) As Integer<br/>&nbsp; Dim gpdata As Variant, gpcode As Variant<br/>&nbsp; Dim pt(0 To 2) As Double, pt1(0 To 2) As Double</p><p>&nbsp;&nbsp;&nbsp; With ThisDrawing<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = .Utility.GetPoint(, "指定左上角:")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetRet ret, pt<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = .Utility.GetCorner(pt, "指定对角点:")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetRet ret, pt1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set sel = .SelectionSets.Add("ss")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; selcode(0) = 0: gpcode = selcode<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; seldata(0) = "Line": gpdata = seldata<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sel.Select acSelectionSetCrossing, pt, pt1, gpcode, gpdata<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.Print sel.count<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .SelectionSets.Item("ss").Clear<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Set sel = .SelectionSets.Add("ss")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; selcode(0) = 0: gpcode = selcode<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; seldata(0) = "Dimension": gpdata = seldata<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sel.Select acSelectionSetCrossing, pt, pt1, gpcode, gpdata<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.Print sel.count&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .SelectionSets.Item("ss").Delete<br/>&nbsp;&nbsp;&nbsp; End With<br/>&nbsp;&nbsp;&nbsp; <br/>End Sub</p><p><br/>Private Sub SetRet(ret As Variant, pt() As Double)<br/>&nbsp;&nbsp;&nbsp; pt(0) = ret(0)<br/>&nbsp;&nbsp;&nbsp; pt(1) = ret(1)<br/>&nbsp;&nbsp;&nbsp; pt(2) = ret(2)<br/>End Sub<br/></p>
页: [1]
查看完整版本: 仿qselect 命令---选择集+过滤器