Index of Functions




Public Amin As Double
Public Amax As Double
Public A_inc As Double
Public B As Double
Public C As Double
Public D As Double
Public funcname As String

Sub init_polar()
Call connect_acad
Amin = frm_polar.txt_amin.Value
Amax = frm_polar.txt_amax.Value
A_inc = frm_polar.txt_ainc
End Sub

Sub draw_p01()
Call init_polar
funcname = "P_01"
B = frm_polar.txt_b1.Value
C = frm_polar.txt_c1.Value
D = frm_polar.txt_d1.Value
Call draw_polar(funcname)
End Sub

Sub draw_polar(funcname As String)
Call connect_acad
Dim R As Double, A As Integer
Dim X As Double, Y As Double
Dim A_rad As Double
Dim i As Integer, numpts As Integer
Dim plineobj As AcadLWPolyline
Dim pt() As Double

numpts = (Amax - Amin) / A_inc 'num of lines
numpts = numpts + 1
ReDim pt(1 To numpts * 2)

For i = 1 To numpts
A = Amin + ((i - 1) * A_inc)
A_rad = deg2rad(A)

R = Application.Run(funcname, A_rad)

X = R * Cos(A_rad)
Y = R * Sin(A_rad)
pt(i * 2 - 1) = X: pt(i * 2) = Y
Next i

Set plineobj = acadDoc.ModelSpace.AddLightWeightPolyline(pt)
End Sub

Function P_01(A_rad As Double) As Double
'R = B * Sin(C * A) + D
P_01 = B * Sin(C * A_rad) + D
End Function



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s