
! script name: conics.d/varpitchspiral
! topic: construct spline curve through variable pitch spiral

!A
!A NAME:
!A
!A 	Variable Pitch Spiral
!A
!A DESCRIPTION:
!A
!A 	This script constructs a spline curve through a variable pitch spiral.
!A
!B INSTRUCTIONS:
!B
!B 	STARTING RADIUS OF SPIRAL: Enter the starting radius of the spiral
!B 		to be constructed.
!B
!B 	ENDING RADIUS OF SPIRAL: Enter the ending radius of the spiral to
!B 		be constructed.
!B
!B      STARTING PITCH: Enter the starting radius of the spiral
!B              to be constructed.
!B
!B      ENDING PITCH: Enter the ending radius of the spiral to
!B              be constructed.
!B
!B 	CENTER POINT ABS X,Y,Z: Enter the X,Y,Z coordinates of the center
!B 		point of the spiral.  NOTE: See XYZ INPUT OPTIONS.
!B
!B 	STARTING ANGLE: Enter the starting angle of the spiral.
!B
!B 	ANGULAR STEP: Enter the angular step between points on spiral.
!B
!B 	Z START: Enter the Z coordinate of the start point of the spiral.
!B
!B 	Z END: Enter the Z coordinate of the end point of the spiral.
!B
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: variable pitch spiral ")

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

ActivateUndo
Start:!
Stat=SetInputFormat("n4","")

Start_rad=InputRadius("STARTING RADIUS OF SPIRAL")
IF (ExitScript(Destination$)) THEN Leave

End_rad=InputRadius("ENDING RADIUS OF SPIRAL")
IF (ExitScript(Destination$)) THEN Leave

Start_pitch=GetValue("START PITCH",Answer$)
IF (ExitScript(Destination$)) THEN Leave

End_pitch=GetValue("END PITCH",Answer$)
IF (ExitScript(Destination$)) THEN Leave

Center=XyzInput("CENTER POINT",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave

Astart=InputAngle("STARTING ANGLE")
IF (ExitScript(Destination$)) THEN Leave

Stat=SetInputFormat("n4=","")
Stat= SetEqualsValue(10)
Astep=GetValue("ANGULAR STEP")
IF (ExitScript(Destination$)) THEN Leave

Stat=SetInputFormat("n4=","")
Stat= SetEqualsValue(Zstart)
Zstart=GetValue("Z START",Answer$)
IF (ExitScript(Destination$)) THEN Leave

Stat=SetInputFormat("n4=","")
Stat= SetEqualsValue(Zend)
Zend=GetValue("Z END",Answer$)
IF (ExitScript(Destination$)) THEN Leave

Stat=SetInputFormat("a3=",",1,2,")
Stat= SetEqualsValue(0,"1")
Stat=GetValue("DIRECTION:  ( 1 )CW, ( 2 )CCW ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$= "1" THEN
	Direction= WsCW
ELSE
	Direction= WsCCW
END IF


E1= VariablePitchCurve(Center,Start_rad,End_rad,Start_pitch,End_pitch,Zstart,Zend,Astart,Astep,Direction)

Stat=DeleteEntity(Center)

ActivateUndo
Stat= AdvanceUndoNumber("variable pitch spiral")
Stat= AddItemToUndo(WsUBCreateMode,E1)

GOTO Start


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

