
! script name: lines.d/linetanangle
! topic: construct line tangent to element at angle

!A
!A NAME:
!A
!A 	Known Angle: Tangent
!A
!A DESCRIPTION:
!A
!A 	This script constructs a line tangent to an element at a specified
!A 	angle.
!A
!A~ image location - images/linetanang.gif
!A
!B INSTRUCTIONS:
!B
!B 	PICK TANGENT ELEMENT: Pick the entity that will be tangent
!B 		to the line constructed.
!B
!B 	ANGLE OF TANGENT LINE: Enter the angle of the tangent line
!B 		that will be constructed.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: known angle: tangent ")

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

DEG

ActivateUndo
Ploop:!
stat= SetInputFormat("n4","")
E1=PickEntity("PICK TANGENT ELEMENT ")
IF (ExitScript(Destination$)) THEN Leave
Pt=LastPickPoint

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

Ln1=SelectTanAngle(E1,Angle,Pt,WsUNTRIMMED)

Stat=DeleteEntity(Pt)
ActivateUndo
Stat= AdvanceUndoNumber("line")
Stat= AddItemToUndo(WsUBCreateMode,Ln1)
GOTO Ploop

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