
! script name: points.d/xhypo
! topic: create point at known X coordinate and distance from last point

!A
!A
!A NAME:
!A 	Hypotenuse and X Value
!A
!A DESCRIPTION:
!A
!A 	This script creates a point at a known X coordinate and a specified
!A 	distance from the base point.
!A 	NOTE: If the specified distance does not intersect the
!A 	      X coordinate, no point is created.
!A
!A~ image location - images/xhypo.jpg
!B INSTRUCTIONS:
!B
!B 	INPUT ABS X: Enter the X coordinate of the point.
!B
!B 	INPUT HYPOTENUSE: Enter the distance (hypotenuse) the point is to
!B 		be created at from the base point.
!B
!B 	INPUT ABS Z: Enter the Z coordinate of the point.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: x: hypotenuse ")

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


DEG
ActivateUndo
Base_point:Stat=SetInputFormat("n4","")
Stat= SetAbsIncrInput(WsAbsolute)
Stat=SetXyzInput(WsXyzInput)
Base_point=XyzInput("BASE POINT",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave
Stat=SetLastPoint(Base_point,WsXyzInput)
Stat=SetXyzInput(WsXyzInput)
Stat=SetXyzInput(WsAngleEntity)
Stat= DeleteEntity(Base_point,WsFalse)


Stat=SetXyzInput(WsXandHypo)
Ploop:Pt=XyzInput("INPUT",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave

Stat=SetLastPoint(Pt,WsXyzInput)
ActivateUndo
Stat= AdvanceUndoNumber("point")
Stat= AddItemToUndo(WsUBCreateMode,Pt)
GOTO Base_point

Leave:!
IF Destination$= "BACKUP" THEN Base_point
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
