- Sub example_select()
- On Error Resume Next
-
- Dim myss As AcadSelectionSet
- If Not IsNull(ThisDrawing.SelectionSets.Item("myss")) Then
- Set myss = ThisDrawing.SelectionSets.Item("myss")
- myss.detele
- End If
-
- Set myss = ThisDrawing.SelectionSets.Add("myss")
-
- Dim mode As Integer
- mode = acSelectionSetAll
- myss.Select mode
- MsgBox "选择集数量" & myss.Count
-
- Dim returnobj(0) As Object
- Dim returnpnt As Variant
-
- Dim re As Variant
- ThisDrawing.Utility.GetEntity returnobj(0), returnpnt, "选择直线:"
-
- returnobj(0).color = acRed
- returnobj(0).Update
- Dim StartPoint, EndPoint
- StartPoint = returnobj(0).StartPoint
- EndPoint = returnobj(0).EndPoint
- re = returnobj(0).ObjectName
- MsgBox "起点 " & StartPoint(0) & "," & StartPoint(1) & "," & StartPoint(2) & " 终点 " & EndPoint(0) & "," & EndPoint(1) & "," & EndPoint(2) & " id " & re
- returnobj(0).color = acByLayer
- returnobj(0).Update
-
- myss.RemoveItems returnobj
-
-
- MsgBox "选择集数量" & myss.Count
-
-
- End Sub
|