
! script name: solids.d/cirsphere
! 3dtopic: construct sphere defined by circle, start length, and end length

!A
!A NAME:
!A
!A 	Sphere: Circle
!A
!A DESCRIPTION:
!A
!A 	This script constructs a sphere or a part of a sphere, using the
!A 	picked circle as the reference for the center of the sphere.
!A
!B INSTRUCTIONS:
!B
!B 	PICK CIRCLE: Pick the circle to be used as the
!B 		reference for the center of the sphere.
!B
!B 	STARTING LENGTH: Enter the controlling extent of the
!B 		sphere along the axis, negative measures backward
!B 		from the starting point, zero is the center
!B 		or starting point.
!B
!B 	ENDING LENGTH: Enter the controlling extent of the
!B 		sphere along the axis, positive measures forward
!B 		from the starting point, zero is the center
!B 		or starting point.
!B
!C NOTES:
!C
!C 	The U contours of a sphere are the circles from the starting length
!C 	to the ending length.  The V contours of a sphere are the circles 
!C 	formed from the starting angle to the ending angle.
!C

Stat=ChangeLabelStr("ScriptNameStatus","Function: sphere defined by a circle ")

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



ActivateUndo
Cloop:!


pcircle=PickSpecificEnt("PICK CIRCLE",WsPickCircles)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(pcircle) THEN Cloop

Radius=CircleRadius(pcircle)
Radius=ABS(Radius)

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(-Radius)
Start_length=GetValue("STARTING LENGTH",Answer$)
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(Radius)
End_length=GetValue("ENDING LENGTH",Answer$)
IF ExitScript(Destination$) THEN Leave

C1=CircleSphere(Pcircle,Start_length,End_length)

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

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