Zoom question
in Other
I have a user asking me if there is similar functionality in BricsCAD, as Autocad's "Zoom Object". I have done some digging, but have come up empty handed. Does anyone know if this is possible in BricsCAD? If so, please let me now...Thank you for your help in advance.
0
Comments
-
It would be really nice to have a 'Zoom Object' in native Bricscad. We have a 'Zoom to Object' tool in our CADPower application.
http://www.4d-technologies.com/cadpower/manual/miscellaneous_tools.htm#ZOOMENT
I can cut this out and post the Lisp code for you tomorrow on this forum. Let me know.
Regards
Rakesh Rao
http://rakeshrao.typepad.com
0 -
Thank you Rakesh, That would be most helpful!0
-
It completely slipped off my mind that I had promised to provide you guys with a Lisp code snippet to do ZOOMENT
Anyway, better late than never.
here is the code.
- Rakesh Rao
http://www.4d-technologies.com
[code];; | ---------------------------------------------------------------------------
;; | C:GT_ZoomEnt
;; | ---------------------------------------------------------------------------
;; | Function : Zoom to the extent of the selected object(s) with a 5% margin
;; | Argument :
;; | Return : None
;; | Updated : February 16, 2007
;; | ---------------------------------------------------------------------------
(defun c:ZoomEnt ( / ent ename ss Lst LL UR OS )
(setvar "CMDECHO" 0)
(vl-load-com)
(princ "\nSelect object(s) to zoom to:")
(setq OS (getvar "OSMODE"))
(setvar "OSMODE" 0)
(setq ss (ssget))
(if ss
(progn
(setq
Lst (SS_BoundingBox ss)
LL (nth 0 Lst)
UR (nth 1 Lst)
)
(command
"._Zoom" "_Window" LL UR
"._Zoom" "0.95x"
)
))
(setvar "OSMODE" OS)
(prin1)
)
;; | -----------------------------------------------------------------------------
;; | SS_BoundingBox
;; | -----------------------------------------------------------------------------
;; | Function : Returns the selection set bounding box coordinates in the form
;; | of a list of Lower Left and Upper Right points.
;; | Arguments: 'ss' - Selection Set to examine
;; | Returns : 'Lst' - is a list of LL and UR
;; | Updated : June 10, 2005
;; | e-mail : rakesh.rao@4d-technologies.com
;; | Web : www.4d-technologies.com
;; | -----------------------------------------------------------------------------
(defun SS_BoundingBox ( ss / ssl cnt llX llY urX urY ename cnt Lst LL UR _llX _llY _urX _urY )
(setq
ssl (sslength ss)
cnt 0
llX 1E20
llY 1E20
urX -1E20
urY -1E20
)
(repeat ssl
(setq
ename (ssname ss cnt)
cnt (1+ cnt)
Lst (GE_GetObjectBoundingBox ename)
LL (nth 0 Lst)
_llX (car LL)
_llY (cadr LL)
UR (nth 1 Lst)
_urX (car UR)
_urY (cadr UR)
)
(if (< _llX llX)
(setq llX _llX)
)
(if (< _llY llY)
(setq llY _llY)
)
(if (> _urX urX)
(setq urX _urX)
)
(if (> _urY urY)
(setq urY _urY)
)
)
(list (list llX llY 0.0) (list urX urY 0.0))
)
;; | ----------------------------------------------------------------------------
;; | GE_GetObjectBoundingBox
;; | ----------------------------------------------------------------------------
;; | Function : Returns the object bounding box coordinates in the form of a
;; | list of Lower Left and Upper Right points.
;; | Arguments: 'ename' - Object to examine
;; | Returns : 'Lst' - is a list of LL and UR
;; | Updated : April 28, 2000
;; | Comments : VL-function, works with AutoCAD 2000 only
;; | e-mail : rakesh.rao@4d-technologies.com
;; | Web : www.4d-technologies.com
;; | ----------------------------------------------------------------------------
(defun GE_GetObjectBoundingBox(ename / ll ur vname )
(setq vname (vlax-ename->vla-object ename))
(vla-GetBoundingBox vname 'll 'ur)
(setq
ll (vlax-safearray->list ll)
ur (vlax-safearray->list ur)
)
(vlax-release-object vname)
(list ll ur)
)
(princ "\nType 'ZoomEnt' to start")
(prin1)
[/code]0
This discussion has been closed.