如何知道一条polyline有多少点呀?
<P>Sub getpolyline()</P><P> Dim i, n As Integer<BR> <BR> 'Dim newObjs As AcadPolyline<BR> Dim newObjs As AcadLWPolyline 'Object drawed by pline command under version 2006<BR></P>
<P> Dim retCoord As Variant<BR> Dim points(500) As Double</P>
<P> <BR> n = ThisDrawing.ModelSpace.Count<BR></P>
<P> For i = 0 To n - 1<BR> <BR> If ThisDrawing.ModelSpace.Item(i).ObjectName = "AcDbPolyline" Then<BR> <BR> Set newObjs = ThisDrawing.ModelSpace.Item(i)<BR> 'newObjs怎么老是空的?下面的结果老不对</P>
<P><BR> ' Return all the coordinates of the polyline<BR> retCoord = newObjs.Coordinates<BR> <BR> mynpoint = (UBound(retCoord) + 1) / 3<BR> <BR> '.......</P>
<P> <BR> End If<BR> <BR> Next i<BR> <BR> MsgBox "Good on ya!"<BR> <BR>End Sub</P> 把mynpoint = (UBound(retCoord) + 1) / 3中的除3改成除2,结果好像对了。我还以为定点存的是x,y,z三个坐标呢。3dpoly应该是x,y,z了吧。
页:
[1]