AddSphere Example

Using Programming Languages other than VBA

Sub Example_AddSphere()
	' This example creates a sphere in model space.

	Dim sphereObj As Acad3DSolid
	Dim centerPoint(0 To 2) As Double
	Dim radius As Double

	centerPoint(0) = 5#: centerPoint(1) = 5#: centerPoint(2) = 0#
	radius = 5#
	Set sphereObj = ThisDrawing.ModelSpace.AddSphere(centerPoint, radius)
	
	 ' Change the viewing direction of the viewport
	Dim NewDirection(0 To 2) As Double
	NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
	ThisDrawing.ActiveViewport.direction = NewDirection
	ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
	ZoomAll

End Sub

 

   Comments?