XJ_HE 发表于 2003-7-22 11:13:00

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

liujiping 发表于 2003-7-22 12:49:00

for each obj in ent(选择集)
   ----------------------(过虑条件)
withobj
.color
.----------------------------(其他属性)
end with
next

XJ_HE 发表于 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


XJ_HE 发表于 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

XJ_HE 发表于 2003-7-22 17:25:00

其实我的目的是这样的:

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

单独改选择集中的对象的颜色没有问题。

liujiping 发表于 2003-7-22 21:20:00

选的时候可以同时过滤(只选符合条件的).为什么要选完后才过滤.不知问题是不是在这里

mccad 发表于 2003-7-22 23:48:00

本帖最后由 作者 于 2003-7-23 10:26:52 编辑

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


Dim filtertype(0) As Integer
Dim filterdata(0) As String
Dim S As AcadSelectionSet
filtertype(0) = 0
filterdata(0) = "TEXT"

XJ_HE 发表于 2003-7-23 09:40:00

Private Sub CommandButton1_Click()
Dim filtertype(0) As Integer
Dim filterdata(0) As String
Dim S As AcadSelectionSet
filtertype(0) = 0
filterdata(0) = "TEXT"
Me.Hide
Set S = ThisDrawing.SelectionSets.Add("A18")
S.SelectOnScreen filtertype, filterdata

Dim a As AcadEntity
For Each a In S
      a.color = acBlue
      a.Update
Next a

End Sub


谢谢明总,可是您看:这次出现的是 “参数FILTERDATA (位于SELECTONSCREEN中无效)

mccad 发表于 2003-7-23 10:25:00

不好意思,应该改成这样:

Dim filtertype(0) As Integer
Dim filterdata(0) As Variant

XJ_HE 发表于 2003-7-23 11:15:00

谢谢明总!!
完全成功!!
页: [1] 2
查看完整版本: 加入到选择集中的对象如何修改其属性:如颜色。