
! script name: 3dintersect.d/flowcurve
! 3dtopic: generates a curve along a surface flow curve

!A
!A NAME:
!A
!A 	Flow Curve
!A
!A DESCRIPTION:
!A
!A 	This script generates a curve along a flow curve on a surface.  A flow
!A 	curve is a curve of either constant U or constant V parameter on the
!A 	surface.
!A
!B INSTRUCTIONS:
!B
!B 	PICK SURFACE: Pick the surface to be used for generating the flow curve.
!B
!B 	Ucurve or Vcurve:
!B 		U - Select Ucurve to generate a curve of constant U parameters.
!B 		V - Select Vcurve to generate a curve of constant V parameters.
!B
!B 	PARAMETER VALUE (0 - 1): Enter the constant parameter that determines
!B 		the U or V curve.
!B

Stat=ChangeLabelStr("ScriptNameStatus","Function: flow curve ")

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

ActivateUndo
Tol=NamedVarVal("3D Cutting Tol",Ws3DSystemVars,0.005)

Start:!
StdWorkplane
Stat=Setup3dCutter(WsNullTool,0.0,0.0,0.0,0.0,0.0)

Intersect2: StdWorkplane
Stat=SetPickMask(WsPickSurfOnly)
Stat=SetInputFormat("n0","")
Surface=PickEntity("PICK SURFACE",Answer$)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Surface) THEN Intersect2

Stat=SetPickMask(WsPickGeometry)
Stat=SetInputFormat("a1=",",U,V,")
Stat=SetEqualsValue(0,"U")
Which_edge=GetValue("  Ucurve or Vcurve ",Answer$)
IF ExitScript(Destination$) THEN Leave
Which_edge=5*(Answer$="U")+6*(Answer$="V")

Stat=SetEqualsValue(0.0)
Stat=SetInputFormat("n4","")
Para_value=GetValue("PARAMETER VALUE (0 - 1) ",Answer$)
IF ExitScript(Destination$) THEN Leave

Direction=WsForward
Path=EdgeCurve(surface,Which_edge,tol,Direction,Para_value)

ActivateUndo
Stat= AdvanceUndoNumber("flow curve")
Stat= AddGroupToUndo(WsUBCreateMode,Path,1,WsTrue)
GOTO Intersect2

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