[求助]如何使用SelectOnScreen FilterType,FilterData?
这段代码为什么会这样的错误------“方法'SelectOnScreen'作用于对象<BR> ‘IAcadSelectionSet’时失败”Sub try()<BR> Dim ssetObj As AcadSelectionSet<BR> Set ssetObj = ThisDrawing.SelectionSets.Add("Test")<BR> Dim FilterType As Integer<BR> Dim FilterData As String<BR> <BR> FilterType = 0<BR> FilterData = "line"<BR> ssetObj.SelectOnScreen FilterType, FilterData<BR> ssetObj.Delete<BR>End Sub 改成:
Sub try()<BR> Dim ssetObj As AcadSelectionSet<BR> Set ssetObj = ThisDrawing.SelectionSets.Add("Test")<BR> Dim FilterType(0) As Integer<BR> Dim FilterData(0) As String<BR> <BR> FilterType(0) = 0<BR> FilterData (0) = "line"<BR> ssetObj.SelectOnScreen FilterType, FilterData<BR> ssetObj.Delete<BR>End Sub
FilterType 和FilterData都应该是数组。 非常感谢!! 我刚才试了一下,这种方法行不通啊 VB代码,看看能否给你提示,估计问题出现在数据类型上
Set sset = AcadDoc.SelectionSets.Add("mys")<BR>'创建选择集<BR>Dim myss As Object<BR>'Set myss = sset.Add("mys")<BR>'定义过滤组码数据<BR>Dim gpcode(0) As Integer<BR>Dim datavalue(0) As Variant<BR>gpcode(0) = 0<BR>datavalue(0) = "text"<BR>'注意组码以及组码值的数据类型的转化<BR>Dim groupcode As Variant<BR>Dim datacode As Variant<BR>groupcode = gpcode<BR>datacode = datavalue<BR>'选择所有的文本<BR>Call sset.SelectOnScreen(groupcode, datacode)<BR> 下面这样就可以了!
Sub try()<BR> Dim ssetObj As AcadSelectionSet<BR> Set ssetObj = ThisDrawing.SelectionSets.Add("Tt")<BR> Dim FType(0) As Integer<BR> Dim FData(0) As Variant<BR> <BR> FType(0) = 0<BR> FData(0) = "line"<BR> ssetObj.SelectOnScreen FType, FData<BR> ssetObj.Delete<BR>End Sub
页:
[1]