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

!A
!A NAME:
!A
!A 	Cone: 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~ image location - images/circone.gif
!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 	The U contours of a cone are the circles and the V contours are
!C 	the lines.
!C

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

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

Length=1.0
Cone_angle=30.0

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


C1=CircleCone(Pcircle,Length,Cone_angle)

ActivateUndo
Stat= AdvanceUndoNumber("cone")
Stat= AddItemToUndo(WsUBCreateMode,C1)
GOTO Cloop

Leave:!
Stat=SetInputFormat("n4","")

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