home - about - advertise     
 
 
Sponsors
Navigation
Partners

 
AutoCAD Tutorial

AutoCAD 2004 Customization Tutorial: Dynamic Text on Status Bar

June 27, 2003

DIESEL expressions can be used to add dynamic text to the status bar. For example you can add the editing time of the drawing file or the current text height. Such information is updated every now and then. DIESEL is very easy to learn and consists of a few functions.

Note: DIESEL stands for Direct Interpretively Evaluated String Expression Language. For more information on DIESEL refer to AutoCAD help, or read my article, "Status Bar Enhancement," in the November/December 2002 Augiworld.

To learn how to add text to the status bar, please read the following article:

AutoCAD 2004 Customization Tutorial: Adding Text to Status Bar

1. Start AutoCAD.

2. Assign a proper DIESEL expression to MODEMACRO. Such expression should add the current default text height to status bar:

Command: modemacro8

Enter new value for MODEMACRO, or . for none <"">: $(getvar, textsize) 8

Notes:

  • $(getvar, systemvar) is a DIESEL expression that extracts the contents of a system variable. It returns a string (text) that reflects the extracted contents.
  • TEXTSIZE is a system variable that shows the default text size.

3. The forgoing expression adds a number to the status bar. To make it more meaningful you could add some text as follows:

Command: modemacro 8

Enter new value for MODEMACRO, or . for none <"$(getvar, textsize)">: Text
height: $(getvar, textsize)
8

4. Change the text height to see the effect on status bar [Figure 1]. To change the text height type TEXTSIZE in command line and assign a new value to the system variable (for instance 4.6).

Figure 1

5. Since MODEMACRO is not saved you can define the MODEMACRO contents through a simple AutoLISP program and add it to S:STARTUP in acad2004.lsp or acad2004doc.lsp.

6. Start Notepad.

7. Open acad2004.lsp. The file is located in Support folder of AutoCAD.

8. Add the proper text [Figure 2].


Figure 2 - Click on image to enlarge

Notes:

  • For more information about S::STARTUP refer to "Adding Text to Status Bar".
  • The text string is too long. Therefore I have split the string into str1 and str2. Later the strcat function is used to assemble the strings into one.
  • The TDINDWG system variable shows the editing time of the current drawing.
  • $(edtime, time, picture): Returns a formatted date and time based on a given picture. The picture should be entered based on the following table. The examples are for Thursday, November 07, 2002, 10:50:17.506 AM:

Format

Output

Format

Output

D

7

H

10

DD

07

HH

10

DDD

Thu

MM

50

DDDD

Thursday

SS

17

M

11

MSEC

506

MO

11

AM/PM

AM

MON

Nov

am/pm

am

MONTH

November

A/P

A

YY

02

a/p

a

YYYY

2002

 

 

9. Save the file.

10. Restart AutoCAD. The new changes are reflected on the status bar [Figure 3].

Figure 3
 

About the Author

Alireza Parsai is the founder of cadpanel.com. He is a mechanical engineer with more than 12 years experience with AutoCAD. Alireza is an Autodesk Authorized Author, the AutoCAD consultant for Al Khawarizmi Institute, a contributing editor for Augiworld magazine, a writer for CAD Digest, an instructor for AUGI Training Program, and an elected speaker for Autodesk University 2002. He has written 7 books in Farsi, 3 booklets in English, and more than 30 articles for different magazines and newsletters. You can reach him at alireza.parsai@cadpanel.com or visit his website www.cadpanel.com

More CAD Corner tutorials >>

 

Newsletter

Get all the week's articles
FREE!
(current issue)