Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/26/2018 in all areas

  1. As an example, consider the following: (defun c:test ( / *error* dcl dch des ) (defun *error* ( msg ) (if (< 0 dch) (unload_dialog dch)) (if (= 'file (type des)) (close des)) (if (and (= 'str (type dcl)) (setq dcl (findfile dcl))) (vl-file-delete dcl)) (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))) (princ (strcat "\nError: " msg)) ) (princ) ) (if (and (setq dcl (vl-filename-mktemp nil nil ".dcl")) (setq des (open dcl "w")) (foreach str '( "butt : button" "{" " width = 15;" " height = 2;" " fixed_width = true;" " fixed_height = true;" " alignment = centered;" "}" "test : dialog" "{" " label = \"Example 1\";" " spacer_1;" " : row" " {" " : butt { key = \"b1\"; label = \"Button 1\"; }" " : butt { key = \"b2\"; label = \"Button 2\"; }" " : butt { key = \"b3\"; label = \"Button 3\"; is_cancel = true; }" " }" " spacer;" " : butt" " {" " label = \"OK\";" " key = \"accept\";" " is_default = true;" " }" " spacer;" "}" ) (write-line str des) ) (not (setq des (close des))) (< 0 (setq dch (load_dialog dcl))) (new_dialog "test" dch) ) (progn (action_tile "b1" "(alert \"I am button 1.\")") (action_tile "b2" "(alert \"I am button 2.\")") (action_tile "b3" "(alert \"I am button 3.\nI am also cancel.\") (done_dialog 0)") (start_dialog) ) ) (*error* nil) (princ) ) Observe that the action of clicking the red "x" in the corner of the window has the same effect as clicking "Button 3" since this tile has the is_cancel = true attribute.
    1 point
  2. (defun c:LC nil (if (ssget "_X" '((8 . "Wall"))) (progn (prompt "\nTotal : ") (princ (sslength (ssget "_X" '((8 . "Wall"))))) (prompt " entities in Layer : \"Wall\"") ) (prompt "\nNo entities in Layer : \"Wall\"") ) (princ) )
    1 point
×
×
  • Create New...