加入到选择集中的对象如何修改其属性:如颜色。
for each obj in ent(选择集)----------------------(过虑条件)
withobj
.color
.----------------------------(其他属性)
end with
next 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
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-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" 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中无效) 不好意思,应该改成这样:
Dim filtertype(0) As Integer
Dim filterdata(0) As Variant 谢谢明总!!
完全成功!!
页:
[1]
2