
! script name: lines.d/twopoints
! topic: construct line through two points

!A
!A NAME:
!A
!A 	Two XY(Z) Points
!A
!A DESCRIPTION:
!A
!A 	This script constructs a line through two points. The coordinates
!A 	of the points are input in this script.
!A
!B INSTRUCTIONS:
!B
!B 	STARTING ABS X,Y,Z: Enter the X,Y,Z coordinates of the start point
!B 		of the line.  NOTE: See XYZ INPUT OPTIONS.
!B
!B 	ENDING ABS X,Y,Z: Enter the X,Y,Z coordinates of the end point of
!B 		the line.
!B
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: two xy(z) points ")

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


ActivateUndo
stat= SetInputFormat("n4","")
Line_loop:Ps=XyzInput("STARTING",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Ps) THEN Line_loop

Stat=SetLastPoint(Ps)
Pe=XyzInput("ENDING",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Pe) THEN Line_loop

L1=LineTwoPoints(Ps,Pe,WsTRIMMED)

Stat=SetLastPoint(Pe)
Stat=DeleteEntity(Ps)
Stat=DeleteEntity(Pe)

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

Leave:!

Stat=DeleteEntity(Ps)
Stat=DeleteEntity(Pe)
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
