zoom extent to an object

Odie Silva

Usenet Archive
Joined
Jul 21, 2003
Messages
25
Reaction score
0
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
 
;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))
)
 
Thanks MArk,

I thing that will do it :)

Odie

Mark Propst said:
;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))
)
 

Latest threads

Back
Top