leonucadomi Posted December 15, 2022 Posted December 15, 2022 hello: I use this routine to know the scale and then get inside The problem is that after I return to paper space and I try to select another window and it selects the first one can that be solved? help please. defun c:test (/) ;inicio de la rutina (setq old_err *error*)(defun *error* ( a / )(princ "") (setq *error* old_err)(princ)) (setvar "cmdecho" 0) (if (and (setq EntVP (car (entsel "\Seleccione VIEWPORT: "))) (= (cdr (assoc 0 (entget EntVP))) "VIEWPORT")) (progn (setq EscVP (vla-get-CustomScale (vlax-ename->vla-object EntVP))) (setq StrScale (rtos (/ 1 EscVP) 2 2) ) (Prompt (strcat "\nLa escala de La Ventana es 1/" StrScale)) ) ) (setq inv-vps (/ 1 EscVP)) (setvar "cmdecho" 1) (terpri) (princ EscVP) (terpri) (princ StrScale) (terpri) (command "_.MSPACE") (princ) Quote
ronjonp Posted December 15, 2022 Posted December 15, 2022 (edited) Try this .. you need to get the viewport ID ( DXF code 69 ). (defun c:test (/ *error* entvp escvp inv-vps old_err strscale) ;inicio de la rutina ;;(setq old_err *error*) ;;(defun *error* (a /) (princ "") (setq *error* old_err) (princ)) ;;(setvar "cmdecho" 0) (if (and (setq entvp (car (entsel "\Seleccione VIEWPORT: "))) (= (cdr (assoc 0 (entget entvp))) "VIEWPORT") ) (progn (setq escvp (vla-get-customscale (vlax-ename->vla-object entvp))) (setq strscale (rtos (/ 1 escvp) 2 2)) (prompt (strcat "\nLa escala de La Ventana es 1/" strscale)) ;; You need to set the viewport ID after going into floating modelspace (command "_.MSPACE") (setvar 'cvport (cdr (assoc 69 (entget entvp)))) ) ) (setq inv-vps (/ 1 escvp)) ;;(setvar "cmdecho" 1) (terpri) (princ escvp) (terpri) (princ strscale) (terpri) (princ) ) BTW .. the code you posted above is missing parenthesis so not sure how you're using it? Edited December 15, 2022 by ronjonp 1 1 Quote
leonucadomi Posted December 15, 2022 Author Posted December 15, 2022 thanks that was very helpful Quote
leonucadomi Posted December 15, 2022 Author Posted December 15, 2022 How Can I change the current viewport while in paper space? Quote
leonucadomi Posted December 15, 2022 Author Posted December 15, 2022 How can this value be changed? Quote
ronjonp Posted December 15, 2022 Posted December 15, 2022 46 minutes ago, leonucadomi said: How Can I change the current viewport while in paper space? I put a comment in the code: Quote ;; You need to set the viewport ID after going into floating modelspace What are you trying to accomplish? Quote
mhupp Posted December 15, 2022 Posted December 15, 2022 Try this. (defun c:test (/ ss escvp strscale) (setvar 'cvport 1) ;goes into PAPERSPACE automatically (if (setq ss (ssget "_+.:E:S" '((0 . "VIEWPORT")))) ;only allows you to pick a viewport (progn (setq escvp (vla-get-customscale (setq vp (vlax-ename->vla-object (ssname SS 0)))) strscale (rtos (/ 1 escvp) 2 2) ) ;; You need to set the viewport ID after going into floating modelspace (setvar 'cvport (cdr (assoc 69 (entget (ssname SS 0))))) (prompt (strcat "\nLa escala de La Ventana es 1/" strscale " = " (rtos escvp 2))) ) ) (princ) ) 1 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.