
! script name: lines.d/ptangle
! topic: construct line through point at angle

!A
!A NAME:
!A
!A 	Point Angle
!A
!A DESCRIPTION:
!A
!A 	This script will construct a line through a point, at a
!A 	specified angle.
!A
!A~ image location - images/ptangle.jpg
!B INSTRUCTIONS:
!B
!B 	INPUT ABS X,Y,Z: Enter the X,Y,Z coordinates of the point, through
!B 		which the line will be constructed at the specified angle.
!B 		NOTE: See XYZ INPUT OPTIONS.
!B
!B 	ANGLE: Enter the angle of the line that will be constructed through
!B 		the defined point.
!B
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: point angle ")

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

DEG

ActivateUndo
Line_loop:Stat=SetInputFormat("n4","")
Pc=XyzInput("INPUT",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Pc) THEN Line_loop

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

L1=PointAngle(Pc,Angle)

Stat=SetEqualsValue(Angle)
Stat=SetLastPoint(Pc)
Stat=DeleteEntity(Pc)

ActivateUndo
Stat= AdvanceUndoNumber("line")
Stat= AddItemToUndo(WsUBCreateMode,L1)

GOTO Line_loop

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