
! script name: pksolids.d/pkdisk
! solids: construct a disk sheet body in the current workplane.

!A
!A NAME:
!A
!A 	Disk
!A
!A DESCRIPTION:
!A
!A 	This script will construct a disk sheet body 
!A
!B INSTRUCTIONS:
!B
!B	DISK RADIUS: Enter the radius of the disk.
!B
!B	LOCATION POINT: Input the location of the center of the disk.
!B
!B	AXIS DIRECTION POINT: Input a point specifing the direction of
!B 		the disk axis.
!B
!# see also - htdocs/help.d/parasolids.htm

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

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


ActivateUndo
Units= CurrentUnits
IF Units= WsMetric THEN
        R1= 25
ELSE
        R1= 1
END IF

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

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

Stat=SetInputFormat("n4","")
Pe=XyzInput("AXIS DIRECTION POINT ",WsXyzInput)
IF ExitScript(Destination$) THEN Leave

WPKClearErrorFlag
C1=WPKDisk(Ps,Pe,R1)

Stat= DeleteEntity(Ps)
Stat= DeleteEntity(Pe)

ActivateUndo
Stat= AdvanceUndoNumber("disk sheet body")
Stat= AddItemToUndo(WsUBPKSessionMark)
WPKErrorCheck

GOTO Cloop

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