关于CAD中利用VBA画椭圆
这是我写的一个程序
谁帮忙看看出了啥问题
谢谢!
代码如下:
Private Sub CommandButton1_Click()
Dim pEllipse As AcadEllipse
Dim center(0 To 2) As Double '中心点坐标
Dim p(0 To 2) As Double '长轴偏移坐标
Open TextBox1.Text For Input As #1
Dim maj As Double, min As Double, angle As Double
Dim ratio As Double
While Not (EOF(1))
Input #1, maj, min, angle, center(0), center(1)
p(1) = maj / 2#
Set pEllipse = ThisDrawing.ModelSpace.AddEllipse(center, p, min / maj)
pEllipse.Rotate center, (360 - angle) * 3.1415 / 180#
Wend
Close #1
#1的数据 分别表示椭圆长轴,短轴,方位角,中心点坐标X,中心点坐标Y
格式如下:
58 42.793428 153.4 1496520.872 683697.5021
58.53 44.578809 158.7 1496647.863 683811.4049
57.8 42.908471 152.6 1496774.701 683925.3749
56.75 43.271307 154.7 1496901.598 684039.478
57.66 42.061933 155.1 1497028.602 684153.6096
58.76 45.14971 156 1497155.75 684267.6914
56.91 44.919406 151.7 1497283.077 684381.6449
57.8 45.166327 155.2 1497410.967 684495.4249
57.33 42.24657 152.7 1497539.173 684609.0442
57.8 45.166327 155.2 1497667.743 684722.398
59.69 42.273164 153 1497796.575 684835.4404
57.66 45.285644 154.5 1497925.801 684947.8836
58.92 42.758874 156.9 1498055.291 685060.0152
60.3 43.297919 158.2 1498185.031 685171.8612