
! script name: solids.d/plane
! 3dtopic: construct plane of specified length, width, and orientation

!A
!A NAME:
!A
!A 	Plane: Define
!A
!A DESCRIPTION:
!A
!A 	This script will construct a plane of specified length, width, and
!A 	orientation.
!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 	REFERENCE POINT ABS X,Y,Z: Enter the X,Y,Z coordinates of the lower
!B 		left-hand corner of the plane.  NOTE: See XYZ INPUT OPTIONS.
!B
!B 	ROTATION ANGLE: Enter the orientation angle of the axis of the plane
!B 		in the XY plane.
!B
!B 	X AXIS TILT ANGLE: This represents the angle of tilt of the axis of
!B 		the plane around the X axis.
!B
!B 	Y AXIS TILT ANGLE: This represent the angle of tilt of the axis of
!B 		the plane around the Y axis.
!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
!# see also - points.d/xyzinput.hlp

Stat=ChangeLabelStr("ScriptNameStatus","Function: 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=SetInputFormat("n4","")
Pt=XyzInput("REFERENCE POINT ",WsXyzInput)
IF ExitScript(Destination$) THEN Leave

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

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

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

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

C1=Plane3d(T1,Xlength,Ylength)

Stat=DeleteEntity(Pt)

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
