记住这种操作在AutoCAD对象模型的某个方法是有用过,在Excel中用得比较多吧。
就象这样:- Sub ss()
- Dim SSet As AcadSelectionSet
- Set SSet = PickFirstSSet
- Dim pnt, ent As AcadEntity
- ThisDrawing.Utility.GetEntity ent, pnt
- AddItems SSet, ent
- SSet.Highlight True
- MsgBox "显示刚选择并添加新对象的选择集"
- SSet.Highlight False
- End Sub
- Function PickFirstSSet() As AcadSelectionSet
- On Error Resume Next
- ThisDrawing.SelectionSets("PICKFIRST").Delete
- Set PickFirstSSet = ThisDrawing.PickfirstSelectionSet
- If PickFirstSSet.Count = 0 Then PickFirstSSet.SelectOnScreen
- End Function
- [b]Sub AddItems(SSet As AcadSelectionSet, Entitys As Variant)
- If IsArray(Entitys) Then
- SSet.AddItems Entitys
- ElseIf IsObject(Entitys) Then
- Dim Entity(0) As AcadEntity
- Set Entity(0) = Entitys
- SSet.AddItems Entity
- End If
- End Sub[/b]
|