
! script name: 3dintersect.d/int3planes
! 3dtopic: intersection point of three planes

!A
!A NAME:
!A
!A 	Intersect: 3 Planes
!A
!A DESCRIPTION:
!A
!A	This script will find the intersection point between three Planes. 
!A
!B INSTRUCTIONS:
!B
!B 	PICK PLANE #1: Pick one of the three planes to be used for determining
!B 		the intersection point.
!B
!B 	PICK PLANE #2: Pick the second planes to be used for determining the
!B 		intersection point.
!B
!B 	PICK PLANE #3: Pick the third plane to be used for determining the
!B 		intersection point.
!B

Stat=ChangeLabelStr("ScriptNameStatus","Function: intersect 3 planes ")

DIM Destination$[256]
DIM Answer$[256]
DIM Surface_dir$[80]

ActivateUndo
Start:!

Stat=SetPickMask(WsPickSurfOnly)
Stat=SetInputFormat("n0","")
Plane1=PickEntity("PICK PLANE #1",Answer$)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Plane1) THEN Pick_loop

Plane2=PickEntity("PICK PLANE #2",Answer$)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Plane2) THEN Pick_loop

Plane3=PickEntity("PICK PLANE #3",Answer$)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Plane3) THEN Pick_loop

Stat=SetPickMask(WsPickGeometry)

Point1=Intersect3Planes(Plane1,Plane2,Plane3)

ActivateUndo
Stat= AdvanceUndoNumber("point")
Stat= AddItemToUndo(WsUBCreateMode,Point1)

GOTO Start

Leave:!
Stat=SetPickMask(WsPickGeometry)
IF NOT LEN(Destination$) THEN
	LOAD "typecontrol"
ELSE
	LOAD Destination$
END IF
END
