- 积分
- 396
- 明经币
- 个
- 注册时间
- 2005-2-23
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
以下是在VB.NET中关于选择集使用的一段程序,用意是想得到CAD某一图层中全部实体类型,程序代码为:
Dim acadapp As AcadApplication
Dim Sels As AcadSelectionSets Sels = acadapp.ActiveDocument.SelectionSets
Dim Sel As AcadSelectionSet Dim mspaceObj As AcadObject Dim FilterType(0) As Integer Dim FilterData(0) As Object Dim LayCount As Integer Dim LayName As String
LayCount = acadapp.ActiveDocument.Layers.Count
For I = 1 To LayCount - 1 LayName = acadapp.ActiveDocument.Layers.Item(I).Name If StrComp(LayName, "YD-R2", 1) = 0 Then Sel = Sels.Add(LayName) FilterType(0) = 8 FilterData(0) = LayName
Sel.Select(AcSelect.acSelectionSetAll, , , FilterType, FilterData) '该语句得到得到的实体数总为0,不知道为什么? For Each mspaceObj In Sel MsgBox(mspaceObj.ObjectName) Next
Sel.Delete() End If Next I
请各位帮我找找原因,好吗?以上这段代码在VBA中运行的话,可以得到我想要的结果! |
|