! script name: vpksolids.d/vpkcirsphere
! var_solids: construct sphere defined by circle 

!A
!A NAME:
!A
!A 	Sphere: Solid sphere from circle VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script constructs a sphere.
!A 	using the picked circle as the start of the sphere. The picked circle
!A 	will determine the orientation of the axis line of the sphere.
!A
!A
!B INSTRUCTIONS:
!B
!B 	PICK CIRCLE: Pick the circle to be used as the starting circle of the
!B 		sphere.
!B
!B
!C NOTES:
!C
!C

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

DIM Destination$[256]
DIM Answer$[256]
DIM Circle_var$[256]
DIM Name$[256]

Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave

ActivateUndo
Units= CurrentUnits
Length=1

Stat= GLPlotOn
Cloop:!
Pcircle=PickSpecificEnt("PICK CIRCLE",WsPickCircles)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidDependency(pcircle) THEN Cloop
Stat= EntityNameCheck(pcircle,Circle_var$)


WPKClearErrorFlag
Stat= GenerateVarName("Body",Name$)
RecordFunctionOn
Stat= RecordDescr("SPHERE: Circle")
Pkbody=WPKSphere(Circle_var$)
Stat= WPKNameBody(Pkbody,Name$)
Stat= WPKSetBodyParent(Pkbody)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord

Stat= WPKSolidRecordOn(Curr_record)
ActivateUndo
Stat= AdvanceUndoNumber("solid sphere, circle")
Stat= AddItemToUndo(WsUBPKSessionMark)
Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
WPKErrorCheck
GOTO Cloop

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



