
! script name: types.d/type13
! topic: type 13

!A
!A NAME:
!A
!A 	Type 13
!A
!A~ image location - images/type_13.gif
!A
!A DESCRIPTION:
!A
!A 	Type 13 is a variation of Type 1.  The end point of the line is
!A 	described with Y and an angle instead of X and Y coordinates.
!A 	The angle is referenced to the start point of the line.
!A
!# see also - htdocs/help.d/typeno.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: type 13 ")

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

DeActivateUndo
Last=FindLastType
Stat=SetInputFormat("n4a1=","")
IF NOT ValidGeometry(Last) THEN
	Ps=XyzInput("STARTING",WsXyOnly)
	IF (ExitScript(Destination$)) THEN Leave
	First=1
	R1=0
ELSE
	Ps=TypeEndPoint(Last,WsEnd)
	R1=TypeEndRadius(Last,WsEnd)
	First=0
END IF

Stat=SetLastPoint(Ps,WsXyOnly)

Stat=SetXyzInput(WsYandAngle)
Pe=XyzInput("ENDING",WsXyOnly)
IF (ExitScript(Destination$)) THEN Leave

IF (ABS(R1)>0) THEN
	Tp=Type3(3,Ps,Pe,R1,0)
ELSE
	Tp=Type1(1,Ps,Pe)
END IF

IF (NOT ValidGeometry(Tp)) THEN Leave

IF NOT First THEN
	Stat=JoinTypes(Last,Tp)
END IF

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