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

0 Members and 1 Guest are viewing this topic.

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 .