
! script name: solids.d/plane3pts
! 3dtopic: construct plane defined by three unique points

!A
!A NAME:
!A
!A 	Plane: Three Points
!A
!A DESCRIPTION:
!A
!A 	This script allows a plane to be defined by three unique points.
!A
!B INSTRUCTIONS:
!B
!B 	FIRST POINT ABS X,Y,Z: Enter the X,Y,Z coordinates
!B 		for the first point that will be used to determine
!B 		the plane.  NOTE: See XYZ INPUT OPTIONS.
!B
!B 	SECOND POINT ABS X,Y,Z: Enter the X,Y,Z coordinates
!B 		for the second point that will be used to determine
!B 		the plane.
!B
!B 	THIRD POINT ABS X,Y,Z: Enter the X,Y,Z coordinates
!B 		for the third point that will be used to determine
!B 		the plane.
!B
!C NOTES:
!C
!C 	The three points picked must be unique.
!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 defined by 3 points ")

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

ActivateUndo
Plane_loop:!

Stat=SetInputFormat("n4","")

P1=XyzInput("FIRST POINT",WsXyzInput)
IF ExitScript(Destination$) THEN Leave

P2=XyzInput("SECOND POINT",WsXyzInput)
IF ExitScript(Destination$) THEN Leave

P3=XyzInput("THIRD POINT",WsXyzInput)
IF ExitScript(Destination$) THEN Leave

Plane1=ThreePointPlane(P1,P2,P3)

Stat=DeleteEntity(P1)
Stat=DeleteEntity(P2)
Stat=DeleteEntity(P3)

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

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