
! script name: csplines.d/cspline
! topic: construct cubic spline through two points

!A
!A NAME:
!A
!A 	Cubic Spline Two Points
!A
!A DESCRIPTION:
!A
!A 	This script constructs a cubic spline through two points.  The tangent
!A 	conditions are determined by the angles selected.
!A
!B INSTRUCTIONS:
!B
!B 	STARTING ABS X,Y,Z: Enter the X,Y,Z coordinates of the start point
!B 		of the cubic spline. 
!B
!B 	ENDING ABS X,Y,Z: Enter the X,Y,Z coordinates of the end point of
!B 		the cubic spline.
!B
!B 	STARTING ANGLE: Enter the angle of the line through the starting point
!B 		that will determine the tangent condition.
!B
!B 	ENDING ANGLE: Enter the angle of the line through the ending point that
!B 		will determine the tangent condition.
!B
!# see also - points.d/xyzinput.hlp

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

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

Stat=SetInputFormat("n4a1=",",I,A,")

ActivateUndo
Spline_loop:!
Stat=SetPickReturn(WsGeometryEnd)
Ps=XyzInput("STARTING",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave

Stat=SetLastPoint(Ps)
Pe=XyzInput("ENDING",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave

Stat=SetPickReturn(WsLineAngle)
Angle1=GetValue("STARTING ANGLE",Answer$)
IF (ExitScript(Destination$)) THEN Leave

Stat=SetPickReturn(WsLineAngle)
Angle2=GetValue("ENDING ANGLE",Answer$)
IF (ExitScript(Destination$)) THEN Leave

S1=CSplineTwoPts(Ps,Angle1,1,Pe,Angle2,1)

Stat=SetLastPoint(Pe)
Stat=DeleteEntity(Ps)
Stat=DeleteEntity(Pe)
ActivateUndo
Stat= AdvanceUndoNumber("spline")
Stat= AddItemToUndo(WsUBCreateMode,S1)
GOTO Spline_loop

Leave:!

Stat=DeleteEntity(Ps)
Stat=DeleteEntity(Pe)
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
