Dim Sel As AcadSelectionSet '选择集
Set Sel = CreateSelectionSet
Sel.SelectOnScreen FilterType, FilterData '屏幕选择
For Each Obj In Sel
Coord = Obj.Coordinates
Select Case Obj.ObjectName
Case "AcDbPolyline"
Case "AcDb2dPolyline", "AcDb3dPolyline"
For i = 0 To UBound(Coord) - 1 Step 3
XYH(0) = Coord(i + 0)
XYH(1) = Coord(i + 1)
XYH(2) = Coord(i + 2)
Case Else
End Select
Next
Dim lCount As Long
Dim i As Long
Dim objLine As AcadLine
dim ssText As AcadSelectionSet
Set ssText = ThisDrawing.ActiveSelectionSet
lCount = ssText.Count
For i = 0 To lCount - 1
If ssText.Item(i).ObjectName = "AcDbLine" Then
Set objLine = ssText.Item(i)
Debug.Print "sTartPoint(0)= " & objLine.StartPoint(0)
Debug.Print "sTartPoint(1)= " & objLine.StartPoint(1)
Debug.Print "EndPoint(0)= " & objLine.EndPoint(0)
Debug.Print "EndPoint(1)= " & objLine.EndPoint(1)