• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Visual LISP, AutoLISP and General Customization

    Reply
    Active Contributor
    dicra
    Posts: 34
    Registered: ‎02-20-2011

    Command Line Variable

    194 Views, 10 Replies
    02-07-2013 01:39 AM

    Somehow, I manage to turn of one variable that display errors on command line.

     

    For example:

    (seq a 6)

     

    suppose to return, on command line, something like:

    error no function definition: SEQ

     

    If anyone knows which variable should I change, I would be very grateful for your response.

     

     

     

    Please use plain text.
    *Expert Elite*
    Posts: 2,066
    Registered: ‎11-24-2009

    Re: Command Line Variable

    02-07-2013 02:12 AM in reply to: dicra

    dicra wrote:

    Somehow, I manage to turn of one variable that display errors on command line.

     

    For example:

    (seq a 6)

     

    suppose to return, on command line, something like:

    error no function definition: SEQ

     

    If anyone knows which variable should I change, I would be very grateful for your response.

     


    Thats odd. , nomutt perhaps?

     

    Please use plain text.
    Active Contributor
    dicra
    Posts: 34
    Registered: ‎02-20-2011

    Re: Command Line Variable

    02-07-2013 02:36 AM in reply to: pbejse

    I just don't know what happened,

    but anyway pbejse you helped me.

     

    Nomutt is not variable which should suppress that error message (it was set to default - "0"),

    When nomutt is set to "1" you can't see 

    Command:  - on command line.

     

    But when I change to "1", there was error message:

    ; error: no function definition: SEQ

     

    I just returned nommut to "0" and the problem was solved.

     

    I spent the last couple of days trying to solve this problem...

     

    Thanks pbejse

    Please use plain text.
    *Expert Elite*
    3wood
    Posts: 615
    Registered: ‎03-25-2009

    Re: Command Line Variable

    02-07-2013 03:11 AM in reply to: dicra

    seTq

     

    Please use plain text.
    *Expert Elite*
    Posts: 2,066
    Registered: ‎11-24-2009

    Re: Command Line Variable

    02-07-2013 03:26 AM in reply to: dicra

    dicra wrote:

    I just don't know what happened,

    but anyway pbejse you helped me.......

     

    I just returned nommut to "0" and the problem was solved.

      

    Thanks pbejse


     

    Well good for you dicra.

     


    3wood wrote:

    seTq


    Thats not really the issue here 3wood :smileyhappy:

     

    Please use plain text.
    *Expert Elite*
    Kent1Cooper
    Posts: 4,085
    Registered: ‎09-13-2004

    Re: Command Line Variable

    02-07-2013 05:00 AM in reply to: dicra

    dicra wrote:

    Somehow, I manage to turn of one variable that display errors on command line.

     

    For example:

    (seq a 6)

     

    suppose to return, on command line, something like:

    error no function definition: SEQ

     

    If anyone knows which variable should I change, I would be very grateful for your response. 


    It looks as though you've already solved this, but I can think of another possible cause, in case someone finds this thread with a similar problem.

     

    The same problem could be caused, I think, by a redefinition of the *error* function that does not get reset to AutoCAD's original, if it omits any reporting of what the error is.  For instance, the old way of defining an error handler is to do something like this at the beginning of a routine:

     

    (defun C:XXX ()

      (defun xxxErr (errmsg); define error handler for this routine
        (if (/= errmsg "Function cancelled") (princ (strcat "\nError: " errmsg)))

          ; report error if not caused by User hitting Esc
        (setvar ... restore various things like CMDECHO to stored values ....)
        (... do some other things like Undo End ....)

        (setq *error* OrigErr); return to original error handler
      ); defun -- xxxErr

      (setq
        OrigErr *error* ; save AutoCAD's original error handler
        *error* xxxErr ; set the error handler to the definition above
      ); setq

    ... and at the end of the routine ... :

      (setq *error* OrigErr); return to AutoCAD's original error handler

    ); defun -- C:XXX

     

    But if the red line above, or something like it, was not included, and if the blue lines either were not included or something went so wrong that they weren't invoked, then an error handler that doesn't report the error would remain in effect, in place of AutoCAD's standard.

     

    The newer way to do it is to define the error handler as a localized function that goes away after the routine is finished, so it's not necessary to store AutoCAD's standard and restore it at the end, something like this:

     

    (defun C:XXX (/ *error* ... ); *error* is localized

      (defun *error* (errmsg); define error handler for this routine
        (if (/= errmsg "Function cancelled") (princ (strcat "\nError: " errmsg)))

          ; report error if not caused by User hitting Esc
        (setvar ... restore various things like CMDECHO to stored values ....)
        (... do some other things like Undo End ....)

      ); defun -- *error*

      ... routine content, without need for resetting of *error* ...

    ); defun -- C:XXX

     

    In that situation, if the *error* was left out of the localized variables list, and if the red line or something like it was not included, then after the routine was finished, an error handler that doesn't report the error would remain in effect, in place of AutoCAD's standard.

     

    Either of those would be fixed by getting out of AutoCAD and back in, because that will restore the standard error handler.

    Kent Cooper
    Please use plain text.
    *Expert Elite*
    Posts: 2,066
    Registered: ‎11-24-2009

    Re: Command Line Variable

    02-07-2013 05:55 AM in reply to: Kent1Cooper

    Kent1Cooper wrote:

     

    The same problem could be caused, I think, by a redefinition of the *error* function that does not get reset to AutoCAD's original, if it omits any reporting of what the error is.  ...


     

    You may have something there Kent. Good point :smileyhappy:

     

    Please use plain text.
    Active Contributor
    dicra
    Posts: 34
    Registered: ‎02-20-2011

    Re: Command Line Variable

    02-10-2013 04:39 AM in reply to: Kent1Cooper

    Kent1Cooper wrote:
    The same problem could be caused, I think, by a redefinition of the *error* function that does not get reset to AutoCAD's original, if it omits any reporting of what the error is

    I'm pretty much sure that I did not experimented with *error* function, in the time when problem was created.
    But I'm testing a lot of lisps, and maybe the problem was in one of them...

     

    The strangest thing was that nomut variable fixed the problem, just like it automatically reset something to default.

     

    Now, the problem is solved, and I can't verify that it was made by error function.
    I will try to make the problem again ( just kidding... :smileylol:)

     

    Anyway, Kent thank you for your effort.

     

     

     

    Please use plain text.
    Active Contributor
    dicra
    Posts: 34
    Registered: ‎02-20-2011

    Re: Command Line Variable

    02-21-2013 01:17 AM in reply to: dicra

    dicra wrote:

    Kent1Cooper wrote:
    The same problem could be caused, I think, by a redefinition of the *error* function that does not get reset to AutoCAD's original, if it omits any reporting of what the error is

    I'm pretty much sure that I did not experimented with *error* function, in the time when problem was created.
    But I'm testing a lot of lisps, and maybe the problem was in one of them...

     

    The strangest thing was that nomut variable fixed the problem, just like it automatically reset something to default.

     

    Now, the problem is solved, and I can't verify that it was made by error function.
    I will try to make the problem again ( just kidding... :smileylol:)

     

    Anyway, Kent thank you for your effort.

     

     

     


    Looks like I did it again, as I said the problem is probably in one of the routines which I'm using.
    I will try to be more careful and to figure out which one of them is causing the problem.
    Don't know how the problem was solved first time, I have only set nomutt to 1, and everything was fine.
    Now I tried the same thing, but that didn't fix the problem.

    Following Kent's suggestion, I redefined *error* message function:

     

    (defun *error* (msg)
     (princ "error: ")
     (princ msg)
     (princ)
    )

    That solved the problem, but I need to load this function every time I start Autocad...

     

     

     

     

    Please use plain text.
    *Expert Elite*
    Kent1Cooper
    Posts: 4,085
    Registered: ‎09-13-2004

    Re: Command Line Variable

    02-21-2013 04:38 AM in reply to: dicra

    dicra wrote:
    ....
    Looks like I did it again, as I said the problem is probably in one of the routines which I'm using.
    ... I redefined *error* message function:

     

    (defun *error* (msg)
     (princ "error: ")
     (princ msg)
     (princ)
    )

    That solved the problem, but I need to load this function every time I start Autocad...



    That suggests to me that there is some routine that is loaded by an acad.lsp file [since that runs every time you start AutoCAD] or in the Startup Suite in APPLOAD, that is redefining *error* in some way that omits reporting the error.  If so, that would at least make it easy to narrow down the possible sources of the problem, and you may not need to search through all your routines.

    Kent Cooper
    Please use plain text.