Locking Variable definitions

hi all -
is there a way to "Lock" the current (general) variable definition ?
i am experiencing constant change in the way actions/commands functions, which probably concerns preferences by settings/variables which weren't changed by me (not intentionally, anyway.

thanx
Assaf

Comments

  • Anthony Apostolaros
    edited January 2022
    Perhaps you have a custom command that changes the settings of those variables. I don't know of any other way that can happen unintentionally.

    If a custom command changes a variable setting, it should first store the previous setting. And then it should restore that previous setting when done. But if the person who wrote the code didn't include that restoration step, or if you terminated the command abnormally and the programmer didn't include an error-handling function, then the command could end with a changed variable.
  • here i go again :-( -

    all of a sudden - in trim/extend command - it is no longer possible to use an entity within a block as a cutting edge !! was perfectly OK an hour ago !!

    Just one annoying example of out of many, to emphasize what i was referring to in the first comment in this thread.
    problem is (as in all other cases) i don't have a clue as to where to find the solution/variable responsible for this issue in order to fix it.... (not to talk about the frustration regarding WHY on earth it has changed all of a sudden IN THE FIRST PLACE !!!!
  • Assaf, pull down Tools and select "Load Application..." That will open the "Load Application Files" dialog.
    Are any application files listed there? If so, do any of them have check-marks in the boxes on the same line?
  • Yes, settings change for no apparent reason, perhaps some bug or combination of circumstances, unrepeatable therefore unexplainable. Is it poss for a lock to be 1000% stronger than such freak events?

    So, a lock that really locks even if some other command/procedure won't work because it wants to change a setting? Then an explanatory dialog shd state what setting is involved and ask whether to release the lock - no/yes/one time/permanent.
  • In my v14, I have long had the issue of the Osnap turning on the Near snap. I've experienced this for several years, . It is rare enough that I don't have a clue what might be triggering it, since it may have been days since it was triggered.

    It certainly has caused many errors. I.e. I click near an end point, thinking I would get an endp snap. But, eventually I discover that it is close to, but not on the endpoint. It may have been days since that snap changed.

    I sure wish there were a way to find the trigger. Perhaps a way to search apps to find snaps that are set, but no counterpart to turn that same snap to what it was before. Or a utility that monitors any changes to snaps and lists them, and when the change is undone.

    -Joe
  • ALANH
    edited February 2022
    If your using plain lisp ie its a text file then in CMD mode of windows findstr osmode *.lsp for a directory will look for osnap settings. Old fashioned DOS.
  • Anthony Apostolaros
    edited February 2022
    ALANH said:

    If your using plain lisp ie its a text file then in CMD mode of windows findstr osmode *.lsp for a directory will look for osnap settings. Old fashioned DOS.

    Thanks for that tip, Alan. I never knew about FINDSTR. It will come in handy in many other ways.

    I experimented with it. When I executed it:
    - in C:\ I got Cannot open *.lsp.
    - in C:\Lisp Routines, I got what looked like the desired results.
    - in C:\Lisp Routines as findstr /s osmode *.lsp, I got those results plus many others.
    - in C:\Lisp Routines as findstr /s /i osmode *.lsp, I got even more results.
    - in C:\ as findstr /s /i osmode *.lsp, I got those results and FINDSTR: Out of memory.
    - in C:\ as findstr /s /i /p osmode *.lsp, I still got the out of memory message.
    - in Documents, as findstr /s /i /p osmode *.lsp, I got many results, different than before.
    - in my User directory, as findstr /s /i /p osmode *.lsp, I just got the out of memory message.

    Is there any way to successfully search all folders that could have lisp files that are accessible to Bricscad?

    And wouldn't you have to search for OSNAP as well? The culprit lisp file could have, for example, (command "-osnap" "int").
  • How about. Figure out the ones you want.
    Put them in a lisp and add to an icon.
    As soon as you have a problem hit the icon.
    I have had this type of issues for ages but finding all possible errors is not worth it. It might be that sometimes you may have escaped out of a function half way through.
    Dont spend your time trying to avoid it.
    Good luck
  • Anthony Apostolaros
    edited March 2022

    ..... It might be that sometimes you may have escaped out of a function half way through. .....

    That's almost certainly the cause, if the problem happens rarely. But it's easy to fix, by defining an error-handling function. Find the problem lisp file, as described above, and then add a function, called *error*, which does whatever needs to be done if the main function is interrupted and stops running unexpectedly. Lisp automatically executes a function with that name whenever there's an abnormal termination. If you don't define it, the built-in *error* function will be used; but that just prints a generic error message. If you define your own, you can have it reset any altered variables. For example, before changing the Orthomode variable, define an error function that resets it to what it was before:
    (setq om1 (getvar "Orthomode"))
    (defun *error* (msg) (setvar "Orthomode" om1) (princ msg) (princ) )
    (setvar "Orthomode" 1)
    If the main function changes more than one variable, the *error* function should reset all of them, and it should be defined before altering any of them.

    See https://developer.bricsys.com/bricscad/help/en_US/V22/DevRef/index.html
    and http://www.lee-mac.com/errorhandling.html

    Help! Can anyone explain why I can no longer get code to display in this forum on multiple lines?
    I got it to work, above, only by putting each line of code inside a separate markup tag.
  • I am puzzled why Bricsys has been so persistent over the years in using whatever the program is that runs it. Other discussion forums don't have the kind of problems that are here A week or so ago, I got an error message that there was an error and to try to repost again in a few minutes...only to have to repeat and later find that each one DID post. And, like you, I've long had difficulties with posting code here. Enough that I have completely quit the effort.

    -Joe
  • Yes, the worst of it is the difference between what the forum says and what it actually does. I don't so much mind having to put each line of code in a separate tag, now that I know that's what's required. Code with many lines can be attached as a lisp file. But why mislead me into thinking it's going to be displayed on separate lines by showing the Preview that way?