
! script name: 3dintersect.d/dosurfsinter
! 3dtopic: do two surfaces intersect

!A
!A NAME:
!A
!A 	Do Two surfaces intersect.
!A
!A DESCRIPTION:
!A
!A 	This script will test if two surfaces intersect.
!A
!B INSTRUCTIONS:
!B
!B 	PICK SURFACE #1: Pick one of the two surfaces to be used for the
!B 		intersection. 
!B
!B 	PICK SURFACE #2: Pick the other surface to be used for the 
!B		intersection.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: Do surfaces intersect ")

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


Tol=NamedVarVal("3D Intersect Tol",Ws3DSystemVars,0.005)


Start:!
StdWorkplane

stat= Setup3dCutter(WsNullTool,0.0,0.0,0.0,0.0,0.0)
Intersect2:StdWorkplane

Pick_loop:!

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


Pick_surf2:!
Stat= SetPickMask(WsPickSurfOnly)
Surface2=PickEntity("PICK SURFACE #2",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Surface2) THEN Pick_surf2

Stat= SetPickMask(WsPickGeometry)

Normal_sign1= 1
Normal_sign2= 1

Does_it= DoSurfsIntersect(Surface1,Normal_sign1,Surface2,Normal_sign2,Tol)

IF Does_it THEN

PRINT "Surfaces Do Intersect "

ELSE 

PRINT "Surfaces Do Not Intersect "

END IF


GOTO Intersect2


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