写了一点,没时间写了,你自己再改改吧.
Sub test() Dim group(0 To 3) As AcadLine Dim point As Variant Dim sset As AcadSelectionSet Dim entry As AcadEntity Dim i As Integer ThisDrawing.SendCommand "prompt" & "请选择" point = ThisDrawing.Utility.GetPoint() For i = 0 To ThisDrawing.SelectionSets.Count - 1 If ThisDrawing.SelectionSets.Item(i).Name = "ss1" Then ThisDrawing.SelectionSets.Item("ss1").Delete Next i Set sset = ThisDrawing.SelectionSets.Add("ss1") sset.SelectAtPoint point Set group(0) = sset.Item(0) Set group(1) = sset.Item(1) Set group(2) = sset.Item(2) Set group(3) = sset.Item(3) Dim pos(0 To 7) As Variant pos(0) = group(0).StartPoint pos(1) = group(1).StartPoint pos(2) = group(2).StartPoint pos(3) = group(3).StartPoint MsgBox pos(0)(0) & " " & pos(0)(1) & " " & pos(0)(2) & vbCrLf & pos(1)(0) & " " & pos(1)(1) & " " & pos(1)(2) & vbCrLf & pos(2)(0) & " " & pos(2)(1) & " " & pos(2)(2) & vbCrLf & pos(3)(0) & " " & pos(3)(1) & " " & pos(3)(2) ThisDrawing.SelectionSets.Item("ss1").Delete End Sub