;;;CADALYST TIPS & TOOLS WEEKLY 05/15/06 (c) 2006 Cliff Middleton ;Local variables auto-written on 10/17/2005 08:13:00 AM ;________________________________________________________________________________________________________________________________ ;Sets document window size (defun c:ssz ( / *error* cmdecho width height screensize diffwidth diffheight $width $height) (defun *error* (msg) (if (not (member msg '("console break" "Function cancelled" "quit / exit abort" ""))) (progn (princ (strcat "\nError: " msg)) (if *debug* (vl-bt)) ) ) (if cmdecho (setvar "cmdecho" cmdecho)) ) (setq SCRWIDTH (if SCRWIDTH SCRWIDTH 640) SCRHEIGHT (if SCRHEIGHT SCRHEIGHT 480) cmdecho (getvar "cmdecho") ) (if (and (get_int 'SCRWIDTH "Width in pixels") (get_int 'SCRHEIGHT "Height in pixels") ) (progn (setq width (vla-get-width (active-document)) ;DOCUMENT WINDOW SIZE INCLUDING FRAME height (vla-get-height (active-document)) screensize (getvar "screensize") ;DOCUMENT WINDOW SIZE DRAWING AREA ONLY diffwidth (- width (fix (car screensize))) diffheight (- height (fix (cadr screensize))) $width (itoa (+ SCRWIDTH diffwidth)) $height (itoa (+ SCRHEIGHT diffheight)) ) (setvar "cmdecho" 0) (command "._VBASTMT" (strcat "Application.ActiveDocument.Width = " $width)) (command "._VBASTMT" (strcat "Application.ActiveDocument.Height = " $height)) ) ) (*error* "") (princ) ) (defun get_int (varname prompt-string / val default temp) (setq val (eval varname) default (if (= (type val) 'INT) (itoa val) "") ) (set varname (if (null (setq temp (getint (strcat "\n" prompt-string " <" default ">: ")))) val temp)) )