
! script name: 3dtrim.d/uvtrimcurve
! 3dtopic: place UV curve on surface

!A
!A NAME:
!A
!A 	To UV Curve
!A
!A DESCRIPTION:
!A
!A 	This script will take an ordinary curve within a 10x10 inch or
!A 	100x100 mm square and use it as a UV curve and place it on a
!A 	surface as a trim curve.  An application of this would be to
!A 	use the Explode UV Trim Curves and modify the exploded UV curve
!A 	and then put the modified UV curve on the surface.
!A
!B INSTRUCTIONS:
!B
!B 	PICK SURFACE: Pick the surface for the UV curve to be placed on.
!B
!B 	PICK CONTOUR: Pick the UV contour to be placed on the specified surface.
!B
!B 	Inside or Outside: Pick the side of the surface	the UV curve is to be
!B 		placed on.
!B

Stat=ChangeLabelStr("ScriptNameStatus","Function: make uv trim curve ")

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

ActivateUndo
Tol=NamedVarVal("3D Trimming Tol",Ws3DSystemVars,0.005)
Start:!
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(WsPickNoSurf)

Pick_loop:Stat=SetInputFormat("a1",",P,")
Curve=PickGroupEnt("PICK CONTOUR ",0)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Curve) THEN Pick_loop

Stat=Highlight(Curve,WsPickPen,WsDirArrowOff)
Stat=SetPickMask(WsPickGeometry)

Stat=SetInputFormat("a1=",",I,O,")
Stat=SetEqualsValue(0,"I")
Stat=GetValue("Inside or Outside",Answer$)
IF ExitScript(Destination$) THEN Leave
Inout= WsInside*(Answer$="I") + WsOutside*(Answer$= "O")

ActivateUndo
Stat= AdvanceUndoNumber("uv trim curve")
Stat= AddItemToUndo(WsUBModifyMode,Surface)

Stat=MakeUVTrimCurve(Curve,Surface,Tol,Inout)


GOTO Intersect2

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