That's a good start.
You might want to Zoom all layouts:
(defun zoom_all_layouts (/ lay *doc*)
(vl-load-com)
(setq *acad* (vlax-get-acad-object)
*doc* (vla-get-activedocument *acad*)
layouts (vla-get-layouts *doc*)
)
(vlax-for lay layouts ; step through layouts
(vla-put-activelayout *doc* lay) ; activate layout
(if (= (vla-get-activespace *doc*) 0) ; If in paperspace
(if (= (vla-get-mspace *doc*) :vlax-true); in mspace viewport
(vla-put-mspace *doc* :vlax-false) ; inactivate vp
) ; endif
) ;endif
(vla-zoomextents *acad*)
)
)
(defun c:zal ()
(zoom_all_layouts)
)
Or Lock all viewports:
(defun c:vplockall () ; 4/26/01
(vl-load-com)
(vlax-for lay
(vla-get-layouts
(vla-get-activedocument
(vlax-get-acad-object)
)
)
(if (eq :vlax-false (vla-get-modeltype lay))
(vlax-for ent (vla-get-block lay) ; for each ent in layout
(if (= (vla-get-objectname ent) "AcDbViewport")
(vla-put-displaylocked ent :vlax-true)
)
)
)
)
Or reset system variables:
;;; variable setting mechanism
;;; called from 'AlansAutoLoad.lsp'
;;;
;;; After setting the global variable, call the function, (vl-propagate
;;; 'globalVariable) where globalVariable is the symbol name of your global
;;; variable. This will copy the value of globalVariable into all open document
;;; namespaces and set its value in any subsequent drawings opened during the
;;; current AutoCAD session.
(defun set_vars_to_defaults (/ var)
(setq var (list
(list "angbase" 0 ) ;
(list "angdir" 0 ) ; CCW
(list "apbox" 0 ) ; Aperture box off 0
(list "aperture" 10 ) ; zone of detection
(list "aunits" 0 ) ; 0 = degrees 4 = survey
(list "auprec" 4 ) ; no od decimal places
(list "autosnap" 7 ) ;
(list "blipmode" 0 ) ; 0 = blips off
(list "chammode" 0 ) ; require 2 distances
(list "cmddia" 1 )
(list "cmdecho" 1 )
(list "coords" 1 )
(list "cursorsize" 5 ) ; size of cross
(list "dimaso" 1 ) ;
(list "dimsho" 1 )
(list "dragmode" 2 ) ; display outline
(list "dragp1" 10 )
(list "dragp2" 25 )
(list "edgemode" 1 ) ; trim to extension
(list "expert" 4 )
(list "facetres" 2 )
(list "filedia" 1 )
(list "filletrad" 0 )
(list "fillmode" 1 ) ;
(list "gridmode" 0 ) ; grid off
(list "grips" 1 ) ;
(list "gripsize" 3 ) ; grip box size
(list "highlight" 1 )
(list "insbase" (list 0 0 0)) ;
(list "isolines" 4 )
(list "limcheck" 0 ) ; 0= allow create obj outside limites
(list "lunits" 4 ) ; 4=Arch 2=decimal
(list "luprec" 5 ) ; decimal places displayed for linear
(list "maxactvp" 50 ) ; max viewport to be regenerated
(list "maxsort" 500) ; max num of layers to sort in layer manager
(list "mbuttonpan" 1) ;
(list "measurement" 0) ; English
(list "measureinit" 0) ; English
(list "mirrtext" 0 ) ; 1=mirror text 0=backwards test
(list "offsetgaptype" 0 ) ;
(list "osmode" 175 )
(list "pickadd" 1 )
(list "pickauto" 1 )
(list "pickbox" 3 ) ; the pick box size
(list "pickdrag" 0 )
(list "pickfirst" 1 )
(list "pickstyle" 1 ) ;
(list "plinegen" 0 ) ;
(list "plinetype" 2 ) ;
(list "plinewid" 0 ) ; pline width
(list "plotrotmode" 1) ; align lower left plot area with LL of paper
(list "polarmode" 1 ) ;
(list "projmode" 1 ) ;
(list "proxygraphics" 1) ;
(list "proxynotice" 1) ;
(list "proxyshow" 1) ;
(list "qtextmode" 0 ) ; 1=display box ILO text
(list "regenmode" 1 )
(list "savetime" 30 ) ; minutes between auto save 0=no auto save
(list "sdi" 0 )
(list "snapang" 0 )
(list "snapbase" (list 0 0)) ; hatch base point
(list "snapisopair" 0 )
(list "snapmode" 0 )
(list "snapstyl" 0 )
(list "snaptype" 0 )
(list "snapunit" (list 1 1))
(list "sortents" 96)
(list "splframe" 0 )
(list "textfill" 1 ) ; plot with text filled
(list "textqlty" 50 ) ; text resolution of TT font while plotting
(list "textsize" 5 ) ; default text size
(list "tooltips" 1 )
(list "trimmode" 1 )
(list "tstackalign" 1 )
(list "tstacksize" 70 )
(list "unitmode" 0 )
(list "ucsfollow" 0 )
(list "ucsicon" 0 ) ; 0=no display 3=display icon at origin
(list "worldview" 1 )
(list "visretain" 1 ) ; retain layer state
(list "zoomfactor" 10 )
)
); setq
(mapcar '(lambda (x)
(setvar(car x) (cadr x))
)
var)
(prompt "\nACADSet_Variables has set system variables to your preset values.")
(princ)
) ;; EOF
(set_vars_to_defaults)
Or how about preferance settings:
;|They're not sysvars but preference settings you can access with ActiveX
(VisualLISP). Here's a helper routine you can use to manipulate any
preference setting that can only be set to true or false. In your situation,
all the preferences you're looking for are in the Display preferences object
and they all require a regen to show the change, so here's what your calls
will look like. Hope this helps
|;
(defun limmax (value / AcadApp Doc Display Layout Margins Paper Shadow)
(if (/= (getvar "ctab") "Model")
(progn
(setq AcadApp (vlax-get-acad-object)
Doc (vla-get-ActiveDocument AcadApp)
Layout (vla-get-ActiveLayout Doc)
Display (vla-get-Display (vla-get-Preferences AcadApp))
Margins (vlax-get Display "LayoutDisplayMargins")
Paper (vlaX-get Display "LayoutDisplayPaper")
Shadow (vlaX-get Display "LayoutDisplayPaperShadow")
)
(vlax-put Display "LayoutDisplayMargins" 1)
(vlax-put Display "LayoutDisplayPaper" 1)
(vlax-put Display "LayoutDisplayPaperShadow" 1)
(redraw)
)
)
(if (and (listp value)(vl-remove-if-not 'numberp value))
(setvar "limmax" value)
)
(if Display
(progn
(vlax-put Display "LayoutDisplayMargins" Margins)
(vlax-put Display "LayoutDisplayPaper" Paper)
(vlax-put Display "LayoutDisplayPaperShadow" Shadow)
(redraw)
)
)
(getvar "limmax")
)