
! script name: 3dfillet.d/fastfltparts
! 3dtopic: generate fillet surface between two parts

!A
!A NAME:
!A
!A 	Fillet: Parts	(fast)
!A
!A DESCRIPTION:
!A
!A 	This script will generate a fillet surface between each pair of
!A 	intersecting surfaces in two parts.
!A
!B INSTRUCTIONS:
!B
!B 	FILLET RADIUS: Enter the radius of the fillet to be constructed.
!B
!B 	PATCH WIDTH: Enter the width of the patch to be used.
!B
!B 	PICK SURFACE GROUP #1: Pick one of the surface groups to be used for
!B 		the fillet.
!B
!B 	PICK SURFACE GROUP #2: Pick the other surface group to be used for
!B 		the fillet.
!B

Stat=ChangeLabelStr("ScriptNameStatus","Function: fillet parts ")

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

ActivateUndo
Patch_width=NamedVarVal("3D Default Patch",Ws3DSystemVars,0.25)
Tol=NamedVarVal("3D Fillet Tol",Ws3DSystemVars,0.005)

Start:!
StdWorkplane

Ask_fillet: Stat=SetInputFormat("n4=","")
Radius=InputRadius("FILLET RADIUS")
IF ExitScript(Destination$) THEN Leave
IF Radius<=0 THEN Ask_fillet

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(Patch_width)
Patch_width=GetValue("PATCH WIDTH",Answer$)
IF ExitScript(Destination$) THEN Leave

Intersect2: StdWorkplane
Pick_part1:!
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_part1

Stat=Highlight(Part_group1,WsPickPen,WsDirArrowOff)

Pick_part2:!
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_part2

Stat=Highlight(Part_group2,WsPickPen,WsDirArrowOff)

Stat=SetPickMask(WsPickGeometry)

s1=1
s2=1
Fillet_group=FastFilletParts(Radius,Part_group1,S1,Part_group2,S2,Patch_width,Tol)

ActivateUndo
Stat= AdvanceUndoNumber("fillet surface")
Stat= AddGroupToUndo(WsUBCreateMode,Fillet_group,0,WsFalse)
Stat=DeleteEntity(fillet_group)

GOTO Intersect2

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