我想看一级黄色大片_久久亚洲国产精品一区二区_久久精品免视看国产明星_91久久青青青国产免费

您的位置:網站首頁 > CAD新聞

AutoVBA利用AddArc方法創建Arc對象

時間:2012-01-31 17:58:42 來源:未知

在AutoVBA中可以利用AddArc方法創建Arc對象,該方法需要有四個參數才能繪制圓弧,參數分別是圓心、半徑、起始角和終止角,用來確定圓弧的位置和長度。利用Utility對象繪制圓弧的代碼如下。

Public Sub drawarc()
    Dim newarcobj As AcadArc
    Dim center As Variant
    Dim radius As Double
    Dim startangle As Double, endangle As Double
    With ThisDrawing.Utility
        center = .GetPoint(, vbCr & "Click on center point.")
        radius = .GetDistance(center, vbCr & "Enter the radius")
        startangle = .GetAngle(center, vbCr & "Enter the start angle")
        endangle = .GetAngle(center, vbCr & "Enter the end angle")
    End With
    Set newarcobj = ThisDrawing.ModelSpace.AddArc(center, radius, startangle, endangle)
    newarcobj.Update
End Sub

代碼完。

該段函數用到的方法getpoint、getdistance、getangle和lisp函數中的getpoint、getdistance、getangle三個函數功能相同,只是書寫方式不一樣。將圓心、半徑、起始角和終止角四個函數傳遞到AddArc方法中,即可繪制圓弧。


相關文章