shirazbj 发表于 2006-10-31 18:01:00

如何改变直线的端点坐标值呀?

<P>Sub my_changeline_xyz()<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp; Dim UserMessage As String<BR>&nbsp;&nbsp;&nbsp; Dim ControlPoints As Variant<BR>&nbsp;&nbsp;&nbsp; Dim iCount As Long, iPoint As Integer<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp; Dim i, n As Long<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp; Dim newObjs As AcadLine</P>
<P>&nbsp; n = ThisDrawing.ModelSpace.Count<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp; For i = 0 To n - 1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If ThisDrawing.ModelSpace.Item(i).ObjectName = "AcDbLine" Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set newObjs = ThisDrawing.ModelSpace.Item(i)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x1 = newObjs.startPoint(iCount)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; y1 = newObjs.startPoint(iCount + 1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; z1 = newObjs.startPoint(iCount + 2)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x2 = newObjs.endPoint(iCount)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; y2 = newObjs.endPoint(iCount + 1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; z2 = newObjs.endPoint(iCount + 2)<BR></P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '坐标取出来了,怎么修改呀?</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp; Next i<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;MsgBox "Good on ya!"<BR>&nbsp;<BR>End Sub</P>

雪山飞狐_lzh 发表于 2006-11-1 12:54:00

<P>dim p1(2) as double,p2(2) as double</P>
<P>p2(0)=10:p2(1)=10</P>
<P>newObjs.startPoint=p1</P>
<P>newObjs.endPoint=p2</P>
<P>&nbsp;</P>

shirazbj 发表于 2006-11-4 09:54:00

<P>谢谢。可以改直线了。</P>
<P>我要把在一个平面的图转到另一个与其垂直的平面去。我还要转用其他命令画的图。现在在考虑改polyline的坐标。</P>
页: [1]
查看完整版本: 如何改变直线的端点坐标值呀?