TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: amc.dicsac on April 27, 2016, 05:56:56 PM

Title: Cancel While
Post by: amc.dicsac on April 27, 2016, 05:56:56 PM
Hello such, I would like to know how I can cancel my lisp while without leave me the message "; error: Function canceled"

Code: [Select]
(defun CopyMblock ()
(setvar "cmdecho" 0)
(while
(setq msxb (strcat  "\n>> Punto de Inserción del bloque [ " bloqxlist " ]: "))
(princ msxb)
(cond ((= selex "1:20") (setq opcion3 0.4))
      ((= selex "1:25") (setq opcion3 0.5))
      ((= selex "1:50") (setq opcion3 1))
      ((= selex "1:100") (setq opcion3 2))
      ((= selex "1:125") (setq opcion3 2.5))
      ((= selex "1:200") (setq opcion3 4))
      ((= selex "1:250") (setq opcion3 5))
      ((= selex "1:500") (setq opcion3 10))
      ((= selex "MS:PS") (setq opcion3 20)))
(cond ((= key_tog1 "1") (command "._insert" bloqxlist "_s" *AX:Escala1*))
           ((= key_tog1 "0") (command "._insert" bloqxlist "_s" opcion3)))
    (while (= (logand (getvar "cmdactive") 1) 1) (command pause))
(vl-cmdf "explode" "last")
(princ "\nPresiona [ ESC ] para cancelar ") (TERPRI)
(cond (nil (prompt "\n**Cancel**"))))
(setvar "cmdecho" 1)
(princ))
Title: Re: Cancel While
Post by: ur_naz on April 27, 2016, 11:32:14 PM
Try to use the *error* function
Title: Re: Cancel While
Post by: Lee Mac on April 28, 2016, 04:21:50 AM
This tutorial (http://www.lee-mac.com/errorhandling.html) may help.
Title: Re: Cancel While
Post by: amc.dicsac on April 28, 2016, 12:15:35 PM
Thanks LEE =)