
! script name: var_fillet.d/setfilletedge
! var_topic: set fillet edge conditions

!A
!A NAME:
!A
!A 	3D Settings: Set Fillet Edge Conditions. VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script changes the fillet behavior at the edge of a surface.
!A 	The fillet may be allowed to extend beyond the edge of a surface
!A 	by either rolling the edge or by a linear extension.
!A
!B INSTRUCTIONS:
!B
!B 	SURFACE #: Linear extend, Roll edge, None:
!B
!B 		Linear extend: Extends edge for fillet/intersect calculation.
!B 			Edge is extended Linearly the input distance.  LU
!B 			extends the u edge only.  LV extends the v edge only.
!B
!B 		Roll edge: Rolls normal vector on edge for fillet.  The normal
!B 			vector on the edge is rolled so that the contact point
!B 			of the fillet circle can follow the edge.  RU rolls the
!B 			u edge only.  RV rolls the v edge only.
!B
!B 	EDGE EXTENSION LENGTH: Enter the edge extension length.
!B
!C NOTES:
!C
!C 	Setting the edge condition is a feature of the fillet routine not
!C 	of the surfaces in question. If the condition is set on the
!C 	first surface picked then it will be set on the first surface no
!C 	matter which individual surface is picked.
!C
!C 	This feature is currently implemented in the standard and fast
!C 	fillet between two surfaces as well as in the intersection and
!C 	trimming between two surfaces.
!C
!C 	The extend of variable fillets are controlled by the drive curves.
!C 	With the extensions on the drive curves may extend past the natural
!C 	boundarys of the surfaces. Extensions on may also help the fillet
!C 	along the edges of the surfaces.
!C
!C 	The various flow and plane fillets are determined by the flow curves on
!C 	the surfaces. A Linear extension may help a fillet extend farther
!C 	along an edge. A Rolled edge does not help a flow fillet.
!C

Stat=ChangeLabelStr("ScriptNameStatus","Function: set fillet edge conditions ")

DIM Destination$[256]
DIM Answer$[256]

Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave

DeActivateUndo
Surface1:!
Length1= 0
Stat=SetInputFormat("a2=",",L,LU,LV,R,RU,RV,N,")
Stat=SetEqualsValue(0,"N")
Stat=GetValue("SURFACE #1: Linear extend, Roll edge, None",Answer$)
IF ExitScript(Destination$) THEN Leave
SELECT Answer$
CASE "N"
	Edge_type1=0
CASE "L"
	Edge_type1=1
	Uon1=1
	Von1=1
CASE "LU"
	Edge_type1=1
	Uon1=1
	Von1=0
CASE "LV"
	Edge_type1=1
	Uon1=0
	Von1=1
CASE "R"
	Uon1=1
	Von1=1
	Edge_type1=2
CASE "RU"
	Uon1=1
	Von1=0
	Edge_type1=2
CASE "RV"
	Uon1=0
	Von1=1
	Edge_type1=2
END SELECT

IF Edge_type1= 1 THEN
Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(Length1)
Length1=GetValue("EDGE EXTENSION LENGTH",Answer$)
IF ExitScript(Destination$) THEN Leave
END IF


Surface2:!
Length2= 0
Stat=SetInputFormat("a2=",",L,LU,LV,R,RU,RV,N,")
Stat=SetEqualsValue(0,"N")
Stat=GetValue("SURFACE #2: Linear extend, Roll edge, None",Answer$)
IF ExitScript(Destination$) THEN Leave
SELECT Answer$
CASE "N"
        Edge_type2=0
CASE "L"
        Edge_type2=1
        Uon2=1
        Von2=1
CASE "LU"
        Edge_type2=1
        Uon2=1
        Von2=0
CASE "LV"
        Edge_type2=1
        Uon2=0
        Von2=1
CASE "R"
        Uon2=1
        Von2=1
        Edge_type2=2
CASE "RU"
        Uon2=1
        Von2=0
        Edge_type2=2
CASE "RV"
        Uon2=0
        Von2=1
        Edge_type2=2
END SELECT

IF Edge_type2= 1 THEN
Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(Length1)
Length2=GetValue("EDGE EXTENSION LENGTH",Answer$)
IF ExitScript(Destination$) THEN Leave
END IF


RecordFunctionOn
Stat= RecordDescr("3D SETTING: Fillet Edge Type")
V1= FreeParameter("Edge_type1",Edge_type1)
V2= FreeParameter("Uon1",Uon1)
V3= FreeParameter("Von1",Von1)
V4= FreeParameter("Length1",Length1)
Stat= SetFilletEdgeType(1,V1,V2,V3,V4)
V5= FreeParameter("Edge_type2",Edge_type2)
V6= FreeParameter("Uon2",Uon2)
V7= FreeParameter("Von2",Von2)
V8= FreeParameter("Length2",Length2)
Stat= SetFilletEdgeType(2,V5,V6,V7,V8)
RecordFunctionOff
CloseVarRecord

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