[求助]如何在VB.net开发Autocad时在创建选择集时加入过滤机制
看看下面的代码,不知有何错误?总是通不过,请各位大侠帮忙!Public AcadApp As AutoCAD.AcadApplication
Public CurrentDocument As AutoCAD.AcadDocument
Private Sub Test()
Try
AcadApp = GetObject(, "AutoCAD.Application")
Catch
AcadApp = CreateObject("AutoCAD.Application")
Finally
AcadApp.Visible = True
End Try
CurrentDocument = AcadApp.ActiveDocument
Dim sset As AutoCAD.AcadSelectionSet
Try
sset = CurrentDocument.SelectionSets.Item("NewSet")
sset.Clear()
Catch
sset = CurrentDocument.SelectionSets.Add("NewSet")
End Try
Dim FilterType(0) As Integer
Dim FilterData(0) As Object
FilterType(0) = 0
FilterData(0) = "Line"
sset.SelectOnScreen(FilterType, FilterData)
End Sub
Dim FilterData(0) As Object 改为Dim FilterData(0) As String 试试
过滤的类型声明错误
对于FilterType,应声明为Integer类型的数组,对于FilterData,应声明为Variant类型的数组。在CAD中,过滤机制是这样理解的,过滤的类型是组码,一定是整型的,过滤的数据可以是字符串,整型,实数,或者表示点的数组,因而要用到变体型。
试过了,还是不行!
VB.net中已将Variant类型用Object代替了!
页:
[1]