
! script name: surfaces.d/foursideblend
! 3dtopic: Sample - create points from four sided blend

!A
!A NAME:
!A
!A 	Points From Four Side Blend
!A
!A DESCRIPTION:
!A
!A 	This script will construct the points for four sided blend surface.
!A 	There must be four sides which intersect in 3D space.  The four sided
!A 	surface formed may be thought of as a rubber rectangle in 2D space
!A 	that has been stretched, pushed and pulled.
!A
!B INSTRUCTIONS:
!B
!B 	PICK U CONTOUR #1: Pick one of the sides to be used to determine the
!B 		U curves.
!B
!B 	PICK U CONTOUR #2: Pick the other side to be used to determine the
!B 		U curves.  The U contour #1 and the U contour #2 may NOT be
!B 		adjacent sides.
!B
!B 	PICK V CONTOUR #1: Pick one of the sides to be used to determine the
!B 		V curves.  The U and V contours may NOT be the same.
!B
!B 	PICK V CONTOUR #2: Pick the other side to be used to determine the
!B 		V curves.  The V contour #1 and the V contour #2 may NOT be
!B 		adjacent sides.
!B
!B 	U PATCH WIDTH: Enter the patch width to be used for the U curves.
!B
!B 	V PATCH WIDTH: Enter the patch width to be used for the V curves.
!B
!C NOTE:
!C
!C 	This is an unsupported sample script.
!C

stat=ChangeLabelStr("ScriptNameStatus","Function: points from four side blend ")

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

ActivateUndo
Patch_width=NamedVarVal("3D Default Patch",Ws3DSystemVars,0.5)

Upatch= Patch_width
Vpatch= Patch_width

Pick_loop: !

Stat= SetPickMask(WsPickNoSurf)

UContour1=PickGroupEnt("PICK U CONTOUR #1",0)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(UContour1) THEN Pick_loop
Stat=Highlight(UContour1,WsPickPen,WsDirArrowOff)

UContour2=PickGroupEnt("PICK U CONTOUR #2",0)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(UContour1) THEN Pick_loop
Stat=Highlight(UContour2,WsPickPen,WsDirArrowOff)

VContour1=PickGroupEnt("PICK V CONTOUR #1",0)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(VContour1) THEN Pick_loop
Stat=Highlight(VContour1,WsPickPen,WsDirArrowOff)

VContour2=PickGroupEnt("PICK V CONTOUR #2",0)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(VContour1) THEN Pick_loop
Stat=Highlight(VContour2,WsPickPen,WsDirArrowOff)

stat= SetInputFormat("n4=","")
stat= SetEqualsValue(Upatch)
Upatch= GetValue("U PATCH WIDTH",Answer$)
IF (ExitScript(Destination$)) THEN Leave

stat= SetInputFormat("n4=","")
stat= SetEqualsValue(Vpatch)
Vpatch= GetValue("V PATCH WIDTH",Answer$)
IF (ExitScript(Destination$)) THEN Leave

Group= FourCurveBlend(UContour1,UContour2,VContour1,Vcontour2,Upatch,Vpatch)

ActivateUndo
Stat= AdvanceUndoNumber("blend points")
Stat= AddGroupToUndo(WsUBCreateMode,Group,1,WsTrue)

GOTO Pick_loop

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