dos_isbreak - dalefugier/DOSLib GitHub Wiki

Queries AutoCAD's console break handler to verify that the escape key has been pressed. Used in conjunction with the vl-catch-all-apply function, dos_isbreak is useful in breaking out of tight loops.

Syntax

(dos_isbreak)

Returns

A list of drawing file names if successful.

nil if not successful or on error.

Example

(defun c:breaktest (/ msg cnt err)
  (setq msg "User break!"
        cnt -1
        err (vl-catch-all-apply 'dos_isbreak)
  )
  (while (/= err T)
    (if (> 10000000000 (setq cnt (1+ cnt)))
      (setq err (vl-catch-all-apply 'dos_isbreak))
      (setq msg "Maximum count reached."
            err T
      )
    )
    (princ cnt)
  )
  (if (vl-catch-all-error-p err)
    (princ (vl-catch-all-error-msg err))
    (princ (strcat "\nTerminated loop: " msg))
  )
  (princ)
)