您的位置:网站首页 > CAD新闻

AutoVBA利用for循环创建同心圆弧

时间:2012-01-31 17:58:04 来源:未知

AutoVBA在一个For循环中调用AddArc方法,创建许多不同大小的同心弧,程序代码如下。

Sub lotsofarcs()
    Dim newarobj As AcadArc
    Dim center As Variant
    Dim radius As Variant
    Dim startangle As Double, endangle As Double
    Dim counter As Integer
    With ThisDrawing.Utility
        center = .GetPoint(, vbCr & "Click on center point.")
    End With
    For counter = 1 To 5
        radius = counter / 2
        startangle = 0
        endangle = 180
        Set newarcobj = ThisDrawing.ModelSpace.AddArc(center, radius, startangle, endangle)
        newarcobj.Update
    Next
End Sub

代码完。


相关文章