Author Topic: Share your ERROR subroutine to get best one  (Read 10495 times)

0 Members and 1 Guest are viewing this topic.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Share your ERROR subroutine to get best one
« Reply #45 on: July 12, 2010, 07:30:50 PM »
Thanks to all.

Sam

  • Bull Frog
  • Posts: 201
Re: Share your ERROR subroutine to get best one
« Reply #46 on: July 16, 2010, 07:57:30 AM »

Quote
;;;m_redraw----objectives highlighted

;;;m_delss-----in the Program Run-time generated temporary objects

;;;m_hbdraw-----in the program Setup This value to determine whether mistakes redraw Graph

;;;m_setFirst------run in the interimSelectSet


(defun hb_error   (a /)

  (if

    (not

      (member a

         '("Function is cancelled"
      "Function cancelled"
      "quit / exit abort"
          )

      )

    )

     (princ a)

  )

  (if m_redraw

    (cond

      ((member (type m_redraw) (list 'ename))

       (redraw m_reDraw 4)

       (setq m_reDraw nil)

      )

      ((= (type m_redraw) 'list)

       (MAPCAR '(LAMBDA (itm) (redraw itm 4))

          m_redraw

       )

       (setq m_reDraw nil)

      )

    )

  )

  (if m_hbdraw

    (redraw)

  )

  (if m_delss

    (progn

      (vl-cmdf "_.erase" m_delss "")

      (setq m_delss nil)

    )

  )

  (if m_setFirst

    (sssetfirst nil nil)

  )

  (HB_SETVAR m_lst) ;_m_lst saved for the initialization System Variable value


  (setq *error* olderr)

  (vla-EndUndoMark VLAXDOC)

)

;|«Visual LISP© Format Options»
(200 2 40 2 nil "end of " 60 9 0 0 nil T T nil T)
;*** DO NOT add text below the comment! ***|;
Every time we waste electricity, we put our planet's future in the dark. Let's turn around our attiude and start saving power and our planet, before it's too late
http://www.theswamp.org/donate.html

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Share your ERROR subroutine to get best one
« Reply #47 on: July 17, 2010, 07:17:48 AM »
My $0.02

Code: [Select]
(setq olderr *error*
      *error* (lambda (msg)
                (while (> (getvar "CMDACTIVE") 0)
                       (command))
                (and (/= msg "quit / exit abort")
                     (princ (strcat "\nError: *** " msg " *** ")))
                (and (= (logand (getvar "UNDOCTL") 8) 8)
                     (command "_.UNDO" "_END" "_.U"))
                (nw_rmd)))  ;;; My Mode Reset

-David
R12 Dos - A2K