
! script name: types.d/type11
! topic: type 11

!A
!A NAME:
!A
!A 	Type 11
!A
!A~ image location - images/type11.gif
!A
!A DESCRIPTION:
!A
!A 	Type 11 is a modified Type 1.  A chamfer is created connecting the
!A 	line to the next element.  It is assumed that the next element starts
!A 	with a zero 	radius.  The CHAMFER LENGTH is measured parallel to
!A 	the line.  Type 11 may not be used to end a contour description of
!A 	an open contour.
!A
!# see also - htdocs/help.d/typeno.htm

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

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=SetInputFormat("n4","")
Length=GetValue("CHAMFER LENGTH",Answer$)
IF (ExitScript(Destination$)) THEN Leave

IF (ABS(R1)>0) THEN
	Tp=Type3(31,Ps,Pe,R1,Length)
ELSE
	Tp=Type10(11,Ps,Pe,Length)
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
