已知圆心角、弧长,VBA绘圆弧
Sub AddArcLength()' This example creates an arc in model space.
' 已知圆心角、弧长绘弧
Dim arcObj As AcadArc
Dim centerPoint As Variant
Dim radius As Double
Dim startAngleInRadian As Double
Dim endAngleInRadian As Double
Dim ARCLength As Double
Dim lineobj As AcadLine
Dim getobj As ACADObject
Dim p As Variant
'centerPoint(0) = 0#: centerPoint(1) = 0#: centerPoint(2) = 0#
centerPoint = ThisDrawing.Utility.GetPoint(, "请指定圆心:")
ThisDrawing.Utility.GetEntity getobj, p, "选择第一条直线:"
startAngleInRadian = getobj.Angle
ThisDrawing.Utility.GetEntity getobj, p, "选择第二条直线:"
endAngleInRadian = getobj.Angle
ARCLength = ThisDrawing.Utility.GetString(0, vbCrLf & "所绘弧长:")
radius = ARCLength / (endAngleInRadian - startAngleInRadian)
' Create the arc object in model space
Set arcObj = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngleInRadian, endAngleInRadian)
' ZoomAll
End Sub
页:
[1]