The Elliptical Cone

The AddEllipticalCone method creates a 3DSolid object in the form of an elliptical cone whose base lies flat on the WCS XY plane. The major axis of the ellipse may lie in either the X direction or the Y direction.

Set 3DSolidObject = Object.AddEllipticalCone(ConeCenter, XLength, YLength, Height)

Table 9-7 presents the AddElliptical method's parameters, and Figure 9-7 shows an example of an elliptical cone in AutoCAD.

Table 9-7. The AddEllipticalCone Method's Parameters

Name

Data Type

Description

ConeCenter

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 cone's elliptical base

YLength

Double

A positive value representing the length of the Y-axis of the cone's elliptical base

Height

Double

A positive value representing the cone's height

Figure 9-7. An elliptical cone

Figure 9-7. An elliptical cone

The following example creates an elliptical cone based on user input:

Public Sub TestAddEllipticalCone() 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 cone Z height: ") End With

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

dblCenter(1) = varPick(1)

'' draw the entity

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

dblXAxis, dblYAxis, dblHeight)

objEnt.Update

ThisDrawing.SendCommand "_shade" & vbCr End Sub

Was this article helpful?

0 0

Post a comment