
! script name: points.d/angleentity
! topic: create point on entity at angle

!A
!A NAME:
!A
!A 	Angle: Element
!A
!A DESCRIPTION:
!A
!A 	This script creates a point on an entity at a specified angle.
!A
!A~ image location - images/angleentity.jpg
!B INSTRUCTIONS:
!B
!B 	INPUT ANGLE: Enter the angle of the point.  The angle is
!B 		referenced from the base point.
!B
!B 	PICK INTERSECTING ELEMENT: Pick the element that the point
!B 		should be created on at the specified angle.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: angle: element ")

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)

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
