马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
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".
- [FONT=courier new]
- Dim sset As Object
- Set sset = ActiveDocument.SelectionSets.Add("TEST")
-
- Dim mode As Integer
- Dim corner1 As Variant, corner2 As Variant
- Dim point1(0 To 2) As Double, point2(0 To 2) As Double
-
- Dim gpCode(0 To 1) As Integer
- Dim dataValue(0 To 1) As Variant
- Dim groupCode As Variant, dataCode As Variant
- gpCode(0) = 0
- dataValue(0) = "Insert"
- gpCode(1) = 2
- dataValue(1) = "A"
-
- groupCode = gpCode
- dataCode = dataValue
-
- point1(0) = 0
- point1(1) = 0
- point1(2) = 0
- point2(0) = 0
- point2(1) = 0
- point2(2) = 0
-
- corner1 = point1
- corner2 = point2
- sset.Select acSelectionSetAll, corner1, corner2, groupCode, dataCode
- Here point1 and point2 are dummy points because of selection mode
- acSelectionSetAll.
- [/FONT]
|