
! script name: surfaces.d/lblendcurves
! 3dtopic: Sample - construct curve which is a linear blend of two curves

!A
!A NAME:
!A
!A 	Linear Blend Curve
!A
!A DESCRIPTION:
!A
!A 	This script will construct a curve which is a linear blend of two
!A 	curves.
!A
!B INSTRUCTIONS:
!B
!B 	PICK CONTOUR #1:
!B
!B 	PICK CONTOUR #2:
!B
!B 	NUMBER POINTS:
!B
!B 	BLEND PARAMETER:
!B
!C NOTE:
!C
!C 	This is an unsupported sample script.
!C

stat=ChangeLabelStr("ScriptNameStatus","Function: linear blend curve ")

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


ActivateUndo
Num_pts= 50
Blend_para= 0.5

Pick_loop: !

Stat= SetPickMask(WsPickNoSurf)
stat= SetInputFormat("a1",",P,")
Contour1=PickGroupEnt("PICK CONTOUR #1",0,Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Contour1) THEN Pick_loop
Stat=Highlight(Contour1,WsPickPen,WsDirArrowOff)

Stat= SetPickMask(WsPickNoSurf)
stat= SetInputFormat("a1",",P,")
Contour2=PickGroupEnt("PICK CONTOUR #2",0,Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Contour1) THEN Pick_loop
Stat=Highlight(Contour1,WsPickPen,WsDirArrowOff)


stat= SetInputFormat("n0=","")
stat= SetEqualsValue(Num_pts)
Num_pts= GetValue("NUMBER POINTS",Answer$)
IF (ExitScript(Destination$)) THEN Leave


stat= SetInputFormat("n4=","")
stat= SetEqualsValue(Blend_para)
Blend_para= GetValue("BLEND PARAMETER",Answer$)
IF (ExitScript(Destination$)) THEN Leave


Blend_ents: !
Group= LinearBlendCurves(Contour1,Contour2,Blend_para,Num_pts)

Pt=PointXYZ(0,0,0)

Sp=CSplinePtGrp(Group,Pt,0,Pt,0,3)

ActivateUndo
Stat= AdvanceUndoNumber("blend curve")
Stat= AddGroupToUndo(WsUBCreateMode,Sp,1,WsTrue)

stat= DeleteGroup(Group)
stat= DeleteEntity(Pt)

GOTO Pick_loop

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