选择集的and和or的应用.
<p>这种组合,实现只在"AA1"图层中,找line实体.</p><p> fType(0) = -4: fData(0) = "<And"<br/> fType(2) = 0: fData(2) = "text"<br/> <br/> fType(1) = 8: fData(1) = "AA1"<br/> fType(3) = -4: fData(3) = "And>"<br/></p><p>Sub l()<br/> Dim sSet As AcadSelectionSet<br/> Dim fType(3) As Integer, fData(3) As Variant<br/> Dim sSetName As String<br/> sSetName = "First"<br/> With ThisDrawing<br/> On Error Resume Next<br/> If Not IsNull(.SelectionSets.Item(sSetName)) Then<br/> Set sSet = .SelectionSets.Item(sSetName)<br/> sSet.Delete<br/> End If<br/> Set sSet = .SelectionSets.Add(sSetName)<br/> fType(0) = -4: fData(0) = "<And"<br/> fType(2) = 0: fData(2) = "text"<br/> <br/> fType(1) = 8: fData(1) = "标题栏"<br/> fType(3) = -4: fData(3) = "And>"<br/> sSet.Select 5, , , fType, fData<br/> sSet.Highlight True<br/> 'Debug.Print sSet.Count<br/> End With<br/>End Sub</p><p>'''这种组合是图层aa1中的line和text实体</p><p> fType(0) = -4: fData(0) = "<Or"<br/> fType(1) = 8: fData(1) = "AA1"<br/> fType(2) = -4: fData(2) = "Or>"<br/> fType(3) = -4: fData(3) = "<Or"<br/> fType(4) = 0: fData(4) = "Line"<br/> fType(5) = 0: fData(5) = "Text"<br/></p><p>Sub ls()<br/> Dim sSet As AcadSelectionSet<br/> Dim fType(6) As Integer, fData(6) As Variant<br/> Dim sSetName As String<br/> sSetName = "First"<br/> With ThisDrawing<br/> <br/> On Error Resume Next<br/> If Not IsNull(.SelectionSets.Item(sSetName)) Then<br/> Set sSet = .SelectionSets.Item(sSetName)<br/> sSet.Delete<br/> End If<br/> Set sSet = .SelectionSets.Add(sSetName)<br/> <br/> fType(0) = -4: fData(0) = "<Or"<br/> fType(1) = 8: fData(1) = "AA1"<br/> fType(2) = -4: fData(2) = "Or>"<br/> fType(3) = -4: fData(3) = "<Or"<br/> fType(4) = 0: fData(4) = "Line"<br/> fType(5) = 0: fData(5) = "Text"<br/> fType(6) = -4: fData(6) = "Or>"<br/> sSet.Select 5, , , fType, fData<br/> <br/> Debug.Print sSet.Count<br/> sSet.Highlight True<br/> <br/> End With<br/>End Sub</p><p><br/></p> <p>and在or内部才有用</p><p>选择集默认为and(与)</p><p> fType(0) = -4: fData(0) = "<And"</p><p> fType(1) = 8: fData(1) = "标题栏"<br/><br/> fType(2) = 0: fData(2) = "text"<br/> <br/> fType(3) = -4: fData(3) = "And>"</p><p>-》等效于</p><p> fType(0) = 8: fData(0) = "标题栏"<br/><br/> fType(1) = 0: fData(1) = "text"<br/> <br/></p> <p> fType(0) = -4: fData(0) = "<Or"<br/> fType(1) = 8: fData(1) = "AA1"<br/> fType(2) = -4: fData(2) = "Or>"<br/> fType(3) = -4: fData(3) = "<Or"<br/> fType(4) = 0: fData(4) = "Line"<br/> fType(5) = 0: fData(5) = "Text"<br/> fType(6) = -4: fData(6) = "Or>"</p><p>正确的写法:</p><p>8,"AA1",0,"Line,Text"</p> 谢谢啦 <p> fType(0) = -4: fData(0) = "<Or"<br/> fType(1) = 8: fData(1) = "AA1"<br/> fType(2) = -4: fData(2) = "Or>"</p><p>必须得用运算符前后夹住图层AA1,是这个意思吗</p>
页:
[1]