明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1254|回复: 2

求助,帮我看看错在哪里

[复制链接]
发表于 2010-6-3 15:42:00 | 显示全部楼层 |阅读模式

Private Sub CommandButton1_Click()
Dim sSet As AcadSelectionSet
Dim ftype(0) As Integer
Dim fdata(0) As Variant
Dim xx As AcadText
ftype(0) = 0
fdata(0) = "TEXT"
With ThisDrawing
 On Error Resume Next
     If Not IsNull(.SelectionSets.Item("MySetSelectionSet")) Then
       Set sSet = .SelectionSets.Item("MySetSelectionSet")
       CreateSelectionSet.Delete
     End If
     Set sSet = .SelectionSets.Add("MySetSelectionSet")

End With
sSet.Select acSelectionSetAll, , , ftype, fdata
sco = sSet.Count


xx = sSet.Item(1)
ass.Delete
End Sub
我想用xx变量得到选择集内的某个元素(文字),这么写不对,该怎么写

发表于 2010-6-3 16:29:00 | 显示全部楼层

1).CreateSelectionSet.Delete的CreateSelectionSet是否有误?是否应该为sSet

2).xx = sSet.Item(1)前面加上Set,对象赋值需要Set

3).ass.Delete的ass又是什么?

发表于 2010-6-5 11:16:00 | 显示全部楼层

Private Sub Test()
Dim sco As Integer
Dim sSet As AcadSelectionSet
Dim ftype(0) As Integer
Dim fdata(0) As Variant
Dim xx As AcadText
ftype(0) = 0
fdata(0) = "TEXT"
With ThisDrawing
 On Error Resume Next
     If Not IsNull(.SelectionSets.Item("MySetSelectionSet")) Then
       Set sSet = .SelectionSets.Item("MySetSelectionSet")
       sSet.Delete
     End If
     Set sSet = .SelectionSets.Add("MySetSelectionSet")

End With
sSet.Select acSelectionSetAll, , , ftype, fdata
sco = sSet.Count
Set xx = sSet.Item(1)
xx.color = acBlue
End Sub

 这样可以了,你参考一下

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 22:26 , Processed in 0.152939 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表