找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 678|回复: 0

[VBA程序]:如何获得所有插入块实体到一个选择集

[复制链接]

已领礼包: 145个

财富等级: 日进斗金

发表于 2002-9-27 18:14:36 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
How to create a selection set of all the insertions of a block?  
ID    2019  
Applies to:    AutoCAD

This document is part of    Block Reference   COM-ActiveX Interfaces   Selection Sets   VBA     


Question
How do I create a selection set using the select method with a filter of a given
block in a drawing?
Answer
The following sample code selects all inserts of the block named "A".


  1. [FONT=courier new]
  2. Dim sset As Object
  3.    Set sset = ActiveDocument.SelectionSets.Add("TEST")
  4.    
  5.    Dim mode As Integer
  6.    Dim corner1 As Variant, corner2 As Variant
  7.    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
  8.    
  9.    Dim gpCode(0 To 1) As Integer
  10.    Dim dataValue(0 To 1) As Variant
  11.    Dim groupCode As Variant, dataCode As Variant
  12.    gpCode(0) = 0
  13.    dataValue(0) = "Insert"
  14.    gpCode(1) = 2
  15.    dataValue(1) = "A"
  16.    
  17.    groupCode = gpCode
  18.    dataCode = dataValue
  19.    
  20.    point1(0) = 0
  21.    point1(1) = 0
  22.    point1(2) = 0
  23.    point2(0) = 0
  24.    point2(1) = 0
  25.    point2(2) = 0
  26.    
  27.    corner1 = point1
  28.    corner2 = point2

  29.    sset.Select acSelectionSetAll, corner1, corner2, groupCode, dataCode
  30. Here point1 and point2 are dummy points because of selection mode
  31. acSelectionSetAll.
  32. [/FONT]
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-28 11:15 , Processed in 0.322371 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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