in process

Sub star_polygon()
Call connect_acad
Dim i As Integer, m As Integer
Dim R1 As Double, R2 As Double
Dim A1 As Integer, A2 As Integer
Dim n As Integer 'number of line segments
R1 = 50
R2 = 50
n = 11
m = 7
For i = 1 To n
A1 = 360 * (i - 1) * m / n
A2 = 360 * i * m / n
Call line_polar(R1, A1, R2, A2)
Update
Next
Update
End Sub
Sub spiral_1()
Call connect_acad
Dim i As Integer
Dim R1 As Double, R2 As Double
Dim A1 As Integer, A2 As Integer
Dim A_min As Integer 'start in degrees
Dim A_max As Integer 'finish in degrees
Dim A_inc As Integer 'degree increment
Dim n As Integer 'number of line segments
A_min = 0
A_max = 1800
A_inc = 3
n = (A_max - A_min) / A_inc 'number of line segments
For i = 1 To n
A1 = A_min + ((i - 1) * A_inc)
A2 = A_min + (i * A_inc)
R1 = 0.125 * A1
R2 = 0.125 * A2
Call line_polar(R1, A1, R2, A2)
Next
Update
End Sub
Sub line_polar(R1 As Double, A1 As Integer, R2 As Double, A2 As Integer)
'a POLAR line wrapper to draw a line with one line of code
'A1 and A2 are input in degrees integer only for now
Dim lineobj As AcadLine
Dim pt1(0 To 2) As Double
Dim pt2(0 To 2) As Double
pt1(0) = R1 * Cos(deg2rad(A1))
pt1(1) = R1 * Sin(deg2rad(A1))
pt1(2) = 0
pt2(0) = R2 * Cos(deg2rad(A2))
pt2(1) = R2 * Sin(deg2rad(A2))
pt2(2) = 0
Set lineobj = acadDoc.ModelSpace.AddLine(pt1, pt2)
End Sub
Function deg2rad(deg As Integer) As Double
deg2rad = deg * pi / 180
End Function

### Like this:

Like Loading...

*Related*