TheSwamp

CAD Forums => CAD General => Topic started by: dubb on September 28, 2022, 12:48:52 PM

Title: AutoCAD start up changing system variable
Post by: dubb on September 28, 2022, 12:48:52 PM
The variable for OSNAPZ is always reverting back to 0 every time I start a new AutoCAD session. I tried to catch the variable changes by manually loading acaddoc.lsp start up file but it does not affect the OSNAPZ variable. I also looked into the shortcut target.
Code: [Select]
"C:\Program Files\Autodesk\AutoCAD 2021\acad.exe"  /product MAP /language "en-US" I don't recognize any profile loading that would affect the variable. What else can cause the system variable to change every time I start  new session?
Title: Re: AutoCAD start up changing system variable
Post by: ribarm on September 28, 2022, 12:56:03 PM
Why don't you hardcode desired value in acaddoc.lsp like this :

Quote
(if (getvar (quote osnapz))
  (setvar (quote osnapz) 1)
)

or

Quote
(if (getvar (quote osnapz))
  (setvar (quote osnapz) 0)
)
Title: Re: AutoCAD start up changing system variable
Post by: dubb on September 28, 2022, 02:55:36 PM
I considered this. It's just weird how it changes outside of the custom lisp routines.
Why don't you hardcode desired value in acaddoc.lsp like this :

Quote
(if (getvar (quote osnapz))
  (setvar (quote osnapz) 1)
)

or

Quote
(if (getvar (quote osnapz))
  (setvar (quote osnapz) 0)
)
Title: Re: AutoCAD start up changing system variable
Post by: ribarm on September 28, 2022, 03:58:55 PM
Either reinitialize acaddoc.lsp after custom routine finish, or just put those lines at the very end of problematic ones you are working with...
I use acaddoc.lsp like single defined (_autoload_) function : (defun _autoload_ ( / ... ) ... ) and at the end I just call it once with (_autoload_)... Whenever I need partial autoload, I have dialog box and press Cancel so only my custom testing routines stored in appload.dfs placed in (getvar (quote roamablerootprefix)) are initialized, else if I press OK, I load all working environment ones that are placed in my support folder - all essential ones : drafting, ploting, designing 2D/3D,...
System variables such as OSNAPZ are hardcoded in acaddoc.lsp independently of function that is used for autoload of other routines, so that's connected with my preferred working habbit and custom CAD optimization for fast and effective workflow... So, IMHO, there is no need to worry about things how CAD work after custom executions, as you can either call reinit with (_autoload_) at command prompt, or just hardcode sequence at the very end of each of your problematic applications, or even better write just separate single one that'll have those syntax lines and after executions, initialize it like macro or one among others bounded within (_autoload_) inside acaddoc.lsp - if you wish it not autoloaded, use (autoload) function instead of (load) which is what I prefer...

HTH.
Title: Re: AutoCAD start up changing system variable
Post by: dubb on September 28, 2022, 05:19:56 PM
Got it, I appreciate your informative response. My acaddoc needs some clean up. I think I'll go with the hardcode method.
Title: Re: AutoCAD start up changing system variable
Post by: Lonnie on September 28, 2022, 05:50:46 PM
Remember sysvdlg is your friend. It will tell you where the variable is stored and what it does. You can also save the file to compare it to another machine or profile to see just where things are going wrong.