
! script name: lines.d/ptangleline
! topic: construct line through point at angle to a line

!A
!A NAME:
!A
!A 	Point: Angle: Line
!A
!A DESCRIPTION:
!A
!A 	This script constructs a line through a point at a specified angle
!A 	to another line.  The other line has already been defined.
!A
!A~ image location - images/ptangleline.gif
!A
!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 		to another line.  NOTE: See XYZ INPUT OPTIONS.
!B
!B 	ANGLE OF LINE: Enter the angle of the line to be constructed.
!B
!B 	PICK LINE: Pick the line to be used as the reference for the
!B 		specified angle.
!B
!# see also - points.d/xyzinput.hlp

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

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

DEG
ActivateUndo
Line_loop:!
stat= SetInputFormat("n4","")
Pt=XyzInput("INPUT",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Pt) THEN Line_loop

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

L1=PickSpecificEnt("PICK LINE",WsPickLines)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(L1) THEN Line_loop

Ln1=PtAngleLine(Pt,Angle,L1,WsUNTRIMMED)

Stat=DeleteEntity(Pt)

ActivateUndo
Stat= AdvanceUndoNumber("line")
Stat= AddItemToUndo(WsUBCreateMode,Ln1)
GOTO Line_loop

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