
! script name: solids.d/planeaxis
! 3dtopic: construct plane using axis line

!A
!A NAME:
!A
!A 	Plane: Axis line
!A
!A DESCRIPTION:
!A
!A 	This script will construct a plane of specified length and width, 
!A 	with the axis line as its normal vector.
!A
!B INSTRUCTIONS:
!B
!B 	X LENGTH: Enter the length of the plane measured along the X axis.
!B
!B 	Y LENGTH: Enter the length of the plane measured along the Y axis.
!B
!B 	TILT ANGLE: This represents the angle of tilt of the axis of the
!B 		plane around the selected axis line.
!B
!B 	PICK AXIS LINE: Pick the line to be used as the axis of the plane.
!B
!C NOTES:
!C
!C 	The U contours of a plane are the lines parallel to the length of
!C 	the plane ( parallel to X axis in an unoriented plane ) and the V
!C 	contours are the lines parallel to the width of the plane ( parallel
!C 	to Y axis in an unoriented plane ).
!C

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

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

ActivateUndo
Units= CurrentUnits
IF Units= WsMetric THEN
        Xlength= 100
        Ylength= 100
ELSE
        Xlength=5
        Ylength=5
END IF

Cloop:!

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

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

Stat=SetAngleEquals(Tilt_angle)
Tilt_angle=InputAngle("TILT ANGLE ",WsSigned)
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

On_center=1
C1=AxisLinePlane(Axis_line,Xlength,Ylength,Tilt_angle,On_center,Direction)

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

Leave:!
Stat=DeleteEntity(Pt)

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