
! script name: lines.d/bisector
! topic: construct angular bisector of two intersecting lines

!A
!A NAME:
!A
!A 	Bisector (angular)
!A
!A DESCRIPTION:
!A
!A 	This script constructs the line which is the angular bisector of
!A 	two intersecting lines.  No line will be constructed if the same
!A 	line is picked or if two parallel lines are picked.
!A
!A~ image location - images/bisector.jpg
!B INSTRUCTIONS:
!B
!B 	PICK FIRST LINE: Pick one of the two intersecting lines.
!B
!B 	PICK NEXT LINE: Pick the other line.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: bisector (angular) ")

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


DEG
stat= SetInputFormat("n4","")

ActivateUndo
Line_loop:!
ON ERROR GOTO Error_check
L1=PickSpecificEnt("PICK FIRST LINE",WsPickLines)
IF (ExitScript(Destination$)) THEN Leave
P1=LastPickPoint

L2=PickSpecificEnt("PICK NEXT LINE",WsPickLines)
IF (ExitScript(Destination$)) THEN Leave
P2=LastPickPoint

Sign1=PtLeftRight(L1,P2)
Sign2=PtLeftRight(L2,P1)

C1=BisectorLine(L1,Sign1,L2,Sign2,WsUNTRIMMED)

Error_check: OFF ERROR
Stat=DeleteEntity(P1)
Stat=DeleteEntity(P2)

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

Leave:!
Stat=SetXyzInput(WsXyzInput)
Stat=DeleteEntity(P1)
Stat=DeleteEntity(P2)
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
