Dim obj As AcadEntity
For Each obj In acadapp.ActiveDocument.ModelSpace
If obj.Name="AcDbLine" Then
MsgBox "直线的起点为:(" & obj.StartPoint(0) & "," & _
obj.StartPoint(1) & "," & obj.StartPoint(2) & _
"),终点为:("& obj.EndPoint(0) & "," & _
obj.EndPoint(1) & "," & obj.EndPoint(2) & ")"
End If
Next obj
With acadApp.ActiveDocument.ModelSpace
For i = 0 To .Count - 1 Step 1
Set retObj = .Item(i)
If retObj.EntityType = acLine Then
rstLine.addnew
PT1 = retObj.startPoint
PT2 = retObj.EndPoint
X1=PT1(0):Y1=PT1(1):Z1=PT1(2)
......