
! script name: solids.d/lineplane
! 3dtopic: construct plane along line at an angle

!A
!A NAME:
!A
!A 	Plane: Line
!A
!A DESCRIPTION:
!A
!A 	This script will construct a plane along a picked line at an angle.
!A
!B INSTRUCTIONS:
!B
!B 	PICK LINE: Pick the line that will define one edge of the plane.
!B
!B 	HEIGHT: Enter the height of the plane to be constructed.
!B
!B 	NORMAL ANGLE: Enter the normal angle to be used for constructing
!B 		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: plane defined along a line at an angle ")

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

ActivateUndo
Angle=0.0
Height=1.0
Plane_loop:!

Stat=SetInputFormat("n4","")
Axis_line=PickSpecificEnt("PICK LINE",WsPickLines)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Axis_line) THEN Line_loop
T=LastPickPara
IF T<=0.5 THEN
	Direction=WsForward
ELSE
	Direction=WsReverse
END IF

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

Stat=SetAngleEquals(Angle)
Angle=InputAngle("NORMAL ANGLE")
IF ExitScript(Destination$) THEN Leave

Plane1=LinePlane(Axis_line,Height,Angle,Direction)

ActivateUndo
Stat= AdvanceUndoNumber("plane")
Stat= AddItemToUndo(WsUBCreateMode,Plane1)
GOTO Plane_loop

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