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

!A
!A NAME:
!A
!A 	Entity Revolution
!A
!A DESCRIPTION:
!A
!A 	This script generates a solid of revolution by rotating an entity
!A 	about an axis.
!A
!B INSTRUCTIONS:
!B
!B 	PICK AXIS LINE: Pick the line to be used as the axis of the revolution.
!B
!B 	STARTING ANGLE: Enter the starting angle of the solid of revolution.
!B
!B 	ANGULAR EXTENT: Enter the number of degrees and the direction
!B 		( + CCW, - CW) from the starting angle to the ending angle.
!B 		The angular extent determines the ending angle.
!B
!B 	PICK ENTITY: Pick the entity to be used to generate a solid of
!B 		revolution.
!B
!C NOTES:
!C
!C 	The U contours of a revolution are along the entity and the V contours
!C 	are the circles.
!C

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

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

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

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

Cloop:!
Stat=SetPickMask(WsPickNoSurf)
E1=PickEntity("PICK ENTITY ")
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(E1) THEN Cloop
Stat=SetPickMask(WsPickAll)

Pt=ParameterPt(E1,0.25)
T1=RevAxisTransform(Axis_line,Pt)
C1=Revolution(T1,E1,Axis_line,Astart,Angle)
Stat=DeleteEntity(Pt)

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

Leave:!
Stat=DeleteEntity(Pt)
Stat=SetPickMask(WsPickAll)

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