
! script name: draft.d/explodechar
! topic: place character at specified point

!A
!A NAME:
!A
!A 	Explode Char
!A
!A DESCRIPTION:
!A
!A 	This script allows a character to be placed at a specified point.
!A 	This character may be converted to geometry (lines and arcs) by
!A 	selecting the point mode "INPUT XY" and touching the cursor to a
!A 	point on the character.  The character to be placed is referenced
!A 	by the decimal number associated with the ASCII character.  For
!A 	example, the following characters are associated with the number:
!A
!A 		0 -  48        A -  65        a -  97
!A 		1 -  49        B -  66        b -  98
!A 		2 -  50        C -  67        c -  99
!A 		  .              .              .
!A 		  .              .              .
!A 		  .              .              .
!A 		9 -  57        Z -  90        z - 122
!A
!A 	For further information see an ASCII table of characters and
!A 	corresponding numbers.
!A
!B INSTRUCTIONS:
!B
!B 	INPUT ABS X,Y,Z: Enter the X,Y,Z coordinates of the position to be
!B 		used for placing the character.  NOTE: See XYZ INPUT OPTIONS.
!B
!B 	INPUT CHAR NUM: Enter the number associated with the character to be
!B 		placed, as described above.
!B
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: explode char ")

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

DeActivateUndo
Text_loop:!

Stat=SetInputFormat("n4=","")
Pc=XyzInput("INPUT",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave


Stat=SetInputFormat("n0","")
Number=GetValue("INPUT CHAR NUM",Answer$)
IF (ExitScript(Destination$)) THEN Leave

T1=TextLine(Pc,CHR$(Number))
Grp1= ExplodeText(T1)

Stat=DeleteEntity(Pc)
Stat=DeleteEntity(T1)
Stat=DeleteEntity(Grp1)

GOTO Text_loop

Leave:!
Stat=SetInputFormat("n4","")
Stat=DeleteEntity(Pc)
Stat=DeleteEntity(T1)
Stat=DeleteEntity(Grp1)
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
