
! script name: 3dintersect.d/intplanes
! 3dtopic: intersection line between two planes

!A
!A NAME:
!A
!A 	Intersect: 2 Planes
!A
!A DESCRIPTION:
!A
!A	This script will find the intersection line between two planes. 
!A
!B INSTRUCTIONS:
!B
!B 	PICK PLANE #1: Pick one of the planes to be used for the intersection.
!B
!B 	PICK PLANE #2: Pick the other plane to be used for the intersection.
!B

Stat=ChangeLabelStr("ScriptNameStatus","Function: intersect 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

Stat=SetPickMask(WsPickGeometry)

Line1=IntersectPlanes(Plane1,Plane2)

ActivateUndo
Stat= AdvanceUndoNumber("line")
Stat= AddItemToUndo(WsUBCreateMode,Line1)

GOTO Start

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