
! script name: lines.d/linetwotan
! topic: construct line tangent to two entities

!A
!A NAME:
!A
!A 	Two Tangents
!A
!A DESCRIPTION:
!A
!A 	This script constructs a line tangent to two entities.
!A
!A~ image location - images/linetwotan.gif
!A
!B INSTRUCTIONS:
!B
!B 	PICK FIRST TANGENT ELEMENT: Pick one of the two entities
!B 		that will be tangent to the line constructed.
!B
!B 	PICK NEXT TANGENT ELEMENT: Pick the other entity that will
!B 		be tangent to the line constructed.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: two tangents ")

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

DEG
Graphical_mode=NamedVarVal("Graphical mode",WsSystemVars,1.0)
IF Graphical_mode THEN LOAD "lines.d/dynlinetwotan"

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

E2=PickEntity("PICK NEXT TANGENT ELEMENT")
IF (ExitScript(Destination$)) THEN Leave
P2=LastPickPoint

C1=SelectTwoTan(E1,P1,E2,P2,WsTRIMMED)

Stat=DeleteEntity(P1)
Stat=DeleteEntity(P2)
ActivateUndo
Stat= AdvanceUndoNumber("line")
Stat= AddItemToUndo(WsUBCreateMode,C1)
GOTO Ploop

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