
! script name: pksolids.d/pkcone
! solids: construct cone solid

!A
!A NAME:
!A
!A 	Solid Cone
!A
!A DESCRIPTION:
!A
!A	This script constructs a solid cone. 
!A
!B INSTRUCTIONS:
!B
!B 	STARTING RADIUS: Enter the starting radius of the cone.
!B
!B 	ENDING RADIUS: Enter the ending radius of the cone.
!B
!B 	LENGTH: Enter the length of the cone. 
!B
!B 	LOCATION POINT: Input the location of the bottom of the cone.
!B
!B 	AXIS DIRECTION POINT: Input a point specifing the direction of
!B 		the cone axis.
!B
!# see also - htdocs/help.d/parasolids.htm

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

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

ActivateUndo
Units= CurrentUnits
IF Units= WsMetric THEN
        R1= 25
        R2= 25
	Length1= 125
ELSE
        R1= 1
        R2= 1
	Length1= 5
END IF

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

Stat=SetRadiusEquals(R2)
R2=InputRadius("ENDING RADIUS")
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4=","")
Stat=SetDepthEquals(Length1)
Length1=InputDepth("CONE LENGTH")
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=WPKCone(Ps,Pe,R1,R2,Length1)

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

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

Leave:!
Stat=SetInputFormat("n4","")
IF NOT LEN(Destination$) THEN
	LOAD "typecontrol"
ELSE
	LOAD Destination$
END IF
END
