我编了个画纵断面的VBA,可是想在循环画地面线的时候,想利用循环语句为各种地面线赋予不同的图层并以颜色分开,但是执行结果都却是一个颜色。请高人指点,不胜感激。
'画地面线 Dim point1() As Double ReDim point1(h) Dim t As Double For l = 2 To 6
Set newLayer = ThisDrawing.Layers("l") ThisDrawing.ActiveLayer = newLayer newLayer.color = l
point1(0) = jd(0) point1(1) = jd(1) + (xlSheet.Cells(2, l).Value - min) / by * 1000 + 20 'point1(2) = 0 u = 3 For t = 1 To k - 2 If u <= k + 1 Then point1(2 * t) = point1(0) + (xlSheet.Cells(u, 1).Value - xlSheet.Cells(2, 1)) / bx * 1000 point1(2 * t + 1) = jd(1) + (xlSheet.Cells(u, l).Value - min) / by * 1000 + 20 'point1(3 * t + 2) = 0 u = u + 1 End If Next t Set zl = ThisDrawing.ModelSpace.AddLightWeightPolyline(point1) Next l |