lisp中的函数
- (defun vpactivate ( width / ss avp)
- ;;; width [real] - viewport width for activate
- ;;; Usage
- ;;; (VPACTIVATE 199)
- ;;; Activate VIEWPORT with width 199
- ;;; Return number (for CVPORT command) VIEWPORT in layout or nil
- (vl-load-com)
- (if (setq SS (ssget "_X" (list '(0 . "VIEWPORT") '(-4 . "/=") '(68 . 1)(cons 410 (getvar "ctab")))))
- (progn
- (foreach vp (vl-remove-if (function listp)
- (mapcar (function cadr) (ssnamex ss)))
- (if (equal (cdr(assoc 40 ;_Width code. Height code - 41
- (entget vp)
- )
- )
- width
- 1e-6
- )
- (progn
- (setq avp (cdr(assoc 68 (entget vp))))
- (command "_MSPACE" "_CVPORT" avp "_PSPACE")
-
- )
- )
- )
- )
- )
- avp
- )
加载此函数并使用
- objAcad.ActiveDocument.SendCommand("(VPACTIVATE 199)" & vbCr)
199-宽度特定视口 |