- 积分
- 2468
- 明经币
- 个
- 注册时间
- 2004-7-22
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
Public AcadApp As Object Public Thisdrawing As Object
Sub main() Call ConnectCAD Set Thisdrawing = AcadApp.ActiveDocument
Dim blockSet As Object Set blockSet = Thisdrawing.SelectionSets.Add("Block") Dim FType() As Integer Dim FData() As Variant ReDim FType(1) As Integer ReDim FData(1) As Variant FType(0) = 0: FData(0) = "INSERT" FType(1) = 8: FData(1) = "给水" blockSet.Select acSelectionSetAll, , , FType, FData Msgbox blockSet.Count End Sub
Public Sub ConnectCAD() '连接到AutoCAD On Error Resume Next Set AcadApp = GetObject(, "AutoCAD.Application") If Err Then '如果没有一个AutoCAD副本在运行 Err.Clear Set AcadApp = CreateObject("AutoCAD.Application") AcadApp.Visable = True '启动一个AutoCAD副本并设为可见 If Err Then MsgBox Err.Description '如果失败,给出错误提示 Exit Sub End If End If End Sub 为什么程序执行到 blockSet.Select acSelectionSetAll, , , FType, FData时提示:
实时错误 '-2147467259(80004005)':
对象 'Select'的方法 'IAcadSelectionSet' 失败
而我在另外一个VB程序中使用sset.SelectAtPoint point, FType, FData选择时没有错误,这是为什么,在VB中该如何构造选择集? |
|