Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Command Line Variable

10 REPLIES 10
Reply
Message 1 of 11
dicra
628 Views, 10 Replies

Command Line Variable

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.

 

 

 

10 REPLIES 10
Message 2 of 11
pbejse
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?

 

Message 3 of 11
dicra
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

Message 4 of 11
3wood
in reply to: dicra

seTq

 

Message 5 of 11
pbejse
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 Smiley Happy

 

Message 6 of 11
Kent1Cooper
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, AIA
Message 7 of 11
pbejse
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 🙂

 

Message 8 of 11
dicra
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... Smiley LOL)

 

Anyway, Kent thank you for your effort.

 

 

 

Message 9 of 11
dicra
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... Smiley LOL)

 

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...

 

 

 

 

Message 10 of 11
Kent1Cooper
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, AIA
Message 11 of 11
dicra
in reply to: Kent1Cooper


@Kent1Cooper wrote:


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.


Thanks Kent, I thought the same.


I just removed the suspicious folder from "Support File Search", 

and the problem was solved, at least for now...

 

I eas testing some lisps that I got from a friend, and completly forgot about them. 

In that folder was one acad.doc file, which is suspicious.

 

Thanks again

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost