## The Elliptical Cylinder

Use the AddEllipticalCylinder method to add a 3DSolid elliptical cylinder whose base lies parallel to the WCS XY plane. The major axis of the elliptical base lies either in the X direction or in the Y direction.

Set 3DSolidObject = Object.AddEllipticalCylinder _ (CylinderCenter, XLength, YLength, Height)

Table 9-8 presents the AddEllipticalCylinder method's parameters, and Figure 9-8 shows an example of an elliptical cylinder in AutoCAD.

 Name Data Type Description CylinderCenter Variant A three-element array of doubles specifying the center of the bounding box in WCS coordinates XLength Double A positive value representing the length of the X-axis of the cylinder's elliptical base YLength Double A positive value representing the length of the Y-axis of the cylinder's elliptical base Height Double A positive value representing the cylinder's height This example creates an elliptical cylinder based on user input:

Public Sub TestAddEllipticalCylinder() Dim varPick As Variant Dim dblXAxis As Double Dim dblYAxis As Double Dim dblHeight As Double Dim dblCenter(2) As Double Dim objEnt As Acad3DSolid

'' set the default viewpoint SetViewpoint

'' get input from user With ThisDrawing.Utility .InitializeUserInput 1

varPick = .GetPoint(, vbCr & "Pick a base center point: ") .InitializeUserInput 1 + 2 + 4, ""

dblXAxis = .GetDistance(varPick, vbCr & "Enter the X eccentricity: ") .InitializeUserInput 1 + 2 + 4, ""

dblYAxis = .GetDistance(varPick, vbCr & "Enter the Y eccentricity: ") .InitializeUserInput 1 + 2 + 4, "" dblHeight = .GetDistance(varPick, vbCr & _

"Enter the cylinder Z height: ")

End With

'' calculate center point from input dblCenter(0) = varPick(0)

dblCenter(1) = varPick(1)

'' draw the entity

Set objEnt = ThisDrawing.ModelSpace.AddEllipticalCylinder(dblCenter, _

dblXAxis, dblYAxis, dblHeight)

objEnt.Update

ThisDrawing.SendCommand "_shade" & vbCr End Sub