GrText
Function Syntax | (LM:GrText <str>) |
Current Version | 1.1 |
Download | GrTextV1-1.lsp |
View HTML Version | GrTextV1-1.html |
Demo Programs | |
---|---|
Download Demo Program | GrTextDemo.lsp |
View HTML Version | GrTextDemo.html |
Download Demo Program | GrDialogDemo.lsp |
View HTML Version | GrDialogDemo.html |
Arguments | ||
---|---|---|
Symbol | Type | Description |
str | String | String to be expressed in Vector List format |
Returns | ||
Type | Description | |
List | GrVecs Pixel Vector List relative to the Origin |
Program Description
This function will return a vector list encoding a supplied text string, expressed in pixels relative to the origin, suitable for use with the AutoLISP grvecs function. If utilised within a grread loop (as demonstrated by the demo programs below), this enables the display of vectorised text on-screen (and beside the cursor) in real-time.
The grvecs list returned by this function may also be manipulated to display text in a standard DCL dialog, as demonstrated by the GrDialog Demo program, available for download above.
The LM:GrText function is also independent of Visual LISP and will hence work in all versions of AutoCAD.
Demonstration Programs
The following examples demonstrate the various uses of GrText, from displaying simple text entered by the user, to coordinate and area read-outs, progressing to other more complex implementations. A selection of the demonstration programs shown here may be downloaded from the link at the top of this page.
Please ensure the GrText.lsp function is loaded before running the following demo programs.
Demo Program 1
This simple example program prompts the user to type a message and will display the entered text in real-time beside the cursor as the text is entered.
Demo Program 2
This program will dynamically display the coordinates of the cursor position beside the cursor as it is moved across the screen. The coordinates are expressed in WCS using the active settings of the LUNITS & LUPREC system variables. This example program also demonstrates the speed of the LM:GrText in generating the vector list for a given string.
Demo Program 3
This program prompts the user for a base point and displays the area of the rectangular region enclosed by the base point and cursor in real-time as the cursor is moved across the screen.
GrDialog Demo Program
This example program is also available for download from the link at the top of the page and demonstrates how the LM:GrText function may be utilised to display text in a standard DCL dialog.
Further Examples
These additional examples are not included in the set of downloadable demonstration programs but show additional applications for the LM:GrText function.
The following animation shows the function used in a program to display the area and perimeter of a selected region in real-time:
Another example demonstrating the use of the function in a dynamic array program: