I am trying to write a lisp that sets the viewport scale based on a menu choice.
Is there a way to prompt the user for which viewport to activate?
For instance, if there are 2 viewports on the paperspace layout and one has to be 1/4" and the other 1/8". Can it be done in lisp so that the lisp stops and lets the user chose which viewport to activate, switch to that viewport, then continue with changing the zoom factor?
Not sure why you don't want to just use change porperties, and no I don't have a lisp that will do exactly that BUT if you're feeling like a challenge and want to have a go at writing your own here are some clues...
You don't need to switch from PS to MS or from viewport to viewport to change or set the scale, unless of course you really want to??
;;;to get the scale of the psviewports
;;;create a selection set of the viewports on the current layout tab only
(setq SS (ssget "X" (list '(0 . "VIEWPORT")(cons 410 (getvar "ctab")))))
;get the scale of the first viewport in the selection set
(setq VP_SC (/ 1 (vla-get-customscale (vlax-ename->vla-object (ssname SS 0)))))
;set the scale of the first viewport in the selection set
(vla-put-customscale (vlax-ename->vla-object (ssname SS 0)) (/ 1.0 VP_SC))
;highlight the viewport
(redraw (ssname SS 0) 3)
;un-highlight the viewport
(redraw (ssname SS 0) 4)
;number of viewports on current layout tab including Paper space!