乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 51|回复: 1

请问在VBA中怎么使一个选择集只选中模型空间中可见图元?

[复制链接]

5

主题

11

帖子

1

银币

初来乍到

Rank: 1

铜币
31
发表于 2003-4-10 08:53:00 | 显示全部楼层 |阅读模式
请问在VBA中怎么使一个选择集只选中模型空间中可见图元?
我隐藏&锁定&冻结了其他,然后使用了
FilterType = 60
FilterData = 0
sset.SelectOnScreen FilterType, FilterData
可是选不中任何图元,也没什么错误提示???
烦闷!
高手,救救我吧?
回复

使用道具 举报

158

主题

2315

帖子

10

银币

顶梁支柱

Rank: 50Rank: 50

铜币
2951
发表于 2003-4-10 19:00:00 | 显示全部楼层

Sub GetEnt()
    Dim ss As AcadSelectionSet
    Set ss = CreateSelectionSet
    Dim Ly As String
    Ly = ""
    Dim Lyer As AcadLayer
    Dim I As Integer
    Debug.Print ThisDrawing.Layers.Count
    For I = 0 To ThisDrawing.Layers.Count - 1
        Set Lyer = ThisDrawing.Layers(I)
        If Lyer.LayerOn = True Then
            Ly = Ly & Lyer.Name & ","
        End If
    Next
    Dim fType As Variant: Dim fData As Variant
    BuildFilter fType, fData, 8, Ly
    ss.Select acSelectionSetAll, , , fType, fData
    Debug.Print ss.Count
End Sub
Public Function CreateSelectionSet(Optional ssName As String = "ss") As AcadSelectionSet
    Dim ss As AcadSelectionSet
   
    On Error Resume Next
    Set ss = ThisDrawing.SelectionSets(ssName)
    If Err Then Set ss = ThisDrawing.SelectionSets.Add(ssName)
    ss.Clear
    Set CreateSelectionSet = ss
End Function
Public Sub BuildFilter(typeArray, dataArray, ParamArray gCodes())
    Dim fType() As Integer, fData()
    Dim index As Long, I As Long
   
    index = LBound(gCodes) - 1
        
    For I = LBound(gCodes) To UBound(gCodes) Step 2
        index = index + 1
        ReDim Preserve fType(0 To index)
        ReDim Preserve fData(0 To index)
        fType(index) = CInt(gCodes(I))
        fData(index) = gCodes(I + 1)
    Next
    typeArray = fType: dataArray = fData
End Sub
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-13 08:45 , Processed in 0.578742 second(s), 56 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表