
! script name: pksolids.d/circone
! solids: construct cone defined by circle, length and taper angle

!A
!A NAME:
!A
!A 	Cone: Solid cone from circle
!A
!A DESCRIPTION:
!A
!A 	This script constructs a cone of specified length and taper angle
!A 	using the picked circle as the start of the cone.  The picked circle
!A 	will determine the orientation of the axis line of the cone.
!A
!A
!B INSTRUCTIONS:
!B
!B 	PICK CIRCLE: Pick the circle to be used as the starting circle of the
!B 		cone.
!B
!B 	LENGTH: Enter the length of the cone to be constructed.
!B
!B 	CONE ANGLE: Enter the angle of taper of the cone.
!B
!C NOTES:
!C
!C

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

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

Length=1.0
Cone_angle=30.0
Stat= GLPlotOn

ActivateUndo
Cloop:!

pcircle=PickSpecificEnt("PICK CIRCLE",WsPickCircles)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(pcircle) THEN Cloop

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(Length)
Length=GetValue("LENGTH",Answer$)
IF ExitScript(Destination$) THEN Leave

Stat=SetAngleEquals(Cone_angle)
Cone_angle=InputAngle("CONE ANGLE")
IF ExitScript(Destination$) THEN Leave


WPKClearErrorFlag
C1=WPKCone(Pcircle,Cone_angle,Length)

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
