Zoom to selected

Discussion in 'AutoCAD' started by Bill Voigt, Jan 31, 2004.

  1. Bill Voigt

    Bill Voigt Guest

    I often use Quick Select to select objects for subsequent manipulation.
    However, I would like to see which items I'm about to manipulate. It would
    be very cool to have a routine that takes the list of selected objects and
    zoom or pan to each object individually. I have searched high & low for an
    existing lisp or vba routine that would perform this seemingly desirable
    function.

    Has anyone created such a function?

    It would be similar in functionality to the Zoom to button in the TextFind
    command.

    --Bill
     
    Bill Voigt, Jan 31, 2004
    #1
  2. Bill Voigt

    James Murphy Guest

    I was working on something like that but was using Object Data in Map
    instead of Qselect. I think I might have part of it at the office still. I
    gave up ont it because it was taking forever to loop thru each selection
    that I was getting. You might want to REMIND me come Monday, if your
    interested in it.

    Murph
     
    James Murphy, Jan 31, 2004
    #2
  3. Bill Voigt

    rdi Guest

    the following will zoom to the start point of a line, center of of
    circle/arc, insertion point of a block etc....
    and it will use the current zoom ratio. Pretty it up as you like.
    (command "zoom" "C" (cdr(assoc 10 ent)) "")
     
    rdi, Jan 31, 2004
    #3
  4. Bill Voigt

    CAB2k Guest

    Try this.

    (defun zoomselected (/ $acad $doc pfrst pfcnt util lll url cen)

    (setq $acad (vlax-get-acad-object)
    $doc (vla-get-activedocument $acad)
    pfrst (vla-get-PickFirstSelectionSet $doc)
    pfcnt (vla-get-count pfrst)
    util (vla-get-utility $doc)
    )

    (cond
    ((> pfcnt 0)
    (setq reponse "N"
    cmptr_next 0
    )
    (vlax-for each pfrst
    (if (= cmptr_next 0)
    (setq reponse "N")
    (setq reponse (getstring "Next(N)? "))
    )
    (if (and each (or (= reponse "N") (= reponse "n")))
    (progn
    (vla-GetBoundingBox each 'll 'ur)
    (vla-ZoomWindow $acad ll ur)
    )
    )
    (setq cmptr_next 1)
    )
    )
    ((= pfcnt 0)
    (vla-prompt
    util
    "\nNothing selected!!!"
    )
    )
    )

    (princ)
    )



    ;;; call to routine
    (defun c:zzs (/ ss)
    (vl-load-com)
    (if (not (setq ss (cadr (ssgetfirst))))
    (alert "\n Select Before calling this routine")
    (zoomselected)
    )
    (princ)
    )
     
    CAB2k, Jan 31, 2004
    #4
  5. Bill Voigt

    G. Willis Guest

    There is a command that already does this.

    I use ACAD 2002 and I recently found the FIND command. It only works with text but it will zoom instantly to each and every instance of a specified text string so you can decide if it should be changed to the new string or not. Try a common word like "typical" or "section" and then pick "zoom to" and it will zoom to one of the occurences of that string. Pick "find next" and then "zoom to" again and it will go to the next one. Very slick.

    Garth.
     
    G. Willis, Feb 2, 2004
    #5
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.