cmdecho nil not accepted?

Discussion in 'AutoCAD' started by Debi Olson, Aug 6, 2003.

  1. Debi Olson

    Debi Olson Guest

    What would make "cmdecho 0" an unacceptable value? I am tying to update some
    lisp and most of them have cmdecho 0 as part of the error function. This
    particular one doesn't like it. Any ideas?

    TIA,
    Deb
     
    Debi Olson, Aug 6, 2003
    #1
  2. Debi Olson

    Debi Olson Guest

    Yep. (setvar "cmdecho" 0) copied straight out of the code.

    Are you using is like this?

    (setvar "cmdecho" 0)
     
    Debi Olson, Aug 6, 2003
    #2
  3. Debi Olson

    Kevin Nehls Guest

    What's the error message you are getting? Can you post your code or the
    relevant sections of code?
     
    Kevin Nehls, Aug 7, 2003
    #3
  4. Debi Olson

    Debi Olson Guest

    Sure, first the error. Then the code.

    ; error: An error has occurred inside the *error* functionAutoCAD variable
    setting rejected: "cmdecho" nil

    ;;;
    ;;; By Carl Rockstrom
    ;;; modified by Debi Olson 9/5/01
    ;;; removed all ortho settings.
    ;;;

    ;;;
    ;;; Builds TJI's
    ;;; Uses the AutoCAD menu
    ;;;

    (defun myerror (s) ; If an error (such as escape) occurs
    ; while this command is active...
    (if (/= s "Function cancelled")
    (princ (strcat "\nError: " s))
    )
    (setvar "cmdecho" ocmd) ; Restore saved modes
    (setvar "osmode" osmd)
    (setq *error* olderr) ; Restore old *error* handler
    (princ)
    )
    (prompt "TJI Builder - version 1.0")
    (defun c:TJI ();(/ olderr uv1 ocmd osmd pt1 pt2 pt3 pt4 pt5 pt6 pt7 l w ro1
    mc mb)
    (setq uv1 (getvar "clayer"))
    (setq sv1 (getvar "plinewid")
    osmd (getvar "osmode"))
    (setvar "cmdecho" 0)
    (setvar "plinewid" 0)
    (initget 1) ;3D point can't be null
    (setq pt1 (getpoint (strcat "\nTop Left or Lower Right Corner of TJI:
    ")))
    ;;(setvar "ORTHOMODE" 1) removed this line 9/5/01 dlo
    (initget "8 10 12 14 16 18 20 22 24")
    (if (not (setq l (getdist pt1 "\nDepth of TJI: <11-7/8> "))) (setq l
    11.875))
    (initget"L60 H60 L90 H90 P150 P250 P350 P550")
    (if (not (setq se (getKword "\nEnter Series of member: <L60> "))) (setq
    se "L60"))
    (cond ;flange width, depth, web thickness, embed
    ((= se "L60")(setq bm (list 2.3 1.5 0.4375 0.375)))
    ((= se "H60")(setq bm (list 2.3 1.75 0.4375 0.5)))
    ((= se "L90")(setq bm (list 3.5 1.5 0.4375 0.5)))
    ((= se "H90")(setq bm (list 3.5 1.75 0.4375 0.5)))
    ((= se "P150")(setq bm (list 1.75 1.5 0.375 0.375)))
    ((= se "P250")(setq bm (list 1.75 1.5 0.375 0.375)))
    ((= se "P350")(setq bm (list 2.3 1.5 0.4375 0.5)))
    ((= se "P550")(setq bm (list 3.5 1.75 0.4375 0.5)))
    )
    (if (not (= bm nil))
    (progn
    (cond((>= (getvar "dimscale") 32)(setq cc1 "213" cc2 "213"))
    ((>= (getvar "dimscale") 16)(setq cc1 "1" cc2 "1"))
    ((>= (getvar "dimscale") 1)(setq cc1 "bylayer" cc2
    "bylayer"))
    )
    ;Top board
    (setq pt2 (list (+ (car pt1) (nth 0 bm)) (cadr pt1) (caddr
    pt1)))
    (setq pt3 (list (car pt2) (- (cadr pt2) (nth 1 bm)) (caddr
    pt2)))
    (setq pt4 (list (- (car pt3) (/ (- (nth 0 bm) (nth 2 bm)) 2))
    (cadr pt3) (caddr pt3)))
    (setq pt5 (list (car pt1) (- (cadr pt1) (nth 1 bm)) (caddr
    pt2)))
    (setq pt6 (list (+ (car pt5) (/ (- (nth 0 bm) (nth 2 bm)) 2))
    (cadr pt5) (caddr pt5)))
    (setq pt7 pt1)
    (mlayer "SDEMC" "7" nil)
    (setvar "osmode" 0)
    (command "color" cc1 "pline" pt6 pt5 pt1 pt2 pt3 pt4 "")
    (setq ss1 (ssget "L"))
    (command "color" "40" "line" pt5 pt2 "")
    (ssadd (entlast) ss1)
    (command "line" pt1 pt3 "" "color" "bylayer")
    (ssadd (entlast) ss1)
    ;Bottom board
    (setq pt2 (list (car pt1) (- (cadr pt1) l) (caddr pt1)))
    (setq pt1 (list (+ (car pt2) (nth 0 bm)) (cadr pt2) (caddr
    pt2)))
    (setq pt3 (list (car pt2) (+ (cadr pt2) (nth 1 bm)) (caddr
    pt2)))
    (setq pt4 (list (+ (car pt3) (/ (- (nth 0 bm)(nth 2 bm)) 2))
    (cadr pt3) (caddr pt3)))
    (setq pt5 (list (car pt1) (+ (cadr pt1) (nth 1 bm)) (caddr
    pt2)))
    (setq pt6 (list (- (car pt5) (/ (- (nth 0 bm)(nth 2 bm)) 2))
    (cadr pt5) (caddr pt5)))
    (command "color" cc1 "pline" pt6 pt5 pt1 pt2 pt3 pt4 ""
    "color" "40")
    (ssadd (entlast) ss1)
    (command "line" pt5 pt2 "")
    (ssadd (entlast) ss1)
    (command "line" pt1 pt3 "" "color" "bylayer")
    (ssadd (entlast) ss1)
    ;Web
    (setq pt1 (list (car pt4) (- (cadr pt4) (nth 3 bm)) (caddr
    pt4)))
    (setq pt2 (list (+ (car pt1) (nth 2 bm)) (cadr pt1) (caddr
    pt1)))
    (setq pt3 (list (car pt2) (+ (cadr pt2) (+ (- l (* 2 (nth 1
    bm)))(* 2 (nth 3 bm)))) (caddr pt2)))
    (setq pt4 (list (- (car pt3) (nth 2 bm)) (cadr pt3) (caddr
    pt3)))
    (command "color" cc2 "pline" pt1 pt2 pt3 pt4 "close")
    (ssadd (entlast) ss1)
    (command "color" "40" "_bhatch" "s" (entlast) "" "p" "ply"
    "14" "45" "" "color" "bylayer")
    (ssadd (entlast) ss1)
    ;Rotation
    (setq ro1 (getangle pt7 "\nRotation angle: <0> : "))
    (if (= ro1 nil)(setq ro1 0))
    (command "rotate" ss1 "" pt7 (angtos ro1))
    )
    (progn
    (setvar "plinewid" sv1)
    (setvar "cmdecho" 1)
    (setvar "clayer" uv1)
    (setq ss1 nil
    *error* olderr) ; Restore old *error* handler
    (prompt "\nNo such beam size.")
    )
    )
    (setvar "plinewid" sv1)
    (setvar "cmdecho" 1)
    (setvar "clayer" uv1)
    (setvar "osmode" osmd)
    (setq ss1 nil
    *error* olderr) ; Restore old *error* handler
    (princ)
    )


    What's the error message you are getting? Can you post your code or the
    relevant sections of code?
     
    Debi Olson, Aug 7, 2003
    #4
  5. Debi Olson

    Kevin Nehls Guest

    That's becuase you never set the ocmd variable to the existing setting of
    cmdecho ;)

    Change the code at the beginning of your routine to do that:

    (setq ocmd (getvar "cmdecho"))
    (setvar "cmdecho" 0)

    Then change the end of your routine to do this:

    (setvar "cmdecho" ocmd)

    Not the cleanest mark-up of code below, but you should get the idea ;)

    HTH
    --
    Kevin Nehls


    [SNIP]
    ;;ADDED THIS
    (setq OSMD (getvar "cmdecho"))
    [SNIP]
    ;; ADDED THIS
    (setvar "cmdecho" OCMD) ;; LIKE THIS
     
    Kevin Nehls, Aug 7, 2003
    #5
  6. Debi Olson

    Debi Olson Guest

    Thank you. I'm still trying to learn this stuff and there are days when I
    despair that it will ever make sense. I think I have the very basic of
    basics down until something like this comes along.

    Deb

    That's becuase you never set the ocmd variable to the existing setting of
    cmdecho ;)

    Change the code at the beginning of your routine to do that:

    (setq ocmd (getvar "cmdecho"))
    (setvar "cmdecho" 0)

    Then change the end of your routine to do this:

    (setvar "cmdecho" ocmd)

    Not the cleanest mark-up of code below, but you should get the idea ;)

    HTH
    --
    Kevin Nehls


    [SNIP]
    ;;ADDED THIS
    (setq OSMD (getvar "cmdecho"))
    [SNIP]
    ;; ADDED THIS
    (setvar "cmdecho" OCMD) ;; LIKE THIS
     
    Debi Olson, Aug 7, 2003
    #6
  7. Debi Olson

    Kevin Nehls Guest

    It's o.k. Almost all of us were there at some point or another. I know I
    was once.

    Keep it up, you'll get it. Do you have a book to help you along or are you
    just looking at other people's code and using the help files?
     
    Kevin Nehls, Aug 7, 2003
    #7
  8. Don't forget that you have me right next door! 8^)

    --
    R. Robert Bell, MCSE
    www.AcadX.com


    | Thank you. I'm still trying to learn this stuff and there are days when I
    | despair that it will ever make sense. I think I have the very basic of
    | basics down until something like this comes along.
    |
    | Deb
    |
    | | That's becuase you never set the ocmd variable to the existing setting of
    | cmdecho ;)
    |
    | Change the code at the beginning of your routine to do that:
    |
    | (setq ocmd (getvar "cmdecho"))
    | (setvar "cmdecho" 0)
    |
    | Then change the end of your routine to do this:
    |
    | (setvar "cmdecho" ocmd)
    |
    | Not the cleanest mark-up of code below, but you should get the idea ;)
    |
    | HTH
    | --
    | Kevin Nehls
    |
    |
    | | > Sure, first the error. Then the code.
    | >
    | > ; error: An error has occurred inside the *error* functionAutoCAD
    variable
    | > setting rejected: "cmdecho" nil
    | >
    | > (defun myerror (s) ; If an error (such as escape)
    | occurs
    | [SNIP]
    | > (setvar "cmdecho" ocmd) ; Restore saved modes
    | > (setvar "osmode" osmd)
    | [SNIP]
    | > (defun c:TJI ();(/ olderr uv1 ocmd osmd pt1 pt2 pt3 pt4 pt5 pt6 pt7 l w
    | ro1
    | > mc mb)
    | > (setq uv1 (getvar "clayer"))
    | > (setq sv1 (getvar "plinewid")
    | > osmd (getvar "osmode"))
    | [SNIP]
    | ;;ADDED THIS
    | (setq OSMD (getvar "cmdecho"))
    | > (setvar "cmdecho" 0) ;;<<<<<OCMD is never set
    | > (setvar "plinewid" 0)
    | [SNIP]
    | > (setvar "plinewid" sv1)
    | > (setvar "cmdecho" 1) ;;<<<<<should set back to OCMD
    | [SNIP]
    | ;; ADDED THIS
    | (setvar "cmdecho" OCMD) ;; LIKE THIS
    | > (setvar "clayer" uv1)
    | > (setvar "osmode" osmd)
    |
    |
    |
    |
     
    R. Robert Bell, Aug 7, 2003
    #8
  9. Debi Olson

    Jamie Duncan Guest

    Hey there Deb

    go to afralisp - they really do have some nice stuff.
    And I have a lovely routine for saving and restoring sysvars - interested?

    Jamie


     
    Jamie Duncan, Aug 7, 2003
    #9
  10. Debi Olson

    Debi Olson Guest

    I actually subscribe to their newsletter and have a directory just for their
    stuff.

    Thanks for the tip.

    Debi,

    FYI, there are some EXCELLENT tutorials at www.afralisp.com that you might
    want to look at.
     
    Debi Olson, Aug 7, 2003
    #10
  11. Debi Olson

    Debi Olson Guest

    Of course I'm interested. I like to think I'm no fool. If someone has
    something that works and is willing to share it, why should I beat my head
    against the wall? Thank you. How do I get my hands on it?

    Hey there Deb

    go to afralisp - they really do have some nice stuff.
    And I have a lovely routine for saving and restoring sysvars - interested?

    Jamie


     
    Debi Olson, Aug 7, 2003
    #11
  12. Debi, not to hijack Jamie (ok, I *am* hijacking Jamie!) but try this:
    http://code.acadx.com/autolisp/006.htm


    --
    R. Robert Bell, MCSE
    www.AcadX.com


    | Of course I'm interested. I like to think I'm no fool. If someone has
    | something that works and is willing to share it, why should I beat my
    head
    | against the wall? Thank you. How do I get my hands on it?
    |
    | | Hey there Deb
    |
    | go to afralisp - they really do have some nice stuff.
    | And I have a lovely routine for saving and restoring sysvars - interested?
    |
    | Jamie
    |
    |
    | | > Thank you. I'm still trying to learn this stuff and there are days when
    I
    | > despair that it will ever make sense. I think I have the very basic of
    | > basics down until something like this comes along.
    | >
    | > Deb
    | >
    | > | > That's becuase you never set the ocmd variable to the existing setting
    of
    | > cmdecho ;)
    | >
    | > Change the code at the beginning of your routine to do that:
    | >
    | > (setq ocmd (getvar "cmdecho"))
    | > (setvar "cmdecho" 0)
    | >
    | > Then change the end of your routine to do this:
    | >
    | > (setvar "cmdecho" ocmd)
    | >
    | > Not the cleanest mark-up of code below, but you should get the idea ;)
    | >
    | > HTH
    | > --
    | > Kevin Nehls
    | >
    | >
    | > | > > Sure, first the error. Then the code.
    | > >
    | > > ; error: An error has occurred inside the *error* functionAutoCAD
    | variable
    | > > setting rejected: "cmdecho" nil
    | > >
    | > > (defun myerror (s) ; If an error (such as escape)
    | > occurs
    | > [SNIP]
    | > > (setvar "cmdecho" ocmd) ; Restore saved modes
    | > > (setvar "osmode" osmd)
    | > [SNIP]
    | > > (defun c:TJI ();(/ olderr uv1 ocmd osmd pt1 pt2 pt3 pt4 pt5 pt6 pt7 l
    w
    | > ro1
    | > > mc mb)
    | > > (setq uv1 (getvar "clayer"))
    | > > (setq sv1 (getvar "plinewid")
    | > > osmd (getvar "osmode"))
    | > [SNIP]
    | > ;;ADDED THIS
    | > (setq OSMD (getvar "cmdecho"))
    | > > (setvar "cmdecho" 0) ;;<<<<<OCMD is never set
    | > > (setvar "plinewid" 0)
    | > [SNIP]
    | > > (setvar "plinewid" sv1)
    | > > (setvar "cmdecho" 1) ;;<<<<<should set back to OCMD
    | > [SNIP]
    | > ;; ADDED THIS
    | > (setvar "cmdecho" OCMD) ;; LIKE THIS
    | > > (setvar "clayer" uv1)
    | > > (setvar "osmode" osmd)
    | >
    | >
    | >
    | >
    |
    |
    |
    |
     
    R. Robert Bell, Aug 7, 2003
    #12
  13. Debi Olson

    Debi Olson Guest

    Robert,

    I followed the link but don't understand half of it. Does the (list var)
    portion gather all the variables into a list? And just for my own info, is
    this all lisp or is some of it vba? Where do I find a dictionary of lisp
    terms/commands? Personally, I think that would be one of the most helpful
    resources to have.

    Deb

    Debi, not to hijack Jamie (ok, I *am* hijacking Jamie!) but try this:
    http://code.acadx.com/autolisp/006.htm


    --
    R. Robert Bell, MCSE
    www.AcadX.com


    | Of course I'm interested. I like to think I'm no fool. If someone has
    | something that works and is willing to share it, why should I beat my
    head
    | against the wall? Thank you. How do I get my hands on it?
    |
    | | Hey there Deb
    |
    | go to afralisp - they really do have some nice stuff.
    | And I have a lovely routine for saving and restoring sysvars - interested?
    |
    | Jamie
    |
    |
    | | > Thank you. I'm still trying to learn this stuff and there are days when
    I
    | > despair that it will ever make sense. I think I have the very basic of
    | > basics down until something like this comes along.
    | >
    | > Deb
    | >
    | > | > That's becuase you never set the ocmd variable to the existing setting
    of
    | > cmdecho ;)
    | >
    | > Change the code at the beginning of your routine to do that:
    | >
    | > (setq ocmd (getvar "cmdecho"))
    | > (setvar "cmdecho" 0)
    | >
    | > Then change the end of your routine to do this:
    | >
    | > (setvar "cmdecho" ocmd)
    | >
    | > Not the cleanest mark-up of code below, but you should get the idea ;)
    | >
    | > HTH
    | > --
    | > Kevin Nehls
    | >
    | >
    | > | > > Sure, first the error. Then the code.
    | > >
    | > > ; error: An error has occurred inside the *error* functionAutoCAD
    | variable
    | > > setting rejected: "cmdecho" nil
    | > >
    | > > (defun myerror (s) ; If an error (such as escape)
    | > occurs
    | > [SNIP]
    | > > (setvar "cmdecho" ocmd) ; Restore saved modes
    | > > (setvar "osmode" osmd)
    | > [SNIP]
    | > > (defun c:TJI ();(/ olderr uv1 ocmd osmd pt1 pt2 pt3 pt4 pt5 pt6 pt7 l
    w
    | > ro1
    | > > mc mb)
    | > > (setq uv1 (getvar "clayer"))
    | > > (setq sv1 (getvar "plinewid")
    | > > osmd (getvar "osmode"))
    | > [SNIP]
    | > ;;ADDED THIS
    | > (setq OSMD (getvar "cmdecho"))
    | > > (setvar "cmdecho" 0) ;;<<<<<OCMD is never set
    | > > (setvar "plinewid" 0)
    | > [SNIP]
    | > > (setvar "plinewid" sv1)
    | > > (setvar "cmdecho" 1) ;;<<<<<should set back to OCMD
    | > [SNIP]
    | > ;; ADDED THIS
    | > (setvar "cmdecho" OCMD) ;; LIKE THIS
    | > > (setvar "clayer" uv1)
    | > > (setvar "osmode" osmd)
    | >
    | >
    | >
    | >
    |
    |
    |
    |
     
    Debi Olson, Aug 7, 2003
    #13
  14. If we gave out a dictionary of terms, than everyone would understand what
    the geeks are saying, and we wouldn't seem so wizard-like anymore!

    That function is separate (I assume you understand that far!) and would be
    used in your code like this:

    (defun C:Test (/ SavedVars)
    (princ (strcat "\nHighlight is at: " (itoa (getvar "Highlight"))))
    (princ (strcat "\nCmdEcho is at: " (itoa (getvar "CmdEcho"))))
    (princ (strcat "\nOSMode is at: " (itoa (getvar "OSMode"))))
    (setq SavedVars (changevars '(("highlight" . 0) ("cmdecho" . 1) ("osmode" .
    512))))
    (princ (strcat "\nHighlight is now at: " (itoa (getvar "Highlight"))))
    (princ (strcat "\nCmdEcho is now at: " (itoa (getvar "CmdEcho"))))
    (princ (strcat "\nOSMode is now at: " (itoa (getvar "OSMode"))))
    (terpri)
    (command "._line" pause pause "")
    (changevars SavedVars)
    (princ (strcat "\nHighlight is back to: " (itoa (getvar "Highlight"))))
    (princ (strcat "\nCmdEcho is back to: " (itoa (getvar "CmdEcho"))))
    (princ (strcat "\nOSMode is back to: " (itoa (getvar "OSMode"))))
    (princ)
    )


    --
    R. Robert Bell, MCSE
    www.AcadX.com


    | Robert,
    |
    | I followed the link but don't understand half of it. Does the (list var)
    | portion gather all the variables into a list? And just for my own info, is
    | this all lisp or is some of it vba? Where do I find a dictionary of lisp
    | terms/commands? Personally, I think that would be one of the most helpful
    | resources to have.
    |
    | Deb
    |
    | | Debi, not to hijack Jamie (ok, I *am* hijacking Jamie!) but try this:
    | http://code.acadx.com/autolisp/006.htm
    |
    |
    | --
    | R. Robert Bell, MCSE
    | www.AcadX.com
    |
    |
    | | | Of course I'm interested. I like to think I'm no fool. If someone has
    | | something that works and is willing to share it, why should I beat my
    | head
    | | against the wall? Thank you. How do I get my hands on it?
    | |
    | | | | Hey there Deb
    | |
    | | go to afralisp - they really do have some nice stuff.
    | | And I have a lovely routine for saving and restoring sysvars -
    interested?
    | |
    | | Jamie
    | |
    | |
    | | | | > Thank you. I'm still trying to learn this stuff and there are days
    when
    | I
    | | > despair that it will ever make sense. I think I have the very basic of
    | | > basics down until something like this comes along.
    | | >
    | | > Deb
    | | >
    | | > | | > That's becuase you never set the ocmd variable to the existing setting
    | of
    | | > cmdecho ;)
    | | >
    | | > Change the code at the beginning of your routine to do that:
    | | >
    | | > (setq ocmd (getvar "cmdecho"))
    | | > (setvar "cmdecho" 0)
    | | >
    | | > Then change the end of your routine to do this:
    | | >
    | | > (setvar "cmdecho" ocmd)
    | | >
    | | > Not the cleanest mark-up of code below, but you should get the idea ;)
    | | >
    | | > HTH
    | | > --
    | | > Kevin Nehls
    | | >
    | | >
    | | > | | > > Sure, first the error. Then the code.
    | | > >
    | | > > ; error: An error has occurred inside the *error* functionAutoCAD
    | | variable
    | | > > setting rejected: "cmdecho" nil
    | | > >
    | | > > (defun myerror (s) ; If an error (such as escape)
    | | > occurs
    | | > [SNIP]
    | | > > (setvar "cmdecho" ocmd) ; Restore saved modes
    | | > > (setvar "osmode" osmd)
    | | > [SNIP]
    | | > > (defun c:TJI ();(/ olderr uv1 ocmd osmd pt1 pt2 pt3 pt4 pt5 pt6 pt7
    l
    | w
    | | > ro1
    | | > > mc mb)
    | | > > (setq uv1 (getvar "clayer"))
    | | > > (setq sv1 (getvar "plinewid")
    | | > > osmd (getvar "osmode"))
    | | > [SNIP]
    | | > ;;ADDED THIS
    | | > (setq OSMD (getvar "cmdecho"))
    | | > > (setvar "cmdecho" 0) ;;<<<<<OCMD is never set
    | | > > (setvar "plinewid" 0)
    | | > [SNIP]
    | | > > (setvar "plinewid" sv1)
    | | > > (setvar "cmdecho" 1) ;;<<<<<should set back to OCMD
    | | > [SNIP]
    | | > ;; ADDED THIS
    | | > (setvar "cmdecho" OCMD) ;; LIKE THIS
    | | > > (setvar "clayer" uv1)
    | | > > (setvar "osmode" osmd)
    | | >
    | | >
    | | >
    | | >
    | |
    | |
    | |
    | |
    |
    |
    |
    |
     
    R. Robert Bell, Aug 7, 2003
    #14
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.