
! script name: solids.d/cone
! 3dtopic: construct cone of specified length, start radius, end radius, orientation

!A
!A NAME:
!A
!A 	Cone: Define
!A
!A DESCRIPTION:
!A
!A 	This script constructs a cone of specified length, starting radius,
!A 	ending radius, and orientation at the specified center point.
!A
!A~ image location - images/DefineCone.gif
!A
!B INSTRUCTIONS:
!B
!B 	START RADIUS: Enter the starting radius of the cone.
!B
!B 	END RADIUS: Enter the ending radius of the cone.
!B
!B 	LENGTH: Enter the length of the cone to be constructed.
!B
!B 	STARTING ANGLE: Enter the starting angle of the cone.
!B
!B 	ANGULAR EXTENT: Enter the number of degrees and the direction
!B 		( + CCW, - CW ) from the starting angle to the ending angle.
!B 		The angular extent determines the ending angle.
!B
!B~ image location - images/AngExtent.gif
!B
!B 	CENTER POINT ABS X,Y,Z: Enter the X,Y,Z coordinates of the center of
!B 		the cone.  NOTE: See XYZ INPUT OPTIONS
!B
!B 	AXIS ROTATION ANGLE: Enter the orientation angle of the axis line of
!B 		the cone in the XY plane.
!B
!B 	AXIS TILT ANGLE: This represents the angle of tilt of the axis line
!B 		of the cone with respect to the XY plane.
!B
!B 	AXIS ROLL ANGLE: This represents the roll angle around the axis line
!B 		of the cone.
!B
!C NOTES:
!C
!C 	The U contours of a cone are the circles and the V contours are the
!C 	lines.
!C
!# see also - points.d/xyzinput.hlp

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

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

ActivateUndo
Units= CurrentUnits
IF Units= WsMetric THEN
	R1= 25
	R2= 25
        Length= 100
ELSE
	R1= 1
	R2= 1
        Length=5
END IF
Astart= 0
Angle= 180

Cloop:!

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(R1)
R1=InputRadius("START RADIUS")
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(R2)
R2=InputRadius("END RADIUS")
IF ExitScript(Destination$) THEN Leave

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

Stat=SetAngleEquals(Astart)
Astart=InputAngle("STARTING ANGLE")
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(Angle)
Angle=GetValue("ANGULAR EXTENT",Answer$)
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4","")
Pt=XyzInput("CENTER POINT ",WsXyzInput)
IF ExitScript(Destination$) THEN Leave

Stat=SetAngleEquals(0)
Zangle=InputAngle("AXIS ROTATION ANGLE ",WsSigned)
IF ExitScript(Destination$) THEN Leave

Zangle=Zangle-90

Stat=SetAngleEquals(0)
Xangle=InputAngle("AXIS TILT ANGLE ",WsSigned)
IF (ExitScript(Destination$)) THEN Leave

Stat=SetAngleEquals(0)
Yangle=InputAngle("AXIS ROLL ANGLE ",WsSigned)
IF (ExitScript(Destination$)) THEN Leave

T1=AngleTransform(Pt,Xangle,Yangle,Zangle,WsWorkplaneVals)

C1=Cone(T1,R1,R2,Length,Astart,Angle)
Stat=DeleteEntity(Pt)

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

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