
! script name: types.d/type30
! topic: type 30

!A
!A NAME:
!A
!A 	Type 30
!A
!A~ image location - images/type30.gif
!A
!A DESCRIPTION:
!A
!A 	Type 30 is a modified Type 3.  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 30 may not be used to end an open contour.
!A
!# see also - htdocs/help.d/typeno.htm

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

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

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

IF First THEN
	Stat=SetEqualsValue(0)
	R1=InputRadius("R1",WsRadiusInput,WsSigned)
	IF (ExitScript(Destination$)) THEN Leave
END IF

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

Tp=Type3(30,Ps,Pe,R1,R2)
IF (NOT ValidGeometry(Tp)) THEN Leave

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

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