The Cone

You create a 3DSolid object in the form of a cone using the AddCone method. The base of the cone is parallel with the XY plane of the WCS.

Set 3DSolidObject = Object.AddCone(ConeCenter, BaseRadius, Height)

Table 9-2 presents the AddCone method's parameters, and Figure 9-2 shows an example of a cone in AutoCAD.

Table 9-2. The AddCone Method's Parameters


Data Type




A three-element array of doubles specifying the cone's center in

WCS coordinates



A positive value representing the radius of the cone's circular base



A positive value representing the cone's height

Autocad Script End

This example creates a cone based on user input:

Public Sub TestAddCone()

Dim varPick As Variant Dim dblRadius 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 the base center point: ") .InitializeUserInput 1 + 2 + 4, ""

dblRadius = .GetDistance(varPick, vbCr & "Enter the radius: ") .InitializeUserInput 1 + 2 + 4, ""

dblHeight = .GetDistance(varPick, vbCr & "Enter the Z height: ") End With

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

dblCenter(1) = varPick(1)

'' draw the entity

Set objEnt = ThisDrawing.ModelSpace.AddCone(dblCenter, dblRadius, _



ThisDrawing.SendCommand "_shade" & vbCr End Sub

Was this article helpful?

0 0

Post a comment