The Sphere

You use the AddSphere method to create a 3DSolid object representing a sphere and to add it to a drawing.

Set 3DSolidObject = Object.AddSphere(SphereCenter, Radius)

Table 9-4 presents the AddSphere method's parameters, and Figure 9-4 shows an example of a sphere in AutoCAD.

Table 9-4. The AddSphere Method's Parameters


Data Type




A three-element array of doubles specifying the sphere's

center in WCS coordinates



A positive value representing the sphere's radius

This example creates a sphere based on user input:

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

dblRadius = .GetDistance(varPick, vbCr & "Enter the radius: ") End With

'' draw the entity

Set objEnt = ThisDrawing.ModelSpace.AddSphere(varPick, dblRadius) objEnt.Update

ThisDrawing.SendCommand "_shade" & vbCr End Sub

Was this article helpful?

0 0

Post a comment