
! script name: interrogate.d/endpoint
! topic: interrogate element and display end point coordinates

!A
!A NAME:
!A
!A 	End point
!A
!A DESCRIPTION:
!A
!A 	This script interrogates an element and will display the
!A 	coordinates of the end point in the END POINT info box for viewing.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ELEMENT: Pick the element to be interrogated for its end point.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: end point ")

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


File$= "tempdata"

I_loop:!
ActivateUndo
Element=PickEntity("PICK ELEMENT")
IF (ExitScript(Destination$)) THEN Leave
IF (NOT ValidGeometry(Element)) THEN I_loop

T= LastPickPara
IF T< 0.5 THEN 
	T=0
ELSE
	T= 1.0
END IF
Title$= "END POINT"
stat= OutputString(File$,CHR$(10),WsNewFile)

Ps= ParameterPt(Element,T)
X= XPointValue(Ps)
Y= YPointValue(Ps)
Z= ZPointValue(Ps)
stat= OutputString(File$,"END POINT:"&CHR$(10),WsAppend)
OUTPUT A$ USING "3(5A,6D.6D)"; "X = ",X,"Y = ",Y,"Z = ",Z
stat= OutputString(File$,A$&CHR$(10),WsAppend)
stat= DeleteEntity(Ps)

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

GOTO I_loop

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