
! script name: 3dintersect.d/fastintparts
! 3dtopic: generate a group of paths of intersection of two parts

!A
!A NAME:
!A
!A 	Intersect: Parts (fast)
!A
!A DESCRIPTION:
!A
!A 	This script will generate a group of paths of intersection of two
!A 	parts ( surface groups ) in 3d space.  There is a path generated for
!B 	each pair of intersecting surfaces.
!A
!B INSTRUCTIONS:
!B
!B 	PICK SURFACE GROUP #1: Pick one of the surface groups to be used for
!B 		the intersection.
!B
!B 	PICK SURFACE GROUP #2: Pick the other surface group to be used for the
!B 		intersection.
!B

Stat=ChangeLabelStr("ScriptNameStatus","Function: fast intersect parts ")

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

ActivateUndo
Normal_len=NamedVarVal("3D Normal Length",Ws3DSystemVars,1.0)
Tol=NamedVarVal("3D Intersect Tol",Ws3DSystemVars,0.005)

Start:!
Normal_color=3
Direction_color=4

Stat=Setup3dCutter(WsNullTool,0.0,0.0,0.0,0.0,0.0)
Intersect2: StdWorkplane
Pick_loop:!

Stat=SetPickMask(WsPickSurfOnly)
Stat=SetInputFormat("n4","")
Part_group1=PickGroupEnt("PICK SURFACE GROUP #1 ",WsSurfaceGroup)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Part_group1) THEN Pick_loop

Stat=Highlight(Part_group1,WsPickPen,WsDirArrowOff)

Stat=SetPickMask(WsPickSurfOnly)
Stat=SetInputFormat("n4","")
Part_group2=PickGroupEnt("PICK SURFACE GROUP #2 ",WsSurfaceGroup)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Part_group2) THEN Pick_loop

Stat=Highlight(Part_group2,WsPickPen,WsDirArrowOff)

Stat=SetPickMask(WsPickGeometry)

s1=1
s2=1
path_group= FastIntParts(Part_group1,S1,Part_group2,S2,Tol)

ActivateUndo
Stat= AdvanceUndoNumber("intersect curve")
Stat= AddGroupToUndo(WsUBCreateMode,Path_group,1,WsTrue)

GOTO Intersect2

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