明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1126|回复: 1

怎么样用VBA将图幅中的图元筛选出来

[复制链接]
发表于 2015-11-1 10:20:28 | 显示全部楼层 |阅读模式
怎样用选择集将某个名称的图元筛选出来?请求前辈告知,谢谢。
发表于 2015-11-1 18:51:57 | 显示全部楼层
Sub Example_Select()
    ' This example adds members to a selection set, first by crossing and
    ' then by filtering for circles.
   
    ' Create the selection set
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SSET")
   
   
    ' Add all object to the selection set that lie within a crossing of (28,17,0) and
    ' (-3.3, -3.6,0)
    Dim mode As Integer
    Dim corner1(0 To 2) As Double
    Dim corner2(0 To 2) As Double
   
    mode = acSelectionSetCrossing
    corner1(0) = 28: corner1(1) = 17: corner1(2) = 0
    corner2(0) = -3.3: corner2(1) = -3.6: corner2(2) = 0
    ssetObj.Select mode, corner1, corner2
   
    ' Add all the Circles to the selection set that lie within the crossing of (28,17,0) and
    ' (-3.3, -3.6,0) by filtering from the current drawing
    Dim gpCode(0) As Integer
    Dim dataValue(0) As Variant
    gpCode(0) = 0
    dataValue(0) = "Circle"
   
    Dim groupCode As Variant, dataCode As Variant
    groupCode = gpCode
    dataCode = dataValue
   
    ssetObj.Select mode, corner1, corner2, groupCode, dataCode
   
End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-25 10:08 , Processed in 0.162820 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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