
! script name: types.d/type10
! topic: type 10

!A
!A NAME:
!A
!A 	Type 10
!A
!A~ image location - images/type10.gif
!A
!A DESCRIPTION:
!A
!A 	Type 10 is a modified Type 1. A circle is created tangent to the line
!A 	and the next element.  It is assumed that the next element starts with
!A 	a zero radius.  Type 10 may not be used to end a contour description
!A 	of an open contour.
!A
!# see also - htdocs/help.d/typeno.htm

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

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

DeActivateUndo
Last=FindLastType
Stat=SetInputFormat("n4a1=",",I,A,")
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)

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

Stat=SetEqualsValue(R1)
R2=InputRadius("ROUNDING RADIUS",WsRadiusInput,WsSigned)
IF (ExitScript(Destination$)) THEN Leave

IF (ABS(R1)>0) THEN
	Tp=Type3(30,Ps,Pe,R1,R2)
ELSE
	Tp=Type10(10,Ps,Pe,R2)
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
