
! script name: solids.d/revolution
! 3dtopic: generate solid of revolution by rotating contour about an axis

!A
!A NAME:
!A
!A 	Revolution
!A
!A DESCRIPTION:
!A
!A 	This script generates a solid of revolution by rotating a contour
!A 	about an axis.
!A
!B INSTRUCTIONS:
!B
!B 	PICK CONTOUR: Pick the contour to be used to
!B 		generate a solid of revolution.
!B
!B 	STARTING ANGLE: Enter the starting angle of the
!B 		solid of revolution.
!B
!B 	ANGULAR EXTENT: Enter the number of degrees and
!B 		the direction ( + CCW, - CW) from the starting angle
!B 		to the ending angle.  The angular extent determines
!B 		the ending angle.
!B
!B 	PICK AXIS LINE: Pick the line to be used as the
!B 		axis of the revolution.
!B
!B 	ORIENTATION POINT ABS X,Y,Z: Enter the X,Y,Z
!B 		coordinates of the orientation point of the
!B 		revolution.  NOTE: See XYZ INPUT OPTIONS.
!B
!C NOTES:
!C
!C 	The U contours of a revolution are the contour and the V contours
!C 	are the circles.
!C
!# see also - points.d/xyzinput.hlp

Stat=ChangeLabelStr("ScriptNameStatus","Function: revolution ")

DIM Destination$[256]
DIM Answer$[256]

ActivateUndo
Cloop:!
Contour=PickGroupEnt("PICK CONTOUR ")
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Contour) THEN Cloop

Stat=Highlight(Contour,WsPickPen,WsDirArrowOff)

Stat=SetAngleEquals(0)
Astart=InputAngle("STARTING ANGLE")
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(180)
Angle=GetValue("ANGULAR EXTENT",Answer$)
IF ExitScript(Destination$) THEN Leave

Line_loop: Axis_line=PickSpecificEnt("PICK AXIS LINE",WsPickLines)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Axis_line) THEN Line_loop

Stat=SetInputFormat("n4","")
Pt=XyzInput("ORIENTATION POINT ",WsXyzInput)
IF ExitScript(Destination$) THEN Leave

T1=RevAxisTransform(Axis_line,Pt)

C1=Revolution(T1,Contour,Axis_line,Astart,Angle)
Stat=DeleteEntity(Pt)

ActivateUndo
Stat= AdvanceUndoNumber("revolution")
Stat= AddItemToUndo(WsUBCreateMode,C1)
GOTO Cloop

Leave:!
Stat=DeleteEntity(Pt)

IF NOT LEN(Destination$) THEN
	LOAD "typecontrol"
ELSE
	LOAD Destination$
END IF
END
