
! script name: csplines.d/csplinegroup
! topic: construct cubic spline through an existing group of points

!A
!A NAME:
!A
!A 	Cubic Spline through group
!A
!A DESCRIPTION:
!A
!A 	This script constructs a cubic spline through a group of points.
!A 	A cubic spline maintains tangency between the points and approximate
!A 	continuity of the curvature.
!A
!A~ image location - images/csplinecurve.jpg
!B INSTRUCTIONS:
!B
!B	PICK GROUP OF POINTS: Pick the group of points to pass the
!B	cubic spline through.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: cubic spline group")

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

ActivateUndo
Group_loop:!


Group= PickGroupEnt("PICK GROUP OF POINTS")
IF (ExitScript(Destination$)) THEN Leave

Group1=PtsInGroup(Group,WsPickPoints)

Pt_count= GroupCount(group1)
Pstart= GroupElement(Group1,1)
Pend= GroupElement(Group1,Pt_count)


Spline_ent=CSCurvePtGrp(Group1,Pstart,0,Pend,0)
Stat=DeleteEntity(Group1)

ActivateUndo
Stat= AdvanceUndoNumber("spline curve")
Stat= AddItemToUndo(WsUBCreateMode,Spline_ent)
GOTO Group_loop

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

