Sub getpolyline()
Dim i, n As Integer 'Dim newObjs As AcadPolyline Dim newObjs As AcadLWPolyline 'Object drawed by pline command under version 2006
Dim retCoord As Variant Dim points(500) As Double
n = ThisDrawing.ModelSpace.Count
For i = 0 To n - 1 If ThisDrawing.ModelSpace.Item(i).ObjectName = "AcDbPolyline" Then Set newObjs = ThisDrawing.ModelSpace.Item(i) 'newObjs怎么老是空的?下面的结果老不对
' Return all the coordinates of the polyline retCoord = newObjs.Coordinates mynpoint = (UBound(retCoord) + 1) / 3 '.......
End If Next i MsgBox "Good on ya!" End Sub |