TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: lovecraft 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
-
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. :-)
-
Welcome to TheSwamp LB
-
This should do what you want. The dcl file is attached, so just place it in the search path.
(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)
)
-
Hi Tim,
MultiSelect sub routine is missing.
I found it here (http://www.theswamp.org/index.php?topic=25353.msg305492#msg305492).
-
Hi Tim,
MultiSelect sub routine is missing.
I found it here (http://www.theswamp.org/index.php?topic=25353.msg305492#msg305492).
Thanks gile. Here it is so people don't have to go looking for it ( it is the same still ).
(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
)
)
)
)
)
)
-
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
-
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn
-
You're welcome LB.