- 积分
- 264
- 明经币
- 个
- 注册时间
- 2020-8-25
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2020-9-4 13:26:20
|
显示全部楼层
Public Function AddPolygon(ByVal centerpoint As Variant, ByVal sideCount As Double, ByVal radius As Double, Optional width As Double = 0, Optional angle As Double = 0) As AcadLWPolyline
Dim math As New clsmath
Dim sideAngle As Double
sideAngle = (2 * math.PI()) / sideCount
Dim verts As New cls2dPointArray
Dim i As Integer
Dim point(0 To 1) As Double
For i = 0 To 2 * (sideCount - 1)
If i Mod 2 = 0 Then
point(0) = centerpoint(0) + radius * Sin((i / 2) * sideAngle)
verts.Append point
Else
point(1) = centerpoint(1) + radius * Cos((i / 2) * sideAngle)
End If
Next i
Set AddPolygon = AddLWPolyline(verts.ToArray(), True, width)
AddPolygon.Rotate centerpoint, angle
AddPolygon.Update
End Function |
|