SYSWINDOWS command

Discussion in 'AutoCAD' started by T.Willey, Jul 27, 2004.

  1. T.Willey

    T.Willey Guest

    I sometimes work with 10 or more drawings open. When I need to compare two drawings I tile them with the command "SYSWINDOWS", or pick the option I want from the "Window" pull-down menu.

    I was wondering if anyone knows how I can make this work better or faster. The way I was imaging it working was:
    After you start the command a dialog opens up with all the drawings listed (that are open in the current session of acad) with a toggle on the bottom for "Vertical" because I use "Horizontal" more so that would be my default.
    Then select the drawings that I want to tile.
    Right now it will tile all the drawings open, and then I have to minimize then ones I don't want to compare.

    I'm not sure how to do this, and only really need some direction, but if someone has a lisp, why reinvent the wheel. I'm willing to do the work, I'm just stumped where would I find out how to use the command "SYSWINDOWS" to my advantage, or if there is another route I have to take.

    Thanks for any suggestions,
    Tim
     
    T.Willey, Jul 27, 2004
    #1
  2. T.Willey

    jclaidler Guest

    jclaidler, Jul 27, 2004
    #2
  3. T.Willey

    T.Willey Guest

    That looks pretty cool but not big enough for me to compare drawing info.

    Thanks.
    Tim
     
    T.Willey, Jul 27, 2004
    #3
  4. T.Willey

    C Witt Guest

    not a solution, but a question..

    Does "Ctrl+Tab" not suffice?
     
    C Witt, Jul 27, 2004
    #4
  5. T.Willey

    T.Willey Guest

    For C Witt,

    Not really, because all it does is cycle through the drawings. If I only had the two open I
    was comparing, then yes that would work, but since I have 10 open I would have to cycle through all 10 to get back to the first one.
    I was looking for something that will allow me to select a couple of drawings, then it would only tile those drawings.

    I couldn't post through outlook, not sure why could just be I don't know what I'm doing there, so I posted on the web site.

    Tim

    ps. this thread is out of sync.
     
    T.Willey, Jul 27, 2004
    #5
  6. T.Willey

    T.Willey Guest

    I got it to work, but I get this error on the original drawing
    ; error: bad argument type: VLA-OBJECT nil
    I have tried all I could think of, and I still get it. If anyone can get rid of it it would be greatly appreciated. If anyone has anycomments on it please post. I don't know much about the vlax-.. functions, but I used them here, but not sure if there is a better way of doing it.

    Here is the code:

    (defun c:TileSelect(/ tx1 tx2 tx3 tx4 tx5 tx6 tx7 tx8 tx9 op1 tlng1 tlng2 nowopen newdwg)
    ;

    (setq tx3 nil
    tx4 nil
    tx5 (vla-get-documents (vlax-get-acad-object))
    nowopen (vla-get-activedocument (vlax-get-acad-object))
    )
    (vlax-for item tx5
    (setq tx3 (vla-get-name item))
    (setq tx4 (append tx4 (list tx3)))
    (while (/= (vlax-get item 'WindowState) 2)
    (vlax-put item 'WindowState 2)
    )
    (vlax-release-object item)
    )

    (if tx4
    (progn
    (setq tx4 (vl-sort tx4 '<))
    (setq op1 (load_dialog "CloseDwg.dcl"))
    (if (not (new_dialog "Cdrawings" op1))
    (exit)
    )
    (start_list "tx2" 3); clear the list
    (mapcar 'add_list tx4)
    (end_list)
    (action_tile "accept"
    "(progn
    (setq tx2 (get_tile \"tx2\"))
    (setq tx9 (get_tile \"d-save\"))
    (done_dialog 1)
    )"
    )
    (action_tile "cancel"
    "(progn
    (setq tx2 nil)
    (setq tx9 (get_tile \"d-save\"))
    (done_dialog 1)
    )"
    )
    (start_dialog)
    (if tx2
    (Tiling)
    (setq tlng2 "0")
    )
    )
    )
    (princ)

    )

    ;================================================================

    (defun Tiling()

    (setq tx7 (read (strcat "(" tx2 ")")))
    (setq tlng1 (vl-list-length tx7))
    (setq tlng2 (itoa (fix tlng1)))

    (repeat (fix tlng1)
    (setq tx6 (car tx7))
    (setq tx8 (nth tx6 tx4))
    (vlax-for item tx5
    (if (= tx8 (vla-get-name item))
    (progn
    (vlax-put item 'WindowState 1)
    (setq newdwg item)
    )
    )
    (vla-activate nowopen)
    (vlax-release-object item)
    )
    (setq tx7 (cdr tx7))
    )
    (vla-activate nowopen)
    (command "_.syswindows" "_H")
    (vlax-release-object newopen)
    (vla-activate newdwg)

    )

    Here is the dcl I used to test it (don't worry about the button on the bottom, it does nothing with this routine).


    Cdrawings : dialog{
    label = "Select Drawings";
    : row {
    : list_box {
    label = "layers";
    key = "tx2";
    width = 80;
    height = 20;
    multiple_select = true;
    }
    }
    : toggle {
    label = "Save drawing?";
    key = "d-save";
    }

    : row {
    : spacer { width = 1; }

    : button { // defines the OK button
    label = "OK";
    is_default = true;
    allow_accept = true;
    key = "accept";
    width = 8;
    fixed_width = true;
    }

    : button { // defines the Cancel button
    label = "Cancel";
    is_cancel = true;
    key = "cancel";
    width = 8;
    fixed_width = true;
    }

    : spacer { width = 1;}
    }

    }

    Thanks,
    Tim
     
    T.Willey, Jul 28, 2004
    #6
  7. T.Willey

    T.Willey Guest

    I made a couple of changes, but I still can't get it to finish right. It seems to not switch back to the original drawing I have open. I used the (vl-bb-set... to set the original drawing so that I can switch back from any drawing that is open, but it doesn't seem to work. I need it to switch back because it won't work right if it doesn't. It lags on this line "(command "_.syswindows" "_H")", but yet it still sets the drawings to be tiled horizontal.

    Any help is appreciated.
    Tim

    (defun c:TileSelect(/ tx1 tx2 tx3 tx4 tx5 tx6 tx7 tx8 tx9 op1 tlng1 tlng2 nowopen newdwg)
    ;

    (setq tx3 nil
    tx4 nil
    tx5 (vla-get-documents (vlax-get-acad-object))
    )
    (vl-bb-set 'nowopen (vla-get-activedocument (vlax-get-acad-object)))
    (vlax-for item tx5
    (setq tx3 (vla-get-name item))
    (setq tx4 (append tx4 (list tx3)))
    (while (/= (vlax-get item 'WindowState) 2)
    (vlax-put item 'WindowState 2)
    )
    )

    (if tx4
    (progn
    (setq tx4 (vl-sort tx4 '<))
    (setq op1 (load_dialog "CloseDwg.dcl"))
    (if (not (new_dialog "Cdrawings" op1))
    (exit)
    )
    (start_list "tx2" 3); clear the list
    (mapcar 'add_list tx4)
    (end_list)
    (action_tile "accept"
    "(progn
    (setq tx2 (get_tile \"tx2\"))
    (setq tx9 (get_tile \"d-save\"))
    (done_dialog 1)
    )"
    )
    (action_tile "cancel"
    "(progn
    (setq tx2 nil)
    (setq tx9 (get_tile \"d-save\"))
    (done_dialog 1)
    )"
    )
    (start_dialog)
    )
    )
    (if tx2
    (progn
    (Tiling)
    (command "_.syswindows" "_H")
    )
    )
    (princ)

    )

    ;================================================================

    (defun Tiling()

    (setq tx7 (read (strcat "(" tx2 ")")))
    (setq tlng1 (vl-list-length tx7))
    (setq tlng2 (itoa (fix tlng1)))
    (repeat (fix tlng1)
    (setq tx6 (car tx7))
    (setq tx8 (nth tx6 tx4))
    (vlax-for item tx5
    (if (= tx8 (vla-get-name item))
    (vlax-put item 'WindowState 1)
    )
    )
    (setq tx7 (cdr tx7))
    )
    (vla-activate (vl-bb-ref 'nowopen))
    (vlax-for item tx5
    (vlax-release-object item)
    )
    )
     
    T.Willey, Jul 28, 2004
    #7
  8. T.Willey

    T.Willey Guest

    Ok, I got it to work the way I want it to. Here it is if anyone wants it. Any comments are welcome.

    (defun c:TileSelect(/ tx1 tx3 tx4 tx5 tx6 tx7 tx8 tx9 op1 tlng1 nowopen newdwg choice1 nopen)
    ;

    (setq tx3 nil
    tx4 nil
    tx5 (vla-get-documents (vlax-get-acad-object))
    )
    (vl-bb-set 'nowopen (vla-get-activedocument (vlax-get-acad-object)))
    (vlax-for item tx5
    (setq tx3 (vla-get-name item))
    (setq tx4 (append tx4 (list tx3)))
    (while (/= (vlax-get item 'WindowState) 2)
    (vlax-put item 'WindowState 2)
    )
    )
    (if tx4
    (progn
    (setq tx4 (vl-sort tx4 '<))
    (setq op1 (load_dialog "CloseDwg.dcl"))
    (if (not (new_dialog "Cdrawings" op1))
    (exit)
    )
    (set_tile "choice1" "Vertical? (check box above)")
    (start_list "tx2" 3); clear the list
    (mapcar 'add_list tx4)
    (end_list)
    (action_tile "accept"
    "(progn
    (setq tx2 (get_tile \"tx2\"))
    (vl-bb-set 'tx9 (get_tile \"d-save\"))
    (done_dialog 1)
    )"
    )
    (action_tile "cancel"
    "(progn
    (setq tx2 nil)
    (vl-bb-set 'tx9 nil)
    (vlax-put (vl-bb-ref 'nowopen) 'WindowState 3)
    (done_dialog 1)
    )"
    )
    (start_dialog)
    )
    )
    (if (/= tx2 "")
    (progn
    (Tiling)
    (cond
    ((= (vl-bb-ref 'tx9) "0")
    (command "_.syswindows" "_H")
    )
    ((= (vl-bb-ref 'tx9) "1")
    (command "_.syswindows" "_V")
    )
    )
    )
    (vlax-put (vl-bb-ref 'nowopen) 'WindowState 3)
    )
    (vl-bb-set 'nowopen nil)
    (vl-bb-set 'tx9 nil)
    (princ)
    )

    ;================================================================

    (defun Tiling()

    (setq tx7 (read (strcat "(" tx2 ")")))
    (setq tlng1 (vl-list-length tx7))
    (repeat (fix tlng1)
    (setq tx6 (car tx7))
    (setq tx8 (nth tx6 tx4))
    (if (= tx8 (vla-get-name (vl-bb-ref 'nowopen)))
    (setq nopen "y")
    )
    (vlax-for item tx5
    (if (= tx8 (vla-get-name item))
    (vlax-put item 'WindowState 1)
    )
    )
    (setq tx7 (cdr tx7))
    (if (not tx7)
    (vlax-put (vl-bb-ref 'nowopen) 'WindowState 1)
    )
    )
    (vlax-for item tx5
    (vlax-release-object item)
    )
    (if (/= nopen "y")
    (vlax-put (vl-bb-ref 'nowopen) 'WindowState 2)
    (vla-activate (vl-bb-ref 'nowopen))
    )
    )

    ....dcl========================


    Cdrawings : dialog{
    label = "Select Drawings";
    : row {
    : list_box {
    label = "layers";
    key = "tx2";
    width = 80;
    height = 20;
    multiple_select = true;
    }
    }
    : toggle {
    key = "d-save";
    }
    : text {
    key = "choice1";
    }

    : row {
    : spacer { width = 1; }

    : button { // defines the OK button
    label = "OK";
    is_default = true;
    allow_accept = true;
    key = "accept";
    width = 8;
    fixed_width = true;
    }

    : button { // defines the Cancel button
    label = "Cancel";
    is_cancel = true;
    key = "cancel";
    width = 8;
    fixed_width = true;
    }

    : spacer { width = 1;}
    }

    }


    Thanks

    Tim
     
    T.Willey, Jul 30, 2004
    #8
  9. A minor style point which doesn't matter on this occasion, but would in
    some performance-critical place:
    As the order of stuff in tx4 doen't matter here (you sort it anyway), it
    would be more efficient to do this as
    (setq tx4 (cons tx3 tx4))

    - append has to copy all of tx4, cons just adds one cell to the front of
    the list.

    --
     
    Martti Halminen, Aug 5, 2004
    #9
  10. T.Willey

    T.Willey Guest

    Thanks for pointing that out, I didn't know that. I will be more aware now of that situation.

    Tim
     
    T.Willey, Aug 5, 2004
    #10
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.