0 Members and 1 Guest are viewing this topic.
Had few minutes today to write this routine and saved it to my Toolbox .
Quote from: Tharwat on July 16, 2014, 09:17:50 AMHad few minutes today to write this routine and saved it to my Toolbox . Nice but perhaps the dialog box width should be dynamic.
hi jbuzbee .This files is not working to my autocad. I dont have open dcl and i dont use it. Can you update Tharwat codeThanks
(defun c:dwgs (/ *error* dlg f i id lst nm obj w x) ;; Tharwat 16.June.2014 ;; ;; Cycle through drawings ;; (defun *error* (msg) (if (and dlg (setq dlg (findfile dlg))) (vl-file-delete dlg) ) (if (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*") (princ msg) (princ (strcat "\n ** Error : " msg " **")) ) ) (setq obj (vlax-get-acad-object)) (vlax-for dwg (vla-get-documents obj) (if (and (/= "" (setq nm (vla-get-name dwg))) (not (eq (getvar 'dwgname) nm))) (setq lst (cons (cons nm dwg) lst)) ) ) (if lst (progn (setq w (apply 'max (mapcar '(lambda (x) (strlen x)) (mapcar 'car lst)))) (if (and (setq dlg (vl-filename-mktemp nil nil ".dcl")) (setq f (open dlg "w"))) (progn (write-line (strcat "test : dialog { label = \"All opened drawings\"; width =" (if (> w 90) "90" (itoa (+ 2 w)) ) ;; RJP mod allow_accept ";" ": list_box { label = \"Opened drawings\"; key = \"dwgs\"; height = 16; allow_accept = true;}" ": row { alignment = centered; fixed_width = true;" ": button { label = \"Okay\"; key = \"oki\"; is_default = true; width = 10;}" ": button { label = \"Exit\"; key = \"esc\"; is_cancel = true; width = 10; }}}" ) f ) (close f) ) (alert "Can't load the temporary file <!>") ) (if (not (new_dialog "test" (setq id (load_dialog dlg)) "")) (progn (if (>= id 0) (unload_dialog id) ) (if (and dlg (setq dlg (findfile dlg))) (vl-file-delete dlg) ) ) (progn (start_list "dwgs") (mapcar 'add_list (mapcar 'car lst)) (end_list) (set_tile "dwgs" "0") (action_tile "oki" "(setq i (atoi (get_tile \"dwgs\")))(done_dialog)") (action_tile "esc" "(done_dialog)") (start_dialog) (unload_dialog id) (vl-file-delete dlg) ) ) ;; RJP mod to use vla-activate (and i (vla-activate (nth i (mapcar 'cdr lst)))) ) (alert "No opened named drawings to cycle through !!") ) (princ))(vl-load-com)
Because I'm bored here you go, but you really need to start trying to learn some of this stuff.....
QuoteBecause I'm bored here you go, but you really need to start trying to learn some of this stuff.....Don't hold your breath....