对数螺线怎末被填充了?
对数螺线怎末被填充了?在伊凡老师的指导下,我用VBA编制了模拟型的对数螺线,可运行后屏幕上的图形竟被填充了,而不是单纯的一条曲线。在AutoCAD绘图环境中选中它,竟出现了两条曲线,这是何故?如何得到单一一条对数螺线?请大家帮忙看看!谢谢您了!!!
Public Sub DrawLog()<BR> Dim line1 As AcadLine<BR> Dim spnt(0 To 2) As Double<BR> Dim epnt(0 To 2) As Double<BR> Dim a As Double<BR> Dim pi As Double<BR> pi = 3.1415926<BR> <BR> For a = 0 To 2 * pi Step pi / 360<BR> spnt(0) = 27.36 * Exp(0.176 * a) * Cosa<BR> spnt(1) = 27.36 * Exp(0.176 * a) * Sina<BR> spnt(2) = 0<BR> <BR> epnt(0) = 27.36 * Exp(0.176 * (a + pi / 360)) * Cos(a + pi / 360)<BR> epnt(1) = 27.36 * Exp(0.176 * (a + pi / 360)) * Sin(a + pi / 360)<BR> epnt(2) = 0<BR> <BR> Set line1 = ThisDrawing.ModelSpace.AddLine(spnt, epnt)<BR> <BR> Next a
ThisDrawing.Application.ZoomExtents<BR>End Sub<BR> spnt(0) = 27.36 * Exp(0.176 * a) * Cosa<BR>spnt(1) = 27.36 * Exp(0.176 * a) * Sina<BR>晕,怎么能这样
应该是
spnt(0) = 27.36 * Exp(0.176 * a) * Cos(a)<BR>spnt(1) = 27.36 * Exp(0.176 * a) * Sin(a)
不过最好用样式曲线模拟 用多段线生成的程序:Public Sub DrawLog()
Dim pline As AcadLWPolyline
Dim pnts() As Double
Dim a As Double
Dim pi As Double
pi = 3.1415926
Dim i As Long
For a = 0 To 2 * pi Step pi / 360
ReDim Preserve pnts(i + 1)
pnts(i) = 27.36 * Exp(0.176 * a) * Cos(a)
pnts(i + 1) = 27.36 * Exp(0.176 * a) * Sin(a)
i = i + 2
Next a
Set pline = ThisDrawing.ModelSpace.AddLightWeightPolyline(pnts)
ThisDrawing.Application.ZoomExtents
End Sub
页:
[1]