nested commands in lisp file error

Discussion in 'AutoCAD' started by Tom Hanley, Oct 12, 2004.

  1. Tom Hanley

    Tom Hanley Guest

    running this 3x in a row causes fatal error - commands cannot be nested 4
    levels deep.
    how can I clean this up?

    ;Texttofront2.lsp
    ;Texttofront command to set correct display order for dims and mtext.
    (defun c:texttofront2 ()
    (command "texttofront" "b")
    (command "texttofront" "t")
    )
     
    Tom Hanley, Oct 12, 2004
    #1
  2. Tom Hanley

    LUCAS Guest

    ;; I think you can have your own command. :cool:
    ;;Sorry!It was "chinese",command "msg" like texttofront
    (defun TEXTTOFRONT-LAI (KEY / SS)
    (vl-load-com)
    (setq KEY (strcase KEY))
    (cond
    ((= "T" KEY)
    (setq SS (ssget "X" '((0 . "*TEXT"))))
    )
    ((= "D" KEY)
    (setq SS (ssget "X" '((0 . "DIMENSION,LEADER"))))
    )
    ((= "B" KEY)
    (setq SS (ssget "X" '((0 . "*TEXT,DIMENSION,LEADER"))))
    )
    )
    (if SS
    (progn
    (vl-cmdf "_.draworder" SS "" "F")
    (prompt
    (strcat "\n¤w±N "
    (rtos (sslength SS) 2 0)
    " ­Óª«¥ó¸m©ó«e¤è¡C\n"
    )
    )
    )
    (prompt "\n§ä¤£¨ìª«¥ó¡C\n")
    )
    (princ)
    )

    (defun C:TEXTTOFRONT3 ()
    (TEXTTOFRONT-LAI "b")
    (TEXTTOFRONT-LAI "t")
    )
     
    LUCAS, Oct 14, 2004
    #2
  3. Tom Hanley

    LUCAS Guest

    ;;Autodesk doing something like below, So error!!!!!
    (defun TEXTTOFRONT_LAI (/ KEY SS HOLDECHO)
    (vl-load-com)
    (setq HOLDECHO (getvar "cmdecho"))
    (initget "T D B ")
    (setq KEY (getkword "\nMove Front [Text(T)/Dim(D)/Both(B)]<Both>:"))
    (cond
    ((= "T" KEY)
    (setq SS (ssget "X" '((0 . "*TEXT"))))
    )
    ((= "D" KEY)
    (setq SS (ssget "X" '((0 . "DIMENSION,LEADER"))))
    )
    ((or (= NIL KEY) (= "B" KEY))
    (setq SS (ssget "X" '((0 . "*TEXT,DIMENSION,LEADER"))))
    )
    )
    (if SS
    (progn
    (setvar "cmdecho" 0)
    (vl-cmdf "_.draworder" SS "" "F")
    (setvar "cmdecho" 1)
    (prompt
    (strcat "\nMoving "
    (rtos (sslength SS) 2 0)
    " Object(s) to Top\n"
    )
    )
    )
    (prompt "\nNothing find.\n")
    )
    (setvar "cmdecho" HOLDECHO)
    (princ)
    )
    (vlax-add-cmd "TEXTTOFRONT_LAI" 'TEXTTOFRONT_LAI)

    (defun C:TEXTTOFRONT3 ()
    (command "_.TEXTTOFRONT_LAI" "b")
    (command "_.TEXTTOFRONT_LAI" "t")
    )
     
    LUCAS, Oct 14, 2004
    #3
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.