本帖最后由 liuhe 于 2023-4-28 17:31 编辑
- (defun c:t1 ()
- (setq lst (cons "Model" (layoutlist)))
- (setq num (vl-position (getvar "ctab") lst))
- (if (= num (1- (length lst)))
- (setq num 0)
- (setq num (1+ num))
- )
- (setvar 'ctab (nth num lst))
- )
- (defun c:t2 ()
- (setq acadObj (vlax-get-acad-object)
- doc (vla-get-ActiveDocument acadObj)
- lst (list acModelSpace acPaperSpace)
- )
- (vla-put-ActiveSpace
- doc
- (nth (/ (1+ (getvar "TILEMODE")) 2) lst)
- )
- )
(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))))
)
CAD帮助自带的程序,自己改改就行了 |