Variables stored in drawing file

Discussion in 'AutoCAD' started by Michael Bulatovich, Jun 26, 2004.

  1. I thought I heard someone here discussing how acad has the ability to store
    (6?) variables in the drawing file that survive the drawing session.

    Anyone recall that/know about how it's done?
     
    Michael Bulatovich, Jun 26, 2004
    #1
  2. Michael Bulatovich

    bestafor Guest

    HiHO;
    Look at USER**, they are real, integer, and string.
     
    bestafor, Jun 26, 2004
    #2
  3. Thanks. That's what I was looking for.

    Has anyone ever used these things?
    Are there any pitfalls in using them for storage of data between sessions?
    Will any native functions try to overwrite them should you assign a value to
    them?
    What the hell are they for?

    I started thinking that they might be of use to the guy in a another thread
    who
    wanted a prompt to pop up after an issued drawing is revised so that the
    operator will remember to fill out the revision block.
     
    Michael Bulatovich, Jun 27, 2004
    #3
  4. Michael Bulatovich

    Paul Turvill Guest

    They're provided, as the name implies, for the USER to store up to five
    integers, five reals and five strings for whatever purpose the USER may
    wish. USERI1-5 and USERR1-5 are saved in the .dwg file, so they may be
    carried over from session to session. USERS1-5 are *not* saved, which makes
    them of little use to most folks.

    The problem with these variables is that they may be also used
    indiscriminately by anyone who writes customization for AutoCAD, which means
    the USER runs the risk of losing his settings if he runs LISP, VBA, or ARX
    routines written by someone else. Good code intended for distribution to
    others should *never* use these values for that reason.

    Of course, users who use code by others also tend to avoid them because they
    may get changed by badly written third-party code ... so without some fairly
    strict controls, USERI1-5, USERR1-5 and USERS1-5 are really of limited
    practical use.

    For storing really "permanent" data in a .dwg file, custom dictinaries are
    much more practical, although they require a bit more code to create and
    access.
    ____
     
    Paul Turvill, Jun 27, 2004
    #4
  5. Thanks Paul, you've confirmed most of my immediate fears about these guys.
    One thing
    still strikes me as curious: With the ability to assign any variable at the
    command line, why did Adesk think someone *needed*
    USERS1-5? In the case of the numeric ones, the value persistence is
    obviously of some use to
    "remember" something from one session to another.

    Has anyone ever come across code that re-assigns these variables?
    I've just done a quick text search and not one lisp in my 'collection'
    contains
    any reference to these variables.
     
    Michael Bulatovich, Jun 27, 2004
    #5
  6. Michael Bulatovich

    Paul Turvill Guest

    In the early days (1980's) I did run across a couple of quasi-commercial
    packages that used USERRx and USERIx to keep track of things. I've been
    known to use them myself (but not recently) to keep track of things like
    whether or not a drawing was intended to be plotted in a particular format,
    or in the pre-paper space days of things like plotting scales. Today, like
    most folks, I ignore them completely, and I haven't seen any decent
    third-party stuff in years that attempts to use them.

    And, no, I have never understood why USERSx with their limitations were ever
    introduced. Were the USERxx variables available in LT (they are NOT,
    however) I could see where they might provide a poor-man's substitute for
    LISP variables and/or Dictionaries.
    ___
     
    Paul Turvill, Jun 27, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.