;Get current user specified (by layername) model space viewport number. ; ;Layer name must contain "VI##" where ## is a two digit user specified ;view number. Otherwise you are prompted for the view number. ;the variable prod is set to "VI##". (C:MKLAYR) is used to preserve and ;then restore the current layer after this function. Use (C:SVLAYR) before ;this function, (C:MKLAYER) during this function and (C:RSLAYR) after. ;If the current space is Paper space then prod is not set. ; ; Author: ; Henry C. Francis ; 425 N. Ashe Street ; Southern Pines, NC 28387 ; ; http://www.pinehurst.net/~pfrancis ; e-mail hfrancis@pinehurst.net ; All rights reserved. ; ; (defun gvpno ( / curvno cvpss cvpent cvpename cvplay lnccnt) (setq viewno nil) (setq curvno (getvar"cvport")) (if(and(> curvno 1)(eq(getvar"tilemode")0)) (progn (setq as_67 0) (setq cvpss (ssget "X" (list(cons 69 curvno)))) (setq cvpent (entget (ssname cvpss 0))) (setq cvpename (cdr(assoc -1 cvpent))) (setq cvplay (cdr(assoc 8 cvpent))) (if (wcmatch cvplay "*VI##7NPLT") (progn (setq lnccnt 1) (while (not (wcmatch(setq vp_str (substr cvplay lnccnt))"VI##*")) (setq lnccnt (1+ lnccnt)) ) (setq prod (substr vp_str 1 4)) (setq viewno (atoi(substr vp_str 3 2))) ) (progn (setq viewno (uint 1 "" "View number? " viewno)) (if (< viewno 10) (setq prod (strcat "VI0"(itoa viewno))) (setq prod (strcat "VI"(itoa viewno))) ) (setq fixvpl (ukword 1 "Yes No" (strcat "Change viewport layer to C-" prod "7NPLT") "Yes")) (if (eq fixvpl "Yes") (progn (command "-layer" "m" (strcat "c-" prod "7nplt") "") (command ".pspace") (command ".chprop" cvpename "" "la" (strcat "c-" prod "7nplt") "") (command ".mspace") ) ) ) ) ) (progn (setq as_67 1) (if (eq(getvar"tilemode")0) (princ "\nYou are in Paper space. Please put viewport annotation in model space.") (princ "\nYou are in Model space, Paper space is not active") ) ) );if ; (if prod nil ; (setq prod "PLAN") ; ) (princ) ) (DEFUN C:VIEWNO ( / cvpss cvpent cvpename fixvpl viewno) (setq cvpss (ssget "X" (list(cons 69 curvno)))) (setq cvpent (entget (ssname cvpss 0))) (setq cvpename (cdr(assoc -1 cvpent))) (progn (setq viewno (uint 1 "" "View number? " viewno)) (if (< viewno 10) (setq prod (strcat "VI0"(itoa viewno))) (setq prod (strcat "VI"(itoa viewno))) ) (setq fixvpl (ukword 1 "Yes No" (strcat "Change viewport layer to C-" prod "7NPLT") "Yes")) (if (eq fixvpl "Yes") (progn (command "-layer" "m" (strcat "c-" prod "7nplt") "") (command ".pspace") (command ".chprop" cvpename "" "la" (strcat "c-" prod "7nplt") "") (command ".mspace") ) ) ) )