×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Displaying system variables

Displaying system variables

Displaying system variables

(OP)
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?

RE: Displaying system variables

Display where?  In the drawing or on the command line?

RE: Displaying system variables

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.

RE: Displaying system variables

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

RE: Displaying system variables

(OP)
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.?

RE: Displaying system variables

on the command line !userr1 will show it.

RE: Displaying system variables

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.

RE: Displaying system variables

(OP)
Thanks Carl, that's exactly what I was looking for.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources