Results 1 to 8 of 8

Thread: Setting System Variables best Practice

  1. #1
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Setting System Variables best Practice

    I've got a ton of system variables that I configure on the start of AutoCAD (in Acad.lsp for the registry variables and acaddoc.lsp for the drawing variables). I've got it set that way to make sure that variables are set the way we would like them. the more stuff we have running at startup, I know that it slows down opening up a file. What is the best way to do this. there is the new Systemvariablemonitor that I could just dump them in to flag the user if those variables change.
    Currently I run a check on the variable value and only change it if it is not what we want it to be. Should I just change it and not worry about checking? would it speed it up at all?

    Just looking for some advice on how others do it.

    Thanks,

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Setting System Variables best Practice

    I doubt that setting a few (couple of dozen?) system variables at startup adds a noticeable amount of time.

    You could time it. We have a timer on our startup to keep an eye on things.
    R.K. McSwain | CAD Panacea |

  3. #3
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: Setting System Variables best Practice

    Is it better just to set it and call it good, or leave the check? I agree I doubt it is a noticeable amount of time, but the more streamline the startup routines are, the easier it will be to modify for future releases or to troubleshoot when something goes wrong.

  4. #4
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Setting System Variables best Practice

    Sorry, I missed that part. I never check anything, I just set as needed.
    R.K. McSwain | CAD Panacea |

  5. #5
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Setting System Variables best Practice

    Quote Originally Posted by ccowgill View Post
    I've got a ton of system variables that I configure on the start of AutoCAD (in Acad.lsp for the registry variables and acaddoc.lsp for the drawing variables). I've got it set that way to make sure that variables are set the way we would like them. the more stuff we have running at startup, I know that it slows down opening up a file. What is the best way to do this. there is the new Systemvariablemonitor that I could just dump them in to flag the user if those variables change.
    Currently I run a check on the variable value and only change it if it is not what we want it to be. Should I just change it and not worry about checking? would it speed it up at all?

    Just looking for some advice on how others do it.

    Thanks,
    I do it exactly the same as you are doing although modifications are displayed at the command line when necessary. The Systemvariablemonitor could be helpful if you find a rouge piece of code is changing a certain system variable. A lot of those are modified in lisp, but reset on exit. I believe this will flag the Systemvariablemonitor while to me it should be no harm, no foul.

  6. #6
    AUGI Addict
    Join Date
    2015-12
    Posts
    2,095
    Login to Give a bone
    0

    Default Re: Setting System Variables best Practice

    For start-up I don't check the existing values. I *do* wrap the set-function with a (vl-catch-all-apply ...) in case a bad name or value slips by. I sometimes check the existing value during in-drawing operations but only where knowing change is necessary is helpful e.g. requires connecting to an external file.

  7. #7
    Member Jim_Fisher's Avatar
    Join Date
    2015-12
    Location
    Texas
    Posts
    31
    Login to Give a bone
    0

    Default Re: Setting System Variables best Practice

    Like most of the responses, I don't check the current values at startup, I just set them to what I want them to be ... but I wrap the whole process between calls to (acad-push-dbmod) and (acad-pop-dbmod) so AutoCAD doesn't think the drawing has changed.
    ~ Hamburgers! The cornerstone of any nutritious breakfast. ~

    ~ Mind if I try one of yours? This is yours here, right? ~

    ~ Mmm-mmmm. That is a tasty burger. ~

  8. #8
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Setting System Variables best Practice

    I've never broken out the sysvar calls to do registry-stored in Acad.lsp before; my luck, one would get changed mid-session. Haha

    No checking at startup here, I also use foreach + vl-catch-all-apply + setvar/setenv (watch the setenv string casing! *tips hat* @ RK ), as well as pop the DB.

    Quote Originally Posted by BlackBox View Post
    Code:
    (vl-load-com)
    ;;;--------------------------------------------------------------------;
    (acad-push-dbmod)
    ;;;--------------------------------------------------------------------;
    
    ;;; <snip>
    
        ;; Set environment variables
        (foreach x (list '("MaxHatch" "1000000")
                         ;;<- More here
                   )
          (vl-catch-all-apply 'setenv x)
        )
    
        ;; Set system variables
        (foreach x (list '(acadlspasdoc 0)
                         '(attreq 1)
                         '(aunits 0)
                         '(clayer "0")
                         '(cmdecho 1)
                         '(constraintinfer 0)
                         '(fieldeval 31)
                         '(filedia 1)
                         '(filletrad 0.0)
                         '(frame 2)
                         '(geomarkervisibility 0)
                         '(highlight 1)
                         '(hplayer ".")
                         '(indexctl 3)
                         '(insunits 0)
                         '(layerevalctl 0)
                         '(laylockfadectl 60)
                         '(layoutregenctl 1)
                         '(logfilemode 0)
                         '(ltscale 1)
                         '(luprec 4)
                         '(mbuttonpan 1)
                         '(mirrtext 0)
                         '(msltscale 1)
                         '(mtextcolumn 0)
                         '(nomutt 0)
                         '(osmode 255)
                         '(osnapz 1)
                         '(pdmode 0)
                         '(pdsize 2)
                         '(pickadd 1)
                         '(pickfirst 1)
                         '(plinegen 1)
                         '(propertypreview 0)
                         '(psltscale 1)
                         '(qaflags 0)
                         '(rasterdesignautotransparency 0)
                         '(ribboncontextselect 1)
                         '(regenmode 1)
                         '(savetime 15)
                         '(taskbar 0)
                         '(transparencydisplay 1)
    ;;;                     '(ucsicon 1)                                       ; viewport specific!? grrr
                         '(xdwgfadectl 60)
                         '(xrefoverride 0)
                   )
          (vl-catch-all-apply 'setvar x)
        )
    
    ;;; <snip>
    
    ;;;--------------------------------------------------------------------;
    (prompt "\n... AcadDoc.lsp for Civil 3D 2017 loaded. ")
    (princ)
    ;;;--------------------------------------------------------------------;
    (acad-pop-dbmod)

    Also, if using 2018, don't forget to include XREFREGAPPCTL == 0; thankfully Autodesk made 0 the default, but still.


    As it is loosely related, this old thread has more on the Startup Sequence:

    https://www.theswamp.org/index.php?t...3213#msg443213


    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Similar Threads

  1. Setting system variables inside templates
    By rbilger in forum AutoCAD Customization
    Replies: 1
    Last Post: 2009-07-09, 06:40 PM
  2. Permanently setting system variables (MIRRTEXT, etc.)
    By GJEllis in forum AutoCAD General
    Replies: 6
    Last Post: 2008-03-10, 05:52 PM
  3. Setting up system variables!
    By pferreira in forum AutoCAD Tips & Tricks
    Replies: 0
    Last Post: 2006-06-30, 10:11 PM
  4. Setting up mapdigisetup variables in vba?
    By norrin in forum AutoCAD Map 3D - General
    Replies: 4
    Last Post: 2005-11-02, 03:05 PM
  5. Save reminder - system setting or project setting?
    By patricks in forum Revit Architecture - General
    Replies: 4
    Last Post: 2005-07-08, 01:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •