Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying system variables

Status
Not open for further replies.

Nate242

Mechanical
Feb 14, 2005
25
I've figured out how to calculate the info I want by the use of a lisp file, but I can't get the info I want onto the drawing. I was planning on using a field to display a user variable (have the code written and all), but none of the user variables are available for display, and when I enter the code manually, I just get ####.

Is there any way to display the user variables (userr1, userr2, etc..) in a field like you would another system variable? Or is there another easy way to display the variables from a lisp file? Can I use a diesel function to display the variables?
 
Replies continue below

Recommended for you

Display where? In the drawing or on the command line?
 
To display the userr1 variable as plain text you could use something similar to this:

(defun c:sv2txt ()
(setq txt (rtos (getvar "userr1")))
(setq pt1 (getpoint "Pick start point for text: "))
(command "text" pt1 "" "" txt "" "")
)

Note that the last line might need some massaging due to your current text style settings.
This won't autoupdate like a field would though. I don't know how to get a user variable into a field.
 
Can you give us a peek at your code? We are glad to help and give shortcuts when we know what's going on.

"Everybody is ignorant, only on different subjects." — Will Rogers
 
I'd put my code up, but it's just some really simple addition to the base variable that the user would enter. After thinking it over last night, I realized that it would really be best to forego the lispfile, and just not have the dims auto update fo r this application.

My original question still stands however, because I'm sure I'll want to apply this to another dwg. How do you display a sytem variable such as userr1 in autocad (preferably w/o a lispfile); and how do you display a variable from a lispfile in a dimension, textbox, attribute, etc.?
 
on the command line !userr1 will show it.
 
You can display the results by using RTEXT (remote text, Express Tools). The diesel expression would be $(getvar, "userr1")

You can show the value of a lisp variable on the command line by using a leading exclamation point as IFR showed, but that doesn't work for a system variable.
 
Thanks Carl, that's exactly what I was looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor