TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: pedroantonio on July 15, 2014, 11:52:06 AM

Title: open drawings list box
Post by: pedroantonio on July 15, 2014, 11:52:06 AM
is it possible to manage open drawings with a lost box lisp? if i have 10 open drawings in my autocad i have to go to window menu and select which drawing i want to use.Is it possible to display the names of the open drawings in a list box with an OK button and sellect any time the drawings i whant to use ?

Sorry for my bad English

Thanks ....
Title: Re: open drawings list box
Post by: Kerry on July 15, 2014, 12:45:16 PM

On the Main menu Bar ; Select window. ( between Modify and Help on my menu)
If the file you want is not in the list, select More Windows ...

or Alt+W+M
Title: Re: open drawings list box
Post by: Lee Mac on July 15, 2014, 12:58:08 PM
Or use the various window controls located on the User Interface panel of the View tab:

(http://lee-mac.com/swamp/windowcontrols.png)
Title: Re: open drawings list box
Post by: ronjonp on July 15, 2014, 01:36:33 PM
Or cycle with ctrl+tab.
Title: Re: open drawings list box
Post by: CAB on July 15, 2014, 01:48:39 PM
I cycle  8)
Program the mouse side buttons for forward & back one drawing.
Title: Re: open drawings list box
Post by: pedroantonio on July 15, 2014, 01:54:59 PM
Thanks
Title: Re: open drawings list box
Post by: dgorsman on July 15, 2014, 02:41:54 PM
2015 has extra tabs, similar to layouts, but for drawing files.
Title: Re: open drawings list box
Post by: pedroantonio on July 15, 2014, 03:06:43 PM
i am using Autocad 2010
Title: Re: open drawings list box
Post by: V-Man on July 15, 2014, 04:08:40 PM
Try....

http://autodesk.blogs.com/between_the_lines/2009/04/autocad-free-bonus-tool-drawing-tabs-mditabs.html (http://autodesk.blogs.com/between_the_lines/2009/04/autocad-free-bonus-tool-drawing-tabs-mditabs.html)
Title: Re: open drawings list box
Post by: kraz on July 15, 2014, 09:53:35 PM
Maybe, You want this one...
since acad 2012? or 2013, autocad has filetab function.

I had used bellow arx tool and is very nice...

download and rename the file name:: "iDwgTab2.0.0.6.renameTozip -> iDwgTab2.0.0.6.zip"

http://pds25.egloos.com/pds/201405/16/51/iDwgTab2.0.0.6.renameTozip
Title: Re: open drawings list box
Post by: CAB on July 15, 2014, 11:02:02 PM
KRAZ
Bad link for me, I get
403 - Forbidden
Title: Re: open drawings list box
Post by: kraz on July 16, 2014, 07:57:37 AM
KRAZ
Bad link for me, I get
403 - Forbidden

hmm...
attached the file...
this arx from http://arx119.egloos.com/
Title: Re: open drawings list box
Post by: Tharwat on July 16, 2014, 09:17:50 AM
Had few minutes today to write this routine and saved it to my Toolbox .  :wink:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:dwgs (/ *error* f id lst v dlg nm i obj cn w)
  2.   ;;    Tharwat 16.June.2014            ;;
  3.   ;; Cycle through drawings             ;;
  4.   (defun *error* (msg)
  5.     (if (and dlg (setq dlg (findfile dlg)))
  6.       (vl-file-delete dlg)
  7.     )
  8.     (if (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")
  9.       (princ msg)
  10.       (princ (strcat "\n ** Error : " msg " **"))
  11.     )
  12.   )
  13.   (setq cn
  14.          (vla-get-fullname
  15.          )
  16.   )
  17.     (if (and (/= "" (setq nm (vla-get-fullname dwg)))
  18.              (not (eq cn nm))
  19.         )
  20.       (setq lst (cons nm lst))
  21.     )
  22.   )
  23.   (if lst
  24.     (progn
  25.       (setq w (apply 'max (mapcar '(lambda (x) (strlen x)) lst)))
  26.       (if (and (setq dlg (vl-filename-mktemp nil nil ".dcl"))
  27.                (setq f (open dlg "w"))
  28.           )
  29.         (progn
  30.           (write-line
  31.             (strcat
  32.               "test : dialog { label = \"All opened drawings\"; width ="
  33.               (if (> w 90)
  34.                 "90"
  35.                 (itoa (+ 2 w))
  36.               )
  37.               ";"
  38.               ": list_box { label = \"Opened drawings\"; key = \"dwgs\"; height = 16;}"
  39.               ": row { alignment = centered; fixed_width = true;"
  40.               ": button { label = \"Okay\"; key = \"oki\"; is_default = true; width = 10;}"
  41.               ": button { label = \"Exit\"; key = \"esc\"; is_cancel = true; width = 10; }}}"
  42.             )
  43.             f
  44.           )
  45.           (close f)
  46.         )
  47.         (alert "Can't load the temporary file <!>")
  48.       )
  49.       (if (not (new_dialog
  50.                  "test"
  51.                  (setq id (load_dialog dlg))
  52.                  ""
  53.                )
  54.           )
  55.         (progn (if (>= id 0)
  56.                  (unload_dialog id)
  57.                )
  58.                (if (and dlg (setq dlg (findfile dlg)))
  59.                  (vl-file-delete dlg)
  60.                )
  61.         )
  62.         (progn
  63.           (start_list "dwgs")
  64.           (mapcar 'add_list lst)
  65.           (end_list)
  66.           (set_tile "dwgs" "0")
  67.           (action_tile
  68.             "oki"
  69.             "(setq i (atoi (get_tile \"dwgs\")))(done_dialog)"
  70.           )
  71.           (action_tile "esc" "(done_dialog)")
  72.           (start_dialog)
  73.           (unload_dialog id)
  74.           (vl-file-delete dlg)
  75.         )
  76.       )
  77.       (if i
  78.         (vlax-for x (vla-get-documents obj)
  79.           (if (eq (vla-get-fullname x) (nth i lst))
  80.             (vla-put-windowstate x acMax)
  81.             (vla-put-windowstate x acMin)
  82.           )
  83.         )
  84.       )
  85.     )
  86.     (alert "No opened named drawings to cycle through !!")
  87.   )
  88.   (princ)
  89. )
  90.  
