把xy平面上的polyline转到zy平面去
<P>先用下面例程生成polyline</P><P>Sub Example_AddLightWeightPolyline()<BR> ' This example creates a lightweight polyline in model space.<BR> <BR> Dim plineObj As AcadLWPolyline<BR> Dim points(0 To 9) As Double<BR> <BR> ' Define the 2D polyline points<BR> points(0) = 1: points(1) = 1<BR> points(2) = 1: points(3) = 2<BR> points(4) = 2: points(5) = 2<BR> points(6) = 3: points(7) = 2<BR> points(8) = 4: points(9) = 4<BR> <BR> ' Create a lightweight Polyline object in model space<BR> Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)<BR> ZoomAll<BR> <BR>End Sub</P>
<P>然后用下面的例程旋转</P>
<P>Sub getpolyline()</P>
<P> Dim UserMessage As String<BR> Dim ControlPoints As Variant<BR> Dim iCount As Long, iPoint As Integer<BR> <BR> Dim i, n As Integer<BR> <BR> 'Dim newObjs As AcadPolyline<BR> Dim newObjs As AcadLWPolyline<BR> <BR> Dim retCoord As Variant<BR> Dim points(200) As Double<BR> Dim coord As Variant<BR> <BR> Dim polyObj As Acad3DPolyline<BR> <BR> <BR> n = ThisDrawing.ModelSpace.Count<BR> 'MsgBox "N = " & Str(n)<BR> <BR> 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> <BR> mynpoint = (UBound(newObjs.Coordinates) + 1) / 2<BR> <BR> For J = 0 To mynpoint - 1<BR> <BR> coord = newObjs.Coordinate(J)<BR> points(3 * J) = 0<BR> points(3 * J + 1) = coord(1)<BR> points(3 * J + 2) = coord(0)<BR> <BR> Next J<BR> <BR> ' Create a 3DPolyline in model space<BR> Set polyObj = ThisDrawing.ModelSpace.Add3DPoly(points)<BR> <BR> End If<BR> <BR> Next i<BR> <BR> MsgBox "Good on ya!"</P>
<P>End Sub</P>
<P>问题是转完了老有一条连接polyline最后定点与坐标原点的连线。问题在那?</P>
<P>我觉得是生成3dpolyline时,定点points数组的大小定义的有多余的空间。该怎么解决呢?</P> 有用,顶一下。 <P>现在发现用rotate3d命令也可以。</P> 就是用rotate3d命令。
页:
[1]