[数据输入及转换]多点输入后,如何将各点坐标组成一维数组?
因为样条曲线的拟合点可能比较多,一次输入进去显得比较乱,想让用户一个一个地输入每个拟合点坐标,然后将各个拟合点的坐标组成一个一维数组,用来画出样条曲线。但试了半天还是没法实现,请高手帮忙解决。下面的程序是错的,拿出来主要是想表达一下我的问题所在Dim stpoint As Variant<BR> Dim etpoint As Variant<BR> Dim x As Integer '拟合点个数<BR> Dim i As Integer<BR> Dim j As Integer<BR> Dim vet As Variant,Dim vetpoint As Variant<BR> x = ThisDrawing.Utility.GetInteger("请输入拟合点个数:")<BR> Dim xx As Integer '拟合点参数个数<BR> 'xx = (x - 1) * 3<BR> For i = 0 To x<BR> j = i + 1<BR> vet(, i) = ThisDrawing.Utility.GetPoint(, vbCrLf & "请输入第" & j & "个拟合点坐标:")<BR> Next<BR> stpoint = ThisDrawing.Utility.GetPoint(, vbCrLf & "请输入起始控制点坐标:")<BR> etpoint = ThisDrawing.Utility.GetPoint(, vbCrLf & "请输入终结控制点坐标:")<BR> 'Set splineob = ThisDrawing.ModelSpace.AddSpline(vetpoint, stpoint, etpoint) Sub tt1()<BR>On Error GoTo ErrHandle<BR>Dim i As Integer<BR>Dim pnts() As Double<BR>Dim pnt<BR>Dim spnt(2) As Double, epnt(2) As Double<BR>Err.Clear<BR>Do While 1<BR>pnt = ThisDrawing.Utility.GetPoint(, vbCr & "请输入下一点:")<BR>ReDim Preserve pnts(i * 3 + 2)<BR>pnts(i * 3) = pnt(0)<BR>pnts(i * 3 + 1) = pnt(1)<BR>pnts(i * 3 + 2) = pnt(2)<BR>i = i + 1<BR>Loop<BR>ErrHandle:<BR>ThisDrawing.ModelSpace.AddSpline pnts, spnt, epnt<BR>End Sub<BR> 本帖最后由 作者 于 2004-11-22 5:57:50 编辑
谢谢. 本帖最后由 作者 于 2004-11-20 2:55:37 编辑 <br /><br /> 发现一个有意思的现象:
vet = ThisDrawing.Utility.GetPoint(, vbCrLf & "请输入第" & i & "个拟合点坐标:")<BR>这一句运行时,输入坐标一开始的提示语显示不正确,等输入完第一个数字后才变回来,但继续输入时,第一个数字总是莫名其妙的跑到后面,后来把全角的冒号改成半角的就没有这个输入问题了
页:
[1]