Title: Re: open drawings list box
Post by: GDF on July 16, 2014, 10:07:55 AM
Nice one Tharwat. This one by:

;;; Written By Peter Jamtgaard Copyright April 2003
;;; Activate drawing dialog control program that uses a tree structure for
;;; display of the filenames

I like the tree structure. I will need to get permission to post his routine. The routine uses Visual Basic which is no longer installed with AutoCAD.
Title: Re: open drawings list box
Post by: Tharwat on July 16, 2014, 10:30:04 AM
Nice one Tharwat.


Thank you for the feed back GDF and I am happy that you like it :-)
Title: Re: open drawings list box
Post by: CAB on July 16, 2014, 10:41:30 AM
Had few minutes today to write this routine and saved it to my Toolbox .  ;)

Nice but perhaps the dialog box width should be dynamic.
Title: Re: open drawings list box
Post by: Keith Brown on July 16, 2014, 10:53:18 AM
I set my Taskbar variable to 1 so that each open drawing will show up as a separate window on the taskbar.
Title: Re: open drawings list box
Post by: Tharwat on July 16, 2014, 10:58:55 AM
Had few minutes today to write this routine and saved it to my Toolbox .  ;)

Nice but perhaps the dialog box width should be dynamic.

Thank you CAB , codes updated to be dynamic with the width .
Title: Re: open drawings list box
Post by: pedroantonio on July 16, 2014, 02:13:45 PM
nice job Tharwat but my paths of dwg is still be to big. I use your updated code but i still have problem. Can you help

Thanks
Title: Re: open drawings list box
Post by: jbuzbee on July 16, 2014, 02:20:48 PM
Attached is an OpenDCL version.  You must have the OPenDCL Runtime installed.  This is a sample program:

AutoCAD palette with drawing preview

Commands_DwgManager.lsp updated to include (command "OpenDCL") call.

(http://i1275.photobucket.com/albums/y445/jbuzbee_kbstudio/DWGManager_zpsc7b547b0.jpg)
Title: Re: open drawings list box
Post by: pedroantonio on July 16, 2014, 02:26:36 PM
hi jbuzbee .This files is not working to my autocad. I dont have open dcl and i dont use it. Can you update Tharwat code

Thanks
Title: Re: open drawings list box
Post by: ronjonp on July 16, 2014, 02:41:51 PM
hi jbuzbee .This files is not working to my autocad. I dont have open dcl and i dont use it. Can you update Tharwat code

Thanks


Because I'm bored here you go, but you really need to start trying to learn some of this stuff.....

Code: [Select]
(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)
Title: Re: open drawings list box
Post by: pedroantonio on July 16, 2014, 02:46:57 PM
Thank you ronjonp
Title: Re: open drawings list box
Post by: snownut2 on July 16, 2014, 02:56:09 PM
Quote
Because I'm bored here you go, but you really need to start trying to learn some of this stuff.....

Don't hold your breath....
Title: Re: open drawings list box
Post by: ronjonp on July 16, 2014, 03:14:14 PM
Quote
Because I'm bored here you go, but you really need to start trying to learn some of this stuff.....

Don't hold your breath....


I'm not... :P
Title: Re: open drawings list box
Post by: Tharwat on July 16, 2014, 03:21:01 PM
Thank you ron for the adds , nicely done .

I have seen the last request from the OP but I had to have my shower before I come back to it .  :lol:

Regards .