@ВeekeeCZ wrote:
....
(command "_.zoom" "_w"
(list (car (getvar 'extmin)) (cadr (getvar 'viewctr)))
(list (car (getvar 'extmax)) (cadr (getvar 'viewctr))))
....
That will be centered vertically on the center of the current view area at the time, not on the center of the drawn extents. Maybe that's appropriate. But if what's wanted is to be centered on the drawn extents, I would try something like this [untested]:
(command "_.zoom" "_extents") ; [to reset EXTMIN/EXTMAX in case extents have been reduced]
(setq
LL (getvar 'extmin)
UR (getvar 'extmax)
midY (mapcar '/ (mapcar '+ (cadr LL) (cadr UR)) '(2 2 2))
); setq
(command "_.zoom" "_none" (list (car LL) midY) "_none" (list (car UR) midY))
Read in Help for EXTMIN/EXTMAX about why you may need the Zoom Extents to reset them.
[And note that if you're Zooming to a window, that's the default operation, and you don't need to spell out the "_w" as an option. Also, I threw in "_none" Osnap calls on the window points, just in case running Osnap might affect them.]
Kent Cooper, AIA