AddTorus Example

Using Programming Languages other than VBA

Sub Example_AddTorus()
	' This example creates a torus in model space.

	Dim torusObj As Acad3DSolid
	Dim centerPoint(0 To 2) As Double
	Dim torusRadius As Double
	Dim tubeRadius As Double

	' Define the torus
	centerPoint(0) = 5: centerPoint(1) = 5: centerPoint(2) = 0
	torusRadius = 15
	tubeRadius = 5

	' Create the torus
	Set torusObj = ThisDrawing.ModelSpace.AddTorus(centerPoint, torusRadius, tubeRadius)
		
	 ' 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?