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