Private Sub CommandButton1_Click()
'定义选择集
Dim se As AcadSelectionSet
Dim ft(0) As Integer
Dim fn(0) As Variant
ft(0) = 0
fn(0) = "line"
Set se = ThisDrawing.SelectionSets.Add("5aaa1a")
'选择对象
Me.Hide
se.SelectOnScreen ft, fn
'定义点
Dim start() As Double
Dim end1() As Double
Dim p(5) As Double
Dim i As Integer
Dim ml As AcadMLine
Dim a As AcadLine
‘转换
For Each a In se
start = a.StartPoint
end1 = a.EndPoint
’将起点给数组P
i = 0
Do While i < 3
p(i) = start(i)
i = i + 1
Loop
‘将终点给数组P
i = 0
Do While i < 3
p(i + 3) = end1(i)
i = i + 1
Loop
Set ml = ThisDrawing.ModelSpace.AddMLine(p)
a.Delete
Next
End Sub