;;;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 St. ;;;> Southern Pines, NC 28387 ;;;> http://paracadd.com ;;;> All rights reserved. ;;; ;;;> COPYRIGHT: 12/15/2004 ;;;> EDITED: 06-15-2006 ;;; (DEFUN gvpno (/ curvno cvpss cvpent cvpename cvplay lnccnt) ;;; (IF (OR (NOT LAYOUTLIST) (IF LAYOUTLIST (=(LENGTH(LAYOUTLIST))1))) (PROGN (IF uint NIL (LOAD "uint" "\nFile UINT.LSP not loaded! ")) (IF ukword NIL (LOAD "ukword" "\nFile UKWORD.LSP not loaded! ")) (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 410 (GETVAR "CTAB"))(CONS 69 curvno)))) (SETQ cvpent (ENTGET (SSNAME cvpss 0))) (SETQ cvpename (CDR (ASSOC -1 cvpent))) (SETQ cvplay (CDR (ASSOC 8 cvpent))) (IF (WCMATCH (STRCASE cvplay) "??VI##*") (PROGN (SETQ lnccnt 1) (WHILE (NOT (WCMATCH (SETQ vp_str (STRCASE (SUBSTR cvplay lnccnt))) "VI##*")) (SETQ lnccnt (1+ lnccnt)) ) ;_ end of while (SETQ prod (SUBSTR vp_str 1 4)) (SETQ mjrg (SUBSTR cvplay 1 1)) (SETQ viewno (ATOI (SUBSTR vp_str 3 2))) ) ;_ end of progn (PROGN (SETQ viewno (uint 1 "" "View number? " viewno)) (IF (< viewno 10) (SETQ prod (STRCAT "VI0" (ITOA viewno))) (SETQ prod (STRCAT "VI" (ITOA viewno))) ) ;_ end of if (IF (WCMATCH (STRCASE (SUBSTR (GETVAR "dwgname") 1 1)) "[A C E F G I L M O P Q S T Z]") (SETQ vplmjr (STRCASE (SUBSTR (GETVAR "dwgname") 1 1))) (SETQ vplmjr "G") ) ;_ end of if (SETQ fixvpl (ukword 1 "Yes No" (STRCAT "Change viewport layer to " vplmjr "-" prod "7NPLT") "Yes")) (IF (EQ fixvpl "Yes") (PROGN (COMMAND "-layer" "m" (STRCAT vplmjr "-" prod "7nplt") "") (COMMAND ".pspace") (COMMAND ".chprop" cvpename "" "la" (STRCAT vplmjr "-" prod "7nplt") "") (COMMAND ".mspace") ) ;_ end of progn ) ;_ end of if ) ;_ end of progn ) ;_ end of if ) ;_ end of progn (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") ;;; ) ) ;_ end of progn ) ;if ; (if prod nil ; (setq prod "PLAN") ; ) ) ;_ end of PROGN ;;; (PROGN (PRINC "\nMore than one layout present. Viewport layer cannot be determined.")(PRINC)) ;;; ) ;_ end of if (PRINC) ) ;_ end of defun (DEFUN C:VIEWNO (/ cvpss cvpent cvpename fixvpl viewno) ;;; (IF (OR (NOT LAYOUTLIST) (IF LAYOUTLIST (=(LENGTH(LAYOUTLIST))1))) (PROGN (SETQ cvpss (SSGET "X" (LIST (CONS 410 (GETVAR "CTAB"))(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))) ) ;_ end of if (IF (WCMATCH (STRCASE (SUBSTR (GETVAR "dwgname") 1 1)) "[A C E F G I L M O P Q S T Z]") (SETQ vplmjr (STRCASE (SUBSTR (GETVAR "dwgname") 1 1))) (SETQ vplmjr "G") ) ;_ end of if (SETQ fixvpl (ukword 1 "Yes No" (STRCAT "Change viewport layer to " vplmjr "-" prod "7NPLT") "Yes")) (IF (EQ fixvpl "Yes") (PROGN (COMMAND "-layer" "m" (STRCAT vplmjr "-" prod "7nplt") "") (COMMAND ".pspace") (COMMAND ".chprop" cvpename "" "la" (STRCAT vplmjr "-" prod "7nplt") "") (COMMAND ".mspace") ) ;_ end of progn ) ;_ end of if ) ;_ end of progn ) ;_ end of PROGN ;;; (PROGN (PRINC "\nMore than one layout present. Viewport layer checking aborted.")(PRINC)) ;;; ) ;_ end of IF ) ;_ end of DEFUN ;|«Visual LISP© Format Options» (120 2 15 2 T "end of " 100 9 2 0 nil nil nil T T) ;*** DO NOT add text below the comment! ***|;