
! script name: pksolids.d/pksphere
! solids: construct a sphere in the current workplane

!A
!A NAME:
!A
!A 	Solid Sphere
!A
!A DESCRIPTION:
!A
!A 	This script will construct a sphere 
!A
!B INSTRUCTIONS:
!B
!B	RADIUS: Enter the radius if the sphere.
!B
!B	LOCATION POINT: Enter the location of the center of the sphere.
!B
!# see also - htdocs/help.d/parasolids.htm

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

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


IF Units= WsMetric THEN
        Radius= 25
ELSE
        Radius= 1
END IF

Stat= GLPlotOn
Cloop:!
Stat=SetInputFormat("n4=","")
Stat=SetRadiusEquals(Radius)
Radius=InputRadius("RADIUS")
IF ExitScript(Destination$) THEN Leave


Stat=SetInputFormat("n4","")
Pc=XyzInput("LOCATION POINT ",WsXyzInput)
IF ExitScript(Destination$) THEN Leave
Stat= SetLastPoint(Pc)

WPKClearErrorFlag
S1=WPKSphere(Pc,Radius)
Stat= DeleteEntity(Pc)

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
