Author Topic: choose display window  (Read 2816 times)

0 Members and 1 Guest are viewing this topic.

lovecraft

  • Guest
choose display window
« on: October 17, 2008, 10:13:50 AM »
Good evening,

often working on two screens and often more drawings open in the same session autocad, I wish I could when viewing drawings select designs that I want to put in a mosaic vertical or horizontal.

I know the fensyst, but using this command if I have 6 files open and I chose vertical mosaic, I put the 6 files alongside each other. what I was able to choose only 2 files for example.

Thank you to guide me in this task.

@ more

LB

ps: sorry for my English
I'm french

T.Willey

  • Needs a day job
  • Posts: 5251
Re: choose display window
« Reply #1 on: October 17, 2008, 11:26:04 AM »
I have something that is old.  Let me see if I can redo it so it's better coded.

Welcome to theSwamp, and no problem with the language.  You're english is better than my french.   :-)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: choose display window
« Reply #2 on: October 17, 2008, 06:21:35 PM »
Welcome to TheSwamp LB
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.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: choose display window
« Reply #3 on: October 20, 2008, 11:57:09 AM »
This should do what you want.  The dcl file is attached, so just place it in the search path.

Code: [Select]
(defun c:TileSelect (/ AcObj ActDoc DocCol DocList DiaRtn RtnLen HorOpt tempDoc cDocSel oWinStList)
    ; Tile selected drawings.
   
    (setq AcObj (vlax-get-Acad-Object))
    (setq ActDoc (vla-get-ActiveDocument AcObj))
    (setq DocCol (vla-get-Documents AcObj))
    (vlax-for i DocCol
        (setq DocList (cons (cons (vla-get-Name i) i) DocList))
        (setq oWinStList (cons (cons (vla-get-WindowState i) i) oWinStList))
        (while (not (equal (vlax-get i 'WindowState) 2))
            (vlax-put i 'WindowState 2)
        )
    )
    (setq DocList (vl-sort DocList '(lambda (a b) (< (car a) (car b)))))
    (if
        (and
            (> (length DocList) 1)
            (setq DiaRtn (MultiSelect (mapcar 'car DocList) "Check to tile horizontal." T))
            (if (equal (type (car DiaRtn)) 'INT)
                (> (setq RtnLen (length DiaRtn)) 1)
                (progn
                    (setq HorOpt T)
                    (setq DiaRtn (cdr DiaRtn))
                    (> (setq RtnLen (length DiaRtn)) 1)
                )
            )
        )
        (progn
            (setq HorOpt
                (if HorOpt
                    "_Horizontal"
                    "_Vertical"
                )
            )
            (foreach i DiaRtn
                (setq tempDoc (cdr (nth i DocList)))
                (if (equal tempDoc ActDoc)
                    (setq cDocSel T)
                )
                (vlax-put tempDoc 'WindowState 1)
            )
            (vlax-put ActDoc 'WindowState 1)
            (if (not cDocSel)
                (vlax-put ActDoc 'WindowState 2)
            )
            (vla-Activate ActDoc)
            (command "_.syswindows" HorOpt)
        )
        (foreach i oWinStList
            (while (not (equal (vla-get-WindowState (cdr i)) (car i)))
                (vla-put-WindowState (cdr i) (car i))
            )
        )
    )
    (princ)
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: choose display window
« Reply #4 on: October 20, 2008, 01:08:56 PM »
Hi Tim,

MultiSelect sub routine is missing.

I found it here.
Speaking English as a French Frog

T.Willey

  • Needs a day job
  • Posts: 5251
Re: choose display window
« Reply #5 on: October 20, 2008, 01:12:46 PM »
Hi Tim,

MultiSelect sub routine is missing.

I found it here.
Thanks gile.  Here it is so people don't have to go looking for it ( it is the same still ).

Code: [Select]
(defun MultiSelect (Listof Message Toggle / DiaLoad tmpStr tmpTog tmpList)

(setq DiaLoad (load_dialog "MyDialogs.dcl"))
(if (new_dialog "MultiSelect" DiaLOad)
(progn
(start_list "listbox" 3)
(mapcar 'add_list Listof)
(end_list)
(if Message
(set_tile "text1" Message)
)
(if (not Toggle)
(mode_tile "toggle1" 1)
)
(mode_tile "listbox" 2)
(action_tile "accept"
"(progn
(setq tmpStr (get_tile \"listbox\"))
(if Toggle
(setq tmpTog (get_tile \"toggle1\"))
)
(done_dialog 1)
)"
)
(action_tile "cancel" "(done_dialog 0)")
(if (= (start_dialog) 1)
(progn
(if tmpStr
(setq tmpList (read (strcat "(" tmpStr ")")))
)
(if (= tmpTog "1")
(cons T tmpList)
tmpList
)
)
)
)
)
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

lovecraft

  • Guest
Re: choose display window
« Reply #6 on: October 20, 2008, 03:50:05 PM »
Thank you very much Tim and Gile
that's exactly what I wanted
It is still too difficult for me to make this code

@+

LB



Bob Wahr

  • Guest
Re: choose display window
« Reply #7 on: October 20, 2008, 04:59:11 PM »
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn

T.Willey

  • Needs a day job
  • Posts: 5251
Re: choose display window
« Reply #8 on: October 20, 2008, 04:59:58 PM »
You're welcome LB.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.