AddRevolvedSolid Example

Using Programming Languages other than VBA

Sub Example_AddRevolvedSolid()
	' This example creates a solid from a region
	' rotated around an axis.
	' The region is created from an arc and a line.
	Dim curves(0 To 1) As AcadEntity

	' Define the arc
	Dim centerPoint(0 To 2) As Double
	Dim radius As Double
	Dim startAngle As Double
	Dim endAngle As Double
	centerPoint(0) = 5#: centerPoint(1) = 3#: centerPoint(2) = 0#
	radius = 2#
	startAngle = 0
	endAngle = 3.141592
	Set curves(0) = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngle, endAngle)

	' Define the line
	Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).startPoint, curves(0).endPoint)
	
	' Create the region
	Dim regionObj As Variant
	regionObj = ThisDrawing.ModelSpace.AddRegion(curves)
	ZoomAll
	MsgBox "Revolve the region to create the solid.", , "AddRevolvedSolid Example"

	' Define the rotation axis
	Dim axisPt(0 To 2) As Double
	Dim axisDir(0 To 2) As Double
	Dim angle As Double
	axisPt(0) = 7: axisPt(1) = 2.5: axisPt(2) = 0
	axisDir(0) = 11: axisDir(1) = 1: axisDir(2) = 3
	angle = 6.28
	
	' Create the solid
	Dim solidObj As Acad3DSolid
	Set solidObj = ThisDrawing.ModelSpace.AddRevolvedSolid(regionObj(0), axisPt, axisDir, angle)
	ZoomAll

	 ' 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
	MsgBox "Solid created.", , "AddRevolvedSolid Example"

End Sub

 

   Comments? 
500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@entercad.forsenergy.ru to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.