
! script name: interrogate.d/angletwolines
! topic: angle between two lines

!A
!A NAME:
!A
!A 	Angle between two lines
!A
!A DESCRIPTION:
!A
!A 	This script measures the angle between two lines.
!A
!B INSTRUCTIONS:
!B
!B 	PICK LINE #1: Pick the first line to be used as a reference for
!B 		the angle between two lines.
!B
!B 	PICK LINE #2: Pick the second line to be used as the reference
!B 		for the angle between two lines.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: angle two lines ")

DIM Destination$[256]
DIM Answer$[256]
DIM A$[256]
DIM File$[256]

DEG

File$= "tempdata"
Stat= RemoveFile(File$)

Current_pen= CurrentColor
Stat= SetCurrentColor(2)


I_loop:!
ActivateUndo

E1=PickSpecificEnt("PICK LINE #1",WsPickLines)
IF (ExitScript(Destination$)) THEN Leave
IF (NOT ValidGeometry(E1)) THEN I_loop

E2=PickSpecificEnt("PICK LINE #2",WsPickLines)
IF (ExitScript(Destination$)) THEN Leave
IF (NOT ValidGeometry(E2)) THEN I_loop

Angle= AngleTwoLines(E1,E2)
Supp_angle= 180- ABS(Angle)


Title$= "ANGLE TWO LINES"
stat= OutputString(File$,CHR$(10),WsNewFile)

OUTPUT A$ USING "(22A,8D.6D)"; "Angle = ",Angle
stat= OutputString(File$,A$&CHR$(10),WsAppend)
OUTPUT A$ USING "(22A,8D.6D)"; "Supplementary Angle = ",Supp_angle
stat= OutputString(File$,A$&CHR$(10),WsAppend)

stat= OutputString(File$,CHR$(10),WsAppend)
Stat=MessageFileBox(File$,Title$)


PlotOff
Stat= DeleteEntity(Pinter)
Stat= DeleteEntity(Pt)
Stat= DeleteEntity(L1)
PlotOn

GOTO I_loop

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