利用VBA宏代码调用AddCircle方法绘制圆,该函数需要两个参数,一个用来定义圆心坐标的数组,一个定义圆半径的实数。可以将其存放在变量中获取利用该函数创建的圆。
利用AddCircle方法绘制圆的示例代码如下。
Public Sub drawcircle()
Dim circleobject As AcadCircle
Dim center As Variant
Dim radius As Double
With ThisDrawing.Utility
center = .GetPoint(, "Click the position for the center.")
radius = .GetDistance(center, "Enter the radius.")
End With
Set circleobject = ThisDrawing.ModelSpace.AddCircle(center, radius)
circleobject.color = acRed
circleobject.Update
End Sub
代码完。