
! script name: solids.d/diskaxis
! 3dtopic: construct disk using an axis line

!A
!A NAME:
!A
!A 	Disk: Axis Line
!A
!A DESCRIPTION:
!A
!A 	This script constructs a disk ( or a part of a disk ), which is
!A 	a plane with a circular boundary, of specified radius and angular
!A 	extent, with the axis line as its normal vector.
!A
!B INSTRUCTIONS:
!B
!B 	DISK RADIUS: Enter the radius of the disk to be constructed.
!B
!B 	STARTING ANGLE: Enter the starting angle of the disk.
!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 	TILT ANGLE: This represents the angle of tilt of the axis of the
!B		disk around the selected axis.
!B
!B 	PICK AXIS LINE: Pick the line to be used as the axis of the disk.
!B
!C NOTES:
!C
!C 	The U contours of a disk are the circles and the V contours are the
!C 	radial lines.
!C

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

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

ActivateUndo
Units= CurrentUnits
IF Units= WsMetric THEN
        Radius= 25
ELSE
        Radius= 1
END IF
Astart= 0
Angle= 180

Cloop:!

Stat=SetInputFormat("n4=","")
Stat=SetRadiusEquals(Radius)
Radius=InputRadius("DISK RADIUS")
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=","")
Stat=SetEqualsValue(tilt_angle)
Tilt_angle=GetValue("TILT ANGLE",Answer$)
IF ExitScript(Destination$) THEN Leave

Pick_axis:!
Stat=SetInputFormat("n4","")
Axis_line=PickSpecificEnt("PICK AXIS LINE",WsPickLines)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Axis_line) THEN Pick_axis

T=LastPickPara
IF T<=0.5 THEN
	Direction=WsForward
ELSE
	Direction=WsReverse
END IF

C1=AxisLineDisk(Axis_line,Radius,Astart,Angle,Tilt_angle,Direction)

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

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