Sorry for replying so late but here is the another way to address the problem. I have created a class module where all functionality are wrapped.
In VBA IDE go to Insert and then select Class Module. In that module write the following code. I have given name to that class module as clsmyParallogram.
Option Explicit
Private pi As Double
Private mLeg1Height As Double
Private mLeg1Angle As Double
Private mLeg2Height As Double
Private mLeg2Angle As Double
Private mBaseLength As Double
Private mLocation As Variant
'================
Public Property Let Leg1Height(pLeg1Height As Double)
mLeg1Height = pLeg1Height
End Property
'================
Public Property Get Leg1Height() As Double
Leg1Height = mLeg1Height
End Property
'================
Public Property Let Leg1Angle(pLeg1Angle As Double)
mLeg1Angle = pLeg1Angle
End Property
'================
Public Property Get Leg1Angle() As Double
Leg1Angle = mLeg1Angle
End Property
'================
Public Property Let Leg2Height(pLeg2Height As Double)
mLeg2Height = pLeg2Height
End Property
'================
Public Property Get Leg2Height() As Double
Leg2Height = mLeg2Height
End Property
'================
Public Property Let Leg2Angle(pLeg2Angle As Double)
mLeg2Angle = pLeg2Angle
End Property
'================
Public Property Get Leg2Angle() As Double
Leg2Angle = mLeg2Angle
End Property
'================
Public Property Let BaseLength(pBaseLength As Double)
mBaseLength = pBaseLength
End Property
'================
Public Property Get BaseLength() As Double
BaseLength = mBaseLength
End Property
'================
Public Property Let Location(pLocation As Variant)
mLocation = pLocation
End Property
'================
Public Property Get Location() As Variant
Location = mLocation
End Property
'================
Public Sub Draw()
Dim point(0 To 11) As Double
Dim tempPoint As Variant
Dim polyObj As AcadPolyline
point(0) = mLocation(0)
point(1) = mLocation(1)
point(2) = 0
With ThisDrawing.Utility
tempPoint = .PolarPoint(mLocation, mLeg1Angle + pi, mLeg1Height / Sin(mLeg1Angle))
point(3) = tempPoint(0)
point(4) = tempPoint(1)
point(5) = 0
tempPoint = .PolarPoint(tempPoint, 0, mBaseLength)
point(6) = tempPoint(0)
point(7) = tempPoint(1)
point(8) = 0
tempPoint = .PolarPoint(tempPoint, mLeg2Angle, mLeg2Height / Sin(mLeg2Angle))
point(9) = tempPoint(0)
point(10) = tempPoint(1)
point(11) = 0
End With
Set polyObj = ThisDrawing.ModelSpace.AddPolyline(point)
polyObj.Closed = True
polyObj.Update
Set polyObj = Nothing
End Sub
Private Sub Class_Initialize()
pi = 4 * Atn(1)
End Sub
In the Draw button click event write the following code -
Option Explicit
Private Sub cmdDraw_Click()
Dim pi As Double
Dim parallogram As clsmyParallogram
Set parallogram = New clsmyParallogram
Dim loc(0 To 2) As Double
'loc is initialized for the program tesing purpose only
loc(0) = 3000
loc(1) = 6000
loc(2) = 0
pi = 4 * Atn(1)
With parallogram
'Replace 5000 with the Val(applicable textbox)
.Leg1Height = 5000
'Replace 35 with the Val(applicable textbox)
.Leg1Angle = 35 * pi / 180
'Replace 3000 with the Val(applicable textbox)
.Leg2Height = 3000
'Replace 45 with the Val(applicable textbox)
.Leg2Angle = 45 * pi / 180
'Replace 6000 with the Val(applicable textbox)
.BaseLength = 6000
'Replace loc with ThisDrawing.Utility.GetPoint(,"Select Reference Point: ")
.Location = loc
.Draw
End With
Set parallogram = Nothing
End Sub
Please note that, the angles in the text boxes are in degrees and are converted to radians outside the class module.
Hope this helps.
Nimish