枫叶(fox) 发表于 2012-2-9 22:28:17

一个批量生成直线的问题

代码如下:
Dim Line(2) As AcadLine
For i = 0 to 2
   point_temp1(0) = Zheng_GK(i): point_temp1(1) = 0: point_temp1(2) = 0
   point_temp2(0) = 0 : point_temp2(1) = Ce_GK(i): point_temp2(2) = 0
   Set line(i) = ThisDrawing.ModelSpace.AddLine(point_temp1, point_temp2)
   line(i).TrueColor = color
   line(i).TransformBy transmatrix(i)
   line(i).Update
Next i
我想根据Zheng_GK(i) 和Ce_GK(i)数组中的不同值绘制不同直线,并改变直线的属性,但是发现VBA中不允许定义AcadLine对象为数组,不知有什么更好的方法,不需要一条一条的画直线。谢谢!!!

I大仙I 发表于 2012-2-10 11:51:26

Dim Line As AcadLine
For i = 0 to 2
    point_temp1(0) = Zheng_GK(i): point_temp1(1) = 0: point_temp1(2) = 0
    point_temp2(0) = 0 : point_temp2(1) = Ce_GK(i): point_temp2(2) = 0
    Set line = ThisDrawing.ModelSpace.AddLine(point_temp1, point_temp2)
    line.TrueColor = color
    line.TransformBy transmatrix(i)
    line.Update
Next i
这样貌似就可以了吧

yanyanjun999 发表于 2012-2-10 20:40:57

能把变量定义一下吗,大哥,比如Zheng_GK(i)
页: [1]
查看完整版本: 一个批量生成直线的问题