Copyright (C) 1986-2008 by Daniel H. Hudgins, All Rights Reserved.
No part of "This Web Site" (HTML document), including associated files, may be: distributed, sublicensed, transmitted, copied, archived, mirrored, modified, bundled, embedded, sold, given away, rented, loaned, or shared in any form without express written permission in a formal Vendor agreement contract dated and signed in ink obtained directly from Daniel H. Hudgins by registered postal mail. All agreements for permission to distribute expire after a period no greater than one year from the date of the signing of the agreement by Daniel H. Hudgins. See the current "EULA" for information regarding limited copying and storage for the purpose of "Beta Testing" "This Web Site."
To view or use the current version of this Web page you may need to reload or refresh the display of this page by your browser. Just clicking on the browser's [Reload] or [Refresh] icon may not be enough to insure that all of the page's most current contents have been cached and displayed. Some browsers may have additional commands to help display the page's most current contents such as: holding down the [Shift] key and clicking on the [Reload] icon, holding down the [Control] key and clicking on the [Refresh] icon, holding down the [Control] and [Shift] keys and clicking on the [Refresh] icon, pressing the [Control] and [F5] keys, pressing [Control] and the [R] key, or some other combination of keys or clicks. Check to see which commands your HTML browser uses to load the most current page contents into its cache and then to display them onto the screen.
This Web site is dedicated to the thousands of "users" of my programs, those who have helped test my programs over the last 22 or so years, and especially those who shared their experiences with me.
You must read this notice: This is a licensed Web site (HTML document and associated files). You must read and agree to be legally bound in contract by the Terms of Use and conditions given in the End User License Agreement ("EULA"), Legal Notices, Instructions, Warnings, Disclaimers, and all other text in "SECTION: 0" of "This Web Site" (HTML document and associated files) before reading or using any of the information, software programs, and or files, contained in, linked to, and or associated with, "This Web Site" (HTML document and associated files). Any use or "Beta Testing" of "This Web Site" constitutes your acknowledgment of your full agreement with the current End User License Agreement ("EULA") and your decision to have this current license supersede all prior and contemporaneous agreements and understandings. Information and files in "This Web Site" (HTML document and associated files) have been placed here so that long time users of "The Author's" programs DANCAD3D.COM (tm) , DANCAM.EXE (tm) , or DANPLOT.EXE (tm) could help proofread the text of the documentation files or screens displayed, and also help test data files, example files, and or any software programs that might be made available from time to time, to aid "The Author" in finding mistakes, bugs, and other errors, omissions, defects, mistakes, and faults. Everything in "This Web Site" (HTML document and associated files) is "Beta Test", "Beta Code", Experimental, Preliminary, requires proofreading, or is being evaluated for possible revision, and is NOT warranted to be free of defect. To help "The Author" report any bugs, foul-ups, defects, or mistakes that you find, see "SECTION: 8" for instructions. "This Web Site" (HTML document and associated files) and all other files and programs by Daniel H. Hudgins are made available "AS IS" without warranty of any kind express, expressed, or implied. All offers and specifications are subject to change or discontinuation without notice of any kind. Please read "SECTION: 8" of "This Web Site" (HTML document and associated files) before trying to contact "The Author."
The text in this section was derived from the v2.5 CAD manual, and has been updated somewhat, but differences between different releases of v2.5, v2.6 and v2.7 may mean that some of the information may not apply to the version you are using. Some adjustment may be required for versions prior or subsequent to v2.7A.
You may not distribute, sell, rent, share, or give away these HTML documentation files or printed copies of them. You may not extract text from these HTML documentation files for distribution, sale, rent, sharing, or giving away. You can use the [Print] option in your browser to make one copy for yourself to mark up in order to help me proofread the text for mistakes.
Documents may be available to download from time to time, you can check SECTION: 9 to see what the current situation with regard to downloadable files is. The names of these documentation files may change, and they may be edited, combined, or eliminated in the future, without notice.
You may need to adjust your browser for best viewing of the pre- formatted text by changing the "font" size using the commands in your browser (see the help in your browser, or use the pull-down menus in your HTML browser.) If some letters in words on the screen appear to be missing or scrambled try changing the font size in your browser as this sometimes happens even though the words are spelled correctly in the HTML code.
Use the "Edit, Find in page Ctrl+F" or "Edit, Find (in this page)... Ctrl+F" command in your browser to search for keywords within the documentation text in this HTML page. You will need to search over again in the other pages in this HTML document for the same keyword since your browser may not search for a keyword beyond the current page that is loaded.
Within DANCAD3D (tm) macros you may write mathematical formulas using standard functions, constants, and variables. Where necessary you can use parentheses to state the order of evaluation. All formulas and equations must be within square brackets i.e. [ ], and spaces must be used as delimiters between all numbers, symbols, constants, and variables. The result of any evaluation is passed to a macro command as a parameter. Temporary results can be stored in a number variable held in the RAM scratch pad, or in a number variable file held on a disk drive, by using the macro LET command. String variables can be used like numeric variables and have some equivalent syntax, see below.
Steps relating to the use of Math and Strings:
Write the expression between square brackets, i.e. [ and ].
Use the | character in front of a numeric variable name to store it in RAM.
Use the $ character in front of a string variable name to read its contents.
Use file paths on variable names to save values on other disks.
Avoid impossible evaluations, e.g. n / 0.
The standard functions that you can use in equations that return a numeric value in a macro program file are:
ABS( n ) ......... Returns the absolute value of n. SQRT( n ) ........ Returns the square root of n. SQR( n ) ......... Returns the square of n. LN( n ) .......... Returns the natural logarithm of n. LOG( n ) ......... Returns the Log 10 of n. EXP( n ) ......... Returns the exponential of n. FACT( n ) ........ Returns the factorial of n, n=0 to 32. FRAC( n ) ........ Returns the fractional part of n. TRUNC( n ) ....... Returns the integer part of n. ROUND( n ) ....... Returns n rounded off. ODD( n ) ......... Returns 1 if n is odd, and 0 if n is not odd. EVEN( n ) ........ Returns 1 if n is even, and 0 if n is not even. SGN( n ) ......... Returns 1 if n is positive, -1 if negative, 0 if 0. RANDOM( n ) ...... Returns random number from 0 to n-1, n=1 to 32767. SIN( n ) ......... Returns the sine of n radians. COS( n ) ......... Returns the cosine of n radians. TAN( n ) ......... Returns the tangent of n radians. SEC( n ) ......... Returns the secant of n radians. CSC( n ) ......... Returns the cosecant of n radians. COT( n ) ......... Returns the cotangent of n radians. ARCSIN( n ) ...... Returns the inverse sine of n radians. ARCCOS( n ) ...... Returns the inverse cosine of n radians. ARCTAN( n ) ...... Returns the inverse tangent of n radians. ARCSEC( n ) ...... Returns the inverse secant of n radians. ARCCSC( n ) ...... Returns the inverse cosecant of n radians. ARCCOT( n ) ...... Returns the inverse cotangent of n radians. SINH( n ) ........ Returns hyperbolic sine of n radians. COSH( n ) ........ Returns hyperbolic cosine of n radians. TANH( n ) ........ Returns hyperbolic tangent of n radians. SECH( n ) ........ Returns hyperbolic secant of n radians. CSCH( n ) ........ Returns hyperbolic cosecant of n radians. COTH( n ) ........ Returns hyperbolic cotangent of n radians. ARCSINH( n ) ..... Returns inverse hyperbolic sine of n radians. ARCCOSH( n ) ..... Returns inverse hyperbolic cosine of n radians. ARCTANH( n ) ..... Returns inverse hyperbolic tangent of n radians. ARCSECH( n ) ..... Returns inverse hyperbolic secant of n radians. ARCCSCH( n ) ..... Returns inverse hyperbolic cosecant of n radians. ARCCOTH( n ) ..... Returns inverse hyperbolic cotangent of n radians. RAD( n ) ......... Converts degrees to radians. DEG( n ) ......... Converts radians to degrees.
Where n is a valid variable, constant, or expression. It is valid to nest the functions, e.g. COSIN( RAD( n ) ).
EXAMPLE: # |ALL ROTATE Z [ SIN( |XR ) + |XS ] [ COS( |YR ) + |YS ] 0
SIGNAL |HERTZ [ RANDOM( |SEED ) / 1000 ]
# |ELE ROTATE C [ LOG( |EL ) ] [ LOG( |EL ) ] [ LOG( |EL ) ]
LET |N = [ SIN( RAD( |V ) ) ]
Number variables can be stored in your computers RAM chips, in a RAM disk drive, i.e. RAMDISK, set up in your memory above the DOS 640KB, on your fixed hard disk drive, or on your floppy disk drive. You can locate a few number variables in a RAM scratch pad which can help speed up the running of your macro since the disk variables can take longer to access, especially on older slow computers. To save a number variable in the RAM scratch pad put the | character in front of the variable name without a space in between, e.g. |MYVAR. To save a variable on a disk drive use a filename for the variable name, e.g. C:\VARS\MY.VAR, or XMAG, and so on.
The port names like PRN and CON might be valid for some uses in place of the disk type variable names.
When a DOS filename is used for a variable name the value is stored in ASCII numeric format. Because disk variables are in ASCII format you can read or create variable files for DANCAD3D (tm) with the [W]rite command, or perhaps some other computer program. The disk stored variables are a small text file with the value on the first line of text in the upper left corner, and end with carriage return, line feed, and a control Z.
You should use the LET command to give an initial assignment to your number variables, so that the variable will exist for the other commands to find it. If a variable does not exist when a command is trying to read or write to the variable you may get an error message, and a fatal error that will stop your macro program from running past that point. It is good programming to put LET statements at the top of your main macro, or first sub-macro that assigns valid values to all the variables that will be used in your macro program.
EXAMPLE: LET |J = 1.065E-8 ; Stored in the "scratch pad."
LET J = 1.065E-8 ; Stored on your disk.
LET PRN = |J ; Print the value of |J on your printer.
The macro RELEASE command can be used to remove variables from the scratch pad or the disk drive, but never a port. When the RELEASE command is used on a filename it works about the same as the FILES ERASE command.
EXAMPLE: RELEASE |J ; Make room in scratch pad.
RELEASE J ; Make room on the harddisk.
DANCAD3D (tm) macro variables can be global and shared between the main macro and any sub-macros. Since variables can be global you can place a value in a variable by use of the LET command in a main macro before using the RUN command to run the sub-macro, and then the sub-macro can use the passed values by sharing variable names with the calling macro. Unless you erase variables from your harddisk with the RELEASE command the variables will remain on the harddisk for later use. Since variables can be left on your harddisk macros can be written to leave values in variables on your harddisk to be used by some other program, or macro. Disk variables will persist after your computer is re-booted or turned off, and so can be used for counters and other such needs.
If you want to write or use other programs to process information external to my CAD programs, you can end a macro with the HALT command in v2.7A and the CAD program will quit back to DOS automatically. You can put values into variable files on your disk, then run a DOS batch file that will run a macro file in one of my CAD programs, that macro will read the variable files, do something and save the result back to the disk, then HALT, the batch file will run another program that will read the result, and the batch file will run one of my or some other program to read the altered result file, and so on, all automatically run without using the keyboard. The result files could be of any type, e.g. tool path files, drawing files, animation frames, or more variable files in string or number type. Below is an example of the idea of using a DOS batch file in this way.
EXAMPLE: REM An example DOS batch file for v2.7A.
DANCAD87 ONE.MAC
BASIC PRG1.BAS
DANCAD87 TWO.MAC
PRG2.COM
DANCAD87 THREE.MAC
PRG3.EXE
REM And so on...
Below is an example of the use of the LET macro command to save a variable to disk so that the value will stay on the disk after the CAD program has HALT. Values can be kept on the disk so that a macro program will be able to continue using values saved the next time your computer is turned back on, and such.
EXAMPLE: LET C:\HOLDVARS\MYVAR.1 = [ |VA + |VB ]
LET C:\HOLDVARS\MYVAR.2 = [ C:\HOLDVARS\MYVAR.5 + |COUNTER ]
LET C:\HOLDVARS\MYVAR.3 = [ C:\HOLDVARS\MYVAR.6 + 1 ]
LET C:\HOLDVARS\MYVAR.4 = 0.093754
The standard operators that you can use in equations that return a numeric value in a macro program are:
[ a ^ b ] ........ Raise a to the b power. [ a * b ] ........ Multiply a times b. [ a / b ] ........ Divide a by b. [ a \ b ] ........ Round then find: a MODULUS b, -32767 to 32767 only. [ a & b ] ........ Round then find: a AND b, -32767 to 32767 only. [ a + b ] ........ Add a and b. [ a - b ] ........ Subtract b from a.
Where a and b are valid variables, constants or expressions. A variable could be |MYVAR or A:MYVAR. A constant could be 3.14159, 1.07E-15, or 64. An expression could be anything in parentheses e.g. ( c ^ ( d - e ) ).
You must use parentheses to establish the order of precedence in the evaluation of your equation. ALL equations MUST start and end with square brackets i.e. [ ]. ALL variables, constants, and operators MUST be SEPARATED by a SPACE! The length of the expression between the square braces should not be much longer than 100 characters since the substitution of the variables may make the expression longer than the 255 character maximum which can result in a fatal error causing your macro program to stop before it is finished.
EXAMPLE: SIGNAL [ |V1 + ( SQR( |V2 ) * 16.3 ) ] [ SQRT( |V3 ) ]
The SIGNAL command needs two parameters, the frequency and the duration. In the above example the frequency would evaluate as the square of |V2 times 16.3 with the resulting product plus the quantity of |V1. The duration would evaluate as the square root of the quantity of |V3.
All the above functions and operators are available for use almost anywhere a numeric parameter is called for by the commands listed in Appendix B. To make an assignment or to declare a variable as a constant use the macro LET command.
EXAMPLE: LET |VAR1 = |VAR2
LET |VAR1 = E:\DATA\SQOUT.397 ; Load a value from disk.
LET E:\DATA\SQOUT.397 = |VAR1 ; Save a value to disk.
LET |VAR1 = [ |VAR1 - 1 ]
LET |VAR1 = [ |ALPHA ^ |BETA ]
LET |VAR1 = [ SIN( RAD( |X1 ) ) ]
LET |VAR1 = [ ( COS( RAD( |X ) ) + |PI ) * ( SIN( |RY ) ) ]
LET |PI = 3.141592654
LET |ALL = 0
LET |FALSE = 0
LET |TRUE = 1
LET COUNTER = [ COUNTER + 1 ]
LET COM1 = VAR1 ; Use MODE to set up the serial port.
LET VAR1 = CON ; Input a value.
LET LPT2 = |VAR1 ; Print out a value.
The LET command can also assign the values of some of DANCAD3D (tm)'s internal values for the number of lines and elements to a variable, permitting you to do "stack arithmetic" and use the select element command to operate on "relative" element numbers. These "pointers" from the internal values give you a dynamic count equal to that at the bottom of the trace window for the current number of drawing lines and elements that your macro program might use to regulate operations and record data while your macro program runs. See the LET command description in Appendix B for information about the LET command.
EXAMPLE: LET |V1 -> LINES ; LINES is a reserved word.
LET |V2 -> ELEMENTS ; ELEMENTS is a reserved word.
LET |V3 -> COUNT FILENAME ; Count files in a set, use
; to find the number of frames.
LET |V4 -> LONG_COUNT FILENAME ; Count files in a set, use
; to find the number of frames
; when "long" numbered filenames
; have been used.
LET |V5 -> START_LINE 5 ; Find starting line number in
; element number 5.
LET |V6 -> LAST_LINE |V2 ; Find last line number in
; element number of value in |V2.
LET |V7 -> EXIST FILENAME ; 1=Exist, 0=File not found.
; the -> means "point to" an
; internal value from the CAD
; program's workings.
LOAD 3D CLAW.3D ; Load an element.
LET |CLAW -> ELEMENTS ; Assign its number to a variable.
LOAD 3D BASE.3D ; Load another element.
LET |BASE -> ELEMENTS ; Assign its number to a variable.
# |CLAW ROTATE C [ |C_X ] [ |C_Y ] [ |C_Z ] ; # varname.
# |BASE ROTATE C [ |B_X ] [ |B_Y ] [ |B_Z ] ; # varname.
The IF THEN GOTO command allows conditional branching. There are several relational operators just for this command:
[ a ] = [ b ], GOTO if a equal to b else do next command.
[ a ] > [ b ], GOTO if a greater than b else do next command.
[ a ] < [ b ], GOTO if a less than b else do next command.
[ a ] >= [ b ], GOTO if a greater than or equal to b else next command.
[ a ] <= [ b ], GOTO if a less than or equal to b else do next command.
[ a ] <> [ b ], GOTO if a not equal to b else do next command.
EXAMPLE: IF [ SQRT( |X ) ] <> [ SQRT( |Y ) ] THEN GOTO :L796
IF [ |VAR1 * 3 ] < 30 THEN GOTO :DO_AGAIN
IF |ANSWER = |TRUE THEN GOTO :REWARD
IF |VAR2 = 10 THEN GOTO :EXIT
Note that the brackets are not necessary if only a single variable or constant is being passed for a parameter. That is, the square brackets only need to be used when there is something to evaluate and that something is entirely within the square brackets.
If you need to test user input for several cases you can assign the user input to a temporary variable.
EXAMPLE: INPUT |TEMP
IF |TEMP = 1 THEN GOTO :RUN1
IF |TEMP = 2 THEN GOTO :RUN2
IF |TEMP = 3 THEN GOTO :RUN3
GOTO :END_CASE
:RUN1 RUN SUBMACRO.1 GOTO :END_CASE
:RUN2 RUN SUBMACRO.2 GOTO :END_CASE
:RUN3 RUN SUBMACRO.3 GOTO :END_CASE
:END_CASE
In the above example :RUN1, :RUN2, :RUN3, and :END_CASE are labels for points in the macro program, and are not program variables. A label is a point in the macro code you want to go to, by using the macro GOTO, IF THEN GOTO, or LOOP commands.
The NAME command allows math on the extension to the file's name of a file array. The NAME command can be used in place of a literal filename in most places where the parameter type is given as "f" for the commands in Appendix B. The numeric extension to the filename might let you work with arrays of drawing data files, or pixel files for animation. See also the NAME command description in Appendix B. File's names used with the macro NAME command cannot have an extension, since a number will be attached to the filename, i.e. C:\NAMES\MYNAME could become, C:\NAMES\MYNAME.1, C:\NAMES\MYNAME.2, C:\NAMES\MYNAME.3, and so on up to C:\NAMES\MYNAME.999, the extension value can range from - 99 to 999.
There is also a similar macro command LONG_NAME for working with longer file sets than what NAME can be used with. With LONG_NAME the "filename" part of the filename is used as a number, and the extension part is used as a three letter "filename" or extension, i.e. C:\LONGSET1\1.BMP, C:\LONGSET1\46792.BMP, C:\LONGSET1\99459993.BMP, and so on.
NEXT Adds one to the file extension or filename number
value in memory before passing the filename to the
selected file procedure.
HERE Pass the current value of the extension or filename
number value with the selected filename.
+ n Adds n to the selected filename's extension or
filename number value.
- n Subtracts n from the selected filename's extension
or filename number value.
= filename n Assigns the value of n to the selected file's
extension. This is the declaration of the path and
filename to use. You can have up to 8 filenames
assigned at each level of your macro, i.e. NAME 0
through NAME 7 (a new level is created when you use
the RUN command). With NAME the assigned extension
can range from -99 to 999. With LONG_NAME the
filename number range is -9999999 to 99999999.
INPUT Fetches filename and extracts the number value of
the extension or filename number value from the
filename input from the console (keyboard). This
option is used for macro programs that must request
that you enter a filename while your macro is
running.
EXAMPLE: NAME 1 = SUB\FILE 24 ; Sets name 1's .EXT to .24
NAME 1 NEXT ; Pass filename SUB\FILE.25
NAME 1 + 5 ; Set it to SUB\FILE.30
NAME 1 - 30 ; Set it to SUB\FILE.0
NAME 1 HERE ; Pass name with current extension.
NAME 1 INPUT ; Wait for user input.
LONG_NAME 2 = SUB\.PIX 24 ; Set name 2 to SUB\24.PIX
LONG_NAME 2 NEXT ; Pass filename SUB\25.PIX
LONG_NAME 2 + 5 ; Set it to SUB\30.PIX
LONG_NAME 2 - 30 ; Set it to SUB\0.PIX
LONG_NAME 2 HERE ; Pass name with current extension.
LONG_NAME 2 INPUT ; Wait for user input.
In cases where the use of the NAME or LONG_NAME command might be disallowed such as reading a variable from an array of numbered filenames, in an expression, the FILES COPY command can be used to copy one file from the file array named by the NAME command into a simple variable that will be readable in the expression. You might also want to read about the EXPAND macro command to interpolate and array of variables. In other words where a NAME file name cannot be used you can use the LET macro command to convert, by copying, a member of your array to a non-array variable. It might also be possible to use the FILES RENAME macro command for this type of type conversion, since the contents of the variable does not change, just the form of the file's name.
EXAMPLE: NAME 1 = X_ARRAY 0 ; Set up array name.
LET |HOWMANY -> COUNT NAME 1 HERE ; Find array size.
:A ; Label for loop.
FILES COPY NAME 1 NEXT TEMP ; Copy array member to variable.
LET TEMP = [ TEMP * 2 ] ; TEMP can be used in expression.
FILES COPY TEMP NAME 1 HERE ; Copy variable to array member.
LOOP :A [ |HOWMANY - 1 ] ; Do it to the whole array.
String variables are used to substitute for the parameters to the macro commands that are not numbers. The primary use of the string variables would be to allow you to input filenames, and pass lettering to the LETTERING command.
Macro commands to work with strings are: LET$, INPUT$, and OUTPUT$. LET$ creates and initializes a string variable so the variable can be used. INPUT$ lets the user enter a string from the keyboard. OUTPUT$ displays the contents of a string variable on the video screen (OUTPUT$ can be used as a replacement for the ECHO macro command.)
One subtlety of using the string variables needs extra emphasis. When you enter just the variable name (without a preceding $) you are passing the variable name to the command literally, you would only pass the literal variable name to the few commands that use the variable name to act on the variable. If the variable name is preceded by a $ symbol then the contents of the variable are passed to the macro command. It is possible to have a string variable contain the name of another string variable and so there may be instances where either form would be permissible, and so the program cannot tell if you want the name of the variable or the contents of the variable without you explicitly telling the program which one you mean by using the $ symbol.
String variables are saved as individual disk files, the variable name can be a full filename including a path. String variables can be saved to a RAM disk to speed up access, e.g. E:\VARNAME.1. Since string variables are filenames be careful that you do not use an important filename for a string variable name. You can have as many string variables as your disks will hold.
String constants are put between two quotation marks, e.g. "SOME". It is possible to combine string variables and string constants by using the square brackets, e.g. [ "A B" + $SV1 + $SV2 + " C D. " ]. If you do not want a string and one is called for by the macro command you can pass a null string with "". If a string constant needs to contain a quotation mark you can follow the quotation mark in the string with a percent symbol and the macro processor will ignore the quotation mark in the middle of the string, e.g. ""%WOW!"%" assigns "WOW!" to the string, where as "WOW!" would be WOW!.
EXAMPLE: LET$ STRVAR.123 = "This is a "%special"% case."
In order to bring up a file directory a pre-defined string "variable" name DIR is in the macro environment. By using $DIR "*.*" you can get a file directory to come up and when you select a filename the selected filename will be returned like the contents of a string variable. The string ("*.*") following the $DIR is a default file mask used to select the filenames displayed in the directory.
EXAMPLE: LET$ varname = $DIR "*.*"
The LET$ command must be used before a string variable is used to initialize the variable.
LET$ varname = varvalue LET$ varname = $DIR "mask" LET$ varname = $DIR $varname
The varname in the above example is always a filename. The varvalue can be either: a string constant ("S"), the contents of a string variable ($VARNAME), or a string statement between square brackets ([ "This " + "that." ]). The mask, used with the $DIR feature, is any file mask like one used with the DOS DIR command ("*.*", "*.MAC", "FONTS\*.FON", "?????SET.???"). When the string variable contains the name of a file or a file mask, the varname can be used as the default mask with the $DIR feature (remember to initialize the variable that holds the default path).
The INPUT$ command lets the user enter strings while a macro is running. To make menus you would use the LOCATE, ECHO, and OUTPUT$ commands along with the INPUT$ command.
INPUT$ varname default
The varname is a filename. The second parameter, default, is a default string you want displayed. The default can be a string constant ("SOMETHING"), or a variable, including the variable being assigned. The statement INPUT$ VARNAME.4 $VARNAME.4 is valid if the variable has been previously assigned with the macro LET$ command, and therefore is already on your harddisk. The user can edit the string line of text displayed with the usual cursor keys, [Backspace], [Ins], and [Del]. The string is passed and the macro proceeds when the [Return] key is pressed.
EXAMPLE: TEXT
LOCATE 1 2
ECHO Enter string: %%
INPUT$ VARNAME.4 ""
The OUTPUT$ command is normally used to display the contents of a string variable on the video screen.
OUTPUT$ $varname
The varname in the above example is a filename that was used for a string variable that has been assigned (filled) with some string before being passed to the OUTPUT$ command.
EXAMPLE: LOCATE 1 3
LET$ VARNAME.4 = [ "The string is: " + $VARNAME.4 ]
OUTPUT$ $VARNAME.4
If you want to have a string variable converted into a lettering element in the drawing workspace (to be included as part of a drawing) you can use the VAR$ operator as the text string parameter to the macro LETTERING command. The VAR$ operator replaces the text string when the macro LETTERING command is used. To use VAR$, you replace the text constant (on a macro code text line by itself) with VAR$, and place the name of the string variable, preceded by a dollar sign, i.e. $ (ASCII code number 36) on the macro code text line immediately below, the other parameters to the lettering command are placed on the macro code text line, or lines, below the name of the string variable. Putting the $ symbol in front of the string variable name tells the macro processor that you want the contents of the variable used for the text.
EXAMPLE: VERSION v2.7A
; BEGIN EXAMPLE MACRO CODE USING VAR$
INIT
LET$ FONTNAME = "FONTS\*.FON"
; You can skip the initialization of the
; variables after the macro is run once.
LET$ LINE1 = "R.A.R. 2479"
LET$ LINE2 = "EI150,1-27-94"
LET$ LINE3 = "TWIN PEAKS"
TEXT
LOCATE 1 2
OUTPUT$ "Enter text line #1: "
INPUT$ LINE1 $LINE1
LOCATE 1 3
OUTPUT$ "Enter text line #2: "
INPUT$ LINE2 $LINE2
LOCATE 1 4
OUTPUT$ "Enter text line #3: "
INPUT$ LINE3 $LINE3
LOCATE 1 6
OUTPUT$ "Enter font name...: "
INPUT$ FONTNAME $DIR $FONTNAME
LOCATE 1 8
OUTPUT$ ""
LETTERING
VAR$
$LINE1
0 -1.70 0 0 0 0 0.9 0.8
1 25 16 0 0 1 0.333333333 7
C J $FONTNAME
LETTERING
VAR$
$LINE2
0 0 0 0 0 0 0.9 0.8
1 25 16 0 0 1 0.333333333 7
C J $FONTNAME
LETTERING
VAR$
$LINE3
0 1.70 0 0 0 0 0.9 0.8
1 25 16 0 0 1 0.333333333 7
C J $FONTNAME
; END EXAMPLE MACRO CODE USING VAR$
The IF THEN GOTO command has a string version. To compare strings use the IF$ THEN GOTO command. Operators =, <, >, <=, >=, and, <> are allowed.
EXAMPLE: IF$ $STRVAR1 >= $STRVAR2 THEN GOTO :LABEL123
As with all other aspects of the macro language key words, operators, and parameters need to be separated by a space character.