紧急求助:怎样用语句控制AUTOCAD的直线绘制
我想用vb控制autocad,画一个矩形 不知道怎么总出现灾难性错误。不知道是不是画直线的命令不对。其中一部分程学如下:Sub 舵结构造型()
'舵输入参数
a = Val(Me.TextBox1.Text) '中心线前
b = Val(Me.TextBox2.Text) '中心线后
h = Val(Me.TextBox3.Text) '舵高
l = Val(Me.TextBox4.Text) '舵宽
c = Val(Me.TextBox5.Text) '基线
Dim lines(5) As AutoCAD.AcadEntity
Dim points0(5) As Double
Dim points1(5) As Double
Dim points2(5) As Double
Dim points3(5) As Double
Dim points4(5) As Double
points0(0) = 0 : points0(1) = 0 : points0(2) = 0 '第0点
points0(3) = a : points0(4) = points0(1) : points0(5) = 0 '第1点
points1(0) = points0(2) : points1(1) = points0(3) : points1(2) = 0 '第1点
points1(3) = points1(0) + b : points1(4) = points0(3) : points1(5) = 0 '第2点
points2(0) = points1(2) : points2(1) = points1(3) : points2(2) = 0 '第2点
points2(3) = points2(0) : points2(4) = points2(1) + h : points2(5) = 0 '第3点
points3(0) = points2(2) : points3(1) = points2(3) : points3(2) = 0 '第3点
points3(4) = points3(0) - l : points3(4) = points3(1) : points3(5) = 0 '第4点
points4(0) = points3(2) : points4(1) = points3(3) : points4(2) = 0 '第4点
points4(3) = 0 : points4(4) = 0 : points4(5) = 0 '第5点
lines(0) = acadapp.ActiveDocument.ModelSpace.AddLine(points0, points1) '由0,1点组成
lines(1) = acadapp.ActiveDocument.ModelSpace.AddLine(points1, points2) '由1,2点组成
lines(2) = acadapp.ActiveDocument.ModelSpace.AddLine(points2, points3) '由2,3点组成
lines(3) = acadapp.ActiveDocument.ModelSpace.AddLine(points3, points4) '由3,4点组成
lines(4) = acadapp.ActiveDocument.ModelSpace.AddLine(points4, points0) '由4,5点组成
If Me.CheckBox1.Checked Then
'用系统变量设置捕捉绘图形式
acadapp.ActiveDocument.SetVariable("SNAPMODE", 1)
Else
acadapp.ActiveDocument.SetVariable("SNAPMODE", 0)
End If
End Sub
请各位高手指点,在线等。谢谢