zoom extent to an object

Discussion in 'AutoCAD' started by Odie Silva, Jan 5, 2004.

  1. Odie Silva

    Odie Silva Guest

    Hi all.

    I wrote a routine that asks you to select a closed polyline. The thing is
    if I have the square (ex.) that is fully within the view frame it works
    fine,
    but if I zoom in and have only a corner of the square in view it sometimes
    malfunctions because some processing, such as block placement and other
    things
    occur outside the screen view.

    I could zoom extend the whole drawing, run it and set to previous view but
    I think it could be done more elegantely by bringing the object to a center
    view
    something lime extrim in Express Tools.

    Any suggestions?

    TIA

    Odie
     
    Odie Silva, Jan 5, 2004
    #1
  2. Odie Silva

    Mark Propst Guest

    ;written 1-5-04 for Odie Silva
    (defun C:zto( / ent );zoom to object
    (setq ent(car(entsel"nPick object to zoom to... ")))
    (ZoomToObject ent)
    )
    (defun ZoomToObject (ent / bbx)
    (setq bbx(GetBoundingBox ent))
    (command "zoom" "w" (car bbx)(cadr bbx))
    (princ)
    )
    ;get boundingbox of entity
    (defun GetBoundingBox (ent / ll ur)
    (VL-LOAD-COM)
    (vla-getboundingbox (vlax-ename->vla-object ent) 'll 'ur)
    (mapcar 'vlax-safearray->list (list ll ur))
    )
     
    Mark Propst, Jan 5, 2004
    #2
  3. Odie Silva

    Odie Silva Guest

    Thanks MArk,

    I thing that will do it :)

    Odie


     
    Odie Silva, Jan 5, 2004
    #3
  4. Odie Silva

    Mark Propst Guest

    You're welcome
    :)~
     
    Mark Propst, Jan 5, 2004
    #4
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.