Author Topic: open drawings list box  (Read 6117 times)

0 Members and 1 Guest are viewing this topic.

pedroantonio

  • Guest
open drawings list box
« 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 ....

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: open drawings list box
« Reply #1 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
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: open drawings list box
« Reply #2 on: July 15, 2014, 12:58:08 PM »
Or use the various window controls located on the User Interface panel of the View tab:


ronjonp

  • Needs a day job
  • Posts: 7526
Re: open drawings list box
« Reply #3 on: July 15, 2014, 01:36:33 PM »
Or cycle with ctrl+tab.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: open drawings list box
« Reply #4 on: July 15, 2014, 01:48:39 PM »
I cycle  8)
Program the mouse side buttons for forward & back one drawing.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

pedroantonio

  • Guest
Re: open drawings list box
« Reply #5 on: July 15, 2014, 01:54:59 PM »
Thanks

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: open drawings list box
« Reply #6 on: July 15, 2014, 02:41:54 PM »
2015 has extra tabs, similar to layouts, but for drawing files.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

pedroantonio

  • Guest
Re: open drawings list box
« Reply #7 on: July 15, 2014, 03:06:43 PM »
i am using Autocad 2010

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

kraz

  • Guest
Re: open drawings list box
« Reply #9 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

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: open drawings list box
« Reply #10 on: July 15, 2014, 11:02:02 PM »
KRAZ
Bad link for me, I get
403 - Forbidden
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

kraz

  • Guest
Re: open drawings list box
« Reply #11 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/

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: open drawings list box
« Reply #12 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.  
« Last Edit: July 16, 2014, 10:56:42 AM by Tharwat »

GDF

  • Water Moccasin
  • Posts: 2081
Re: open drawings list box
« Reply #13 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.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: open drawings list box
« Reply #14 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 :-)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: open drawings list box
« Reply #15 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.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Keith Brown

  • Swamp Rat
  • Posts: 601
Re: open drawings list box
« Reply #16 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.
Keith Brown | AutoCAD MEP Blog | RSS Feed
AutoCAD MEP 2014 / Revit MEP 2014 / EastCoast CAD/CAM addon / Visual Studio 2013

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: open drawings list box
« Reply #17 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 .

pedroantonio

  • Guest
Re: open drawings list box
« Reply #18 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

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: open drawings list box
« Reply #19 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.

« Last Edit: July 18, 2014, 08:20:47 AM by jbuzbee »
James Buzbee
Windows 8

pedroantonio

  • Guest
Re: open drawings list box
« Reply #20 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

ronjonp

  • Needs a day job
  • Posts: 7526
Re: open drawings list box
« Reply #21 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)
« Last Edit: July 16, 2014, 03:39:13 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

pedroantonio

  • Guest
Re: open drawings list box
« Reply #22 on: July 16, 2014, 02:46:57 PM »
Thank you ronjonp

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: open drawings list box
« Reply #23 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....

ronjonp

  • Needs a day job
  • Posts: 7526
Re: open drawings list box
« Reply #24 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

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: open drawings list box
« Reply #25 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 .