明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1914|回复: 4

选择集的and和or的应用.

[复制链接]
发表于 2009-8-29 17:27:00 | 显示全部楼层 |阅读模式

这种组合,实现只在"AA1"图层中,找line实体.

 fType(0) = -4: fData(0) = "<And"
    fType(2) = 0: fData(2) = "text"
   
    fType(1) = 8: fData(1) = "AA1"
    fType(3) = -4: fData(3) = "And>"

Sub l()
  Dim sSet As AcadSelectionSet
  Dim fType(3) As Integer, fData(3) As Variant
  Dim sSetName As String
  sSetName = "First"
  With ThisDrawing
      On Error Resume Next
      If Not IsNull(.SelectionSets.Item(sSetName)) Then
        Set sSet = .SelectionSets.Item(sSetName)
        sSet.Delete
      End If
      Set sSet = .SelectionSets.Add(sSetName)
    fType(0) = -4: fData(0) = "<And"
    fType(2) = 0: fData(2) = "text"
   
    fType(1) = 8: fData(1) = "标题栏"
    fType(3) = -4: fData(3) = "And>"
    sSet.Select 5, , , fType, fData
    sSet.Highlight True
    'Debug.Print sSet.Count
  End With
End Sub

'''这种组合是图层aa1中的line和text实体

    fType(0) = -4: fData(0) = "<Or"
    fType(1) = 8: fData(1) = "AA1"
    fType(2) = -4: fData(2) = "Or>"
    fType(3) = -4: fData(3) = "<Or"
    fType(4) = 0: fData(4) = "Line"
    fType(5) = 0: fData(5) = "Text"

Sub ls()
  Dim sSet As AcadSelectionSet
  Dim fType(6) As Integer, fData(6) As Variant
  Dim sSetName As String
  sSetName = "First"
  With ThisDrawing
   
      On Error Resume Next
      If Not IsNull(.SelectionSets.Item(sSetName)) Then
        Set sSet = .SelectionSets.Item(sSetName)
        sSet.Delete
      End If
      Set sSet = .SelectionSets.Add(sSetName)
   
    fType(0) = -4: fData(0) = "<Or"
    fType(1) = 8: fData(1) = "AA1"
    fType(2) = -4: fData(2) = "Or>"
    fType(3) = -4: fData(3) = "<Or"
    fType(4) = 0: fData(4) = "Line"
    fType(5) = 0: fData(5) = "Text"
    fType(6) = -4: fData(6) = "Or>"
    sSet.Select 5, , , fType, fData
   
    Debug.Print sSet.Count
    sSet.Highlight True
   
  End With
End Sub


发表于 2009-8-29 19:04:00 | 显示全部楼层

and在or内部才有用

选择集默认为and(与)

    fType(0) = -4: fData(0) = "<And"

    fType(1) = 8: fData(1) = "标题栏"

    fType(2) = 0: fData(2) = "text"
    
    fType(3) = -4: fData(3) = "And>"

-》等效于

    fType(0) = 8: fData(0) = "标题栏"

    fType(1) = 0: fData(1) = "text"
    

发表于 2009-8-29 19:07:00 | 显示全部楼层

    fType(0) = -4: fData(0) = "<Or"
    fType(1) = 8: fData(1) = "AA1"
    fType(2) = -4: fData(2) = "Or>"
    fType(3) = -4: fData(3) = "<Or"
    fType(4) = 0: fData(4) = "Line"
    fType(5) = 0: fData(5) = "Text"
    fType(6) = -4: fData(6) = "Or>"

正确的写法:

8,"AA1",0,"Line,Text"

发表于 2010-1-6 17:28:00 | 显示全部楼层
谢谢啦
发表于 2010-2-1 23:15:00 | 显示全部楼层

   fType(0) = -4: fData(0) = "<Or"
    fType(1) = 8: fData(1) = "AA1"
    fType(2) = -4: fData(2) = "Or>"

必须得用运算符前后夹住图层AA1,是这个意思吗

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 00:34 , Processed in 0.172182 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表