GrText (grread)
Program DescriptionThis 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 ProgramsThe 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 1This 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 2This 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 3This 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.
Further ExamplesThese 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:
GrDialog Demo ProgramThis 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.
GOOD Program! very good!:D 學習學習{:soso_e130:} grread和grvecs学习好贴 ALISP居然可以做到这样,实在是太牛了。 不错的效果,还是第一次见过 nice!{:soso_e179:} 必须学习,一个很好的作品 非常好的程序,不知道是不是源码。 这是LEE MAC的程序搬过来的。 好好学习,这个函数感觉很难学啊 66666666666 全是英文的?看不太明白哦。感谢分享。
页:
[1]