明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3001|回复: 11

加入到选择集中的对象如何修改其属性:如颜色。

  [复制链接]
发表于 2003-7-22 11:13:00 | 显示全部楼层 |阅读模式
发表于 2003-7-22 12:49:00 | 显示全部楼层
for each obj in ent(选择集)
   ----------------------(过虑条件)
with  obj
.color
.----------------------------(其他属性)
end with
next
 楼主| 发表于 2003-7-22 17:17:00 | 显示全部楼层
Private Sub CommandButton1_Click()
Dim filtertype As Integer
Dim filterdata As String
Dim S As AcadSelectionSet
Dim O As Variant
filtertype = 0
filterdata = "TEXT"
Me.Hide
Set S = ThisDrawing.SelectionSets.Add("A11AA")
S.SelectOnScreen

Dim A As AcadEntity
For Each A In S
      S.SelectOnScreen FILTERTYEP, filterdata
      A.color = acBlue
      A.Update
Next A     
End Sub


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
 楼主| 发表于 2003-7-22 17:20:00 | 显示全部楼层
Private Sub CommandButton1_Click()
Dim filtertype As Integer
Dim filterdata As String
Dim S As AcadSelectionSet
filtertype = 0
filterdata = "TEXT"

Set S = ThisDrawing.SelectionSets.Add("A")
S.SelectOnScreen

Dim A As AcadEntity
For Each A In S
      S.SelectOnScreen filtertype, filterdata
      A.color = acBlue
      A.Update
Next A
 楼主| 发表于 2003-7-22 17:25:00 | 显示全部楼层
其实我的目的是这样的:

就是希望可以一下子将所有对象都选中,然后再过滤出其中满足条件的对象(比如文本),最后再改变这些对象的颜色。

单独改选择集中的对象的颜色没有问题。
发表于 2003-7-22 21:20:00 | 显示全部楼层
选的时候可以同时过滤(只选符合条件的).为什么要选完后才过滤.不知问题是不是在这里
发表于 2003-7-22 23:48:00 | 显示全部楼层
本帖最后由 作者 于 2003-7-23 10:26:52 编辑

注意 filtertype 和 filterdata 都应该为Variant
你可以这样定义


  1. Dim filtertype(0) As Integer
  2. Dim filterdata(0) As String
  3. Dim S As AcadSelectionSet
  4. filtertype(0) = 0
  5. filterdata(0) = "TEXT"
 楼主| 发表于 2003-7-23 09:40:00 | 显示全部楼层
  1. Private Sub CommandButton1_Click()
  2. Dim filtertype(0) As Integer
  3. Dim filterdata(0) As String
  4. Dim S As AcadSelectionSet
  5. filtertype(0) = 0
  6. filterdata(0) = "TEXT"
  7. Me.Hide
  8. Set S = ThisDrawing.SelectionSets.Add("A18")
  9. S.SelectOnScreen filtertype, filterdata

  10. Dim a As AcadEntity
  11. For Each a In S
  12.       a.color = acBlue
  13.       a.Update
  14. Next a

  15. End Sub



谢谢明总,可是您看:这次出现的是 “参数FILTERDATA (位于SELECTONSCREEN中无效)
发表于 2003-7-23 10:25:00 | 显示全部楼层
不好意思,应该改成这样:

  1. Dim filtertype(0) As Integer
  2. Dim filterdata(0) As Variant
 楼主| 发表于 2003-7-23 11:15:00 | 显示全部楼层
谢谢明总!!
完全成功!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-29 06:43 , Processed in 0.207745 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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