;;;从AutoCAD 2013 Active Reference帮助中code Examples中提取
;;;本源代码由 xshrimp 2013.2.20 搜集整理,版权归原作者所有!


(vl-load-com)
(defun c:Example_ActiveSpace()
    ;; This example toggles the ActiveSpace property from
    ;; paper space to model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Display the current setting for TILEMODE
    (alert (strcat "TILEMODE = " (itoa (vla-get-ActiveSpace doc))))
     
    ;; Changes active document to paper space
    (vla-put-ActiveSpace doc acPaperSpace)
    (alert (strcat "TILEMODE = " (itoa (vla-get-ActiveSpace doc))))
   
    ;; Changes active document to model space
    (vla-put-ActiveSpace doc acModelSpace)
    (alert (strcat "TILEMODE = " (itoa (vla-get-ActiveSpace doc))))
)