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

!A
!A NAME:
!A
!A 	Sphere: Sphere from 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

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

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



Stat= GLPlotOn
ActivateUndo
Cloop:!
pcircle=PickSpecificEnt("PICK CIRCLE",WsPickCircles)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(pcircle) THEN Cloop

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


WPKClearErrorFlag
S1=WPKSphere(Pcircle)

ActivateUndo
Stat= AdvanceUndoNumber("solid sphere")
Stat= AddItemToUndo(WsUBPKSessionMark)
WPKErrorCheck
GOTO Cloop

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