zycw001 发表于 2005-11-9 23:00:00

[求助]请高手过目,看下鄙人的代码为什么不能实现画多段线的功能

Private Sub CommandButton1_Click()<BR>Dim user1 As AcadPolyline<BR>Dim userp As AcadPoint<BR>On Error Resume Next<BR>&nbsp;&nbsp;&nbsp; CommonDialog1.ShowOpen<BR>&nbsp;&nbsp;&nbsp; Open CommonDialog1.FileName For Input As #1<BR>&nbsp;&nbsp;&nbsp;&nbsp; Do While Not EOF(1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Line Input #1, inputdata<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a = inputdata<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' a = Split(inputdata, ",")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set userp = ThisDrawing.ModelSpace.AddPoint(a)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set user1 = ThisDrawing.ModelSpace.AddPolyline(a)<BR>&nbsp;&nbsp;&nbsp;&nbsp; Loop<BR>&nbsp;&nbsp;&nbsp;&nbsp; Close #1<BR>&nbsp;&nbsp;&nbsp;&nbsp; Me.Hide<BR>&nbsp;&nbsp;&nbsp;&nbsp; ThisDrawing.Application.ZoomExtents<BR>end sub<BR>请问为什么不能实现将文本文件里的坐标通过Polyline画到当前文档中去呢!<BR>请高手一定指教,不胜感激!<BR>以下是我文本文件里的数据!<BR>611366,3537816<BR>611344,3537965<BR>611031,3537822<BR>611084,3537930<BR>611124,3538024<BR>611047,3537989<BR>611019,3537909

sieben 发表于 2005-11-10 08:22:00

<P>1,若多段线是二维的建议使用AddLightWeightPolyline</P>
<P>2,使用AddLightWeightPolyline的输入参数是数组,在你的例子里应先</P>
<P>把所有点坐标读入,放到一个一维数组里(x1 y1 x2 y2 .....)</P>
页: [1]
查看完整版本: [求助]请高手过目,看下鄙人的代码为什么不能实现画多段线的功能