尝试此例程,阅读例程顶部的注释以了解更多信息。
- (defun c:Test (/ doc ss i vl)
- ;; Tharwat 08.July.2014 ;;
- ;; Function to change the color of ;;
- ;; AutoCAD Tables in all layouts and ;;
- ;; Blocks as well . ;;
- ;; ----------------------------- ;;
- ;; Tables on LOCKED layers should ;;
- ;; be ignored ;;
- (defun *error* (msg)
- (and doc (vla-endundomark doc))
- (if (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")
- (princ msg)
- (princ (strcat "\n** Error: " msg " **"))
- )
- (princ)
- )
- (vla-startUndomark (setq doc (vla-get-activedocument (vlax-get-acad-object))))
- (if (ssget "_X" '((0 . "ACAD_TABLE")))
- (progn (vlax-for tbl (setq ss (vla-get-activeselectionset doc))
- (if (vlax-write-enabled-p tbl)
- (vla-put-color tbl 0)
- )
- )
- (vla-delete ss)
- )
- )
- (vlax-for bks (vla-get-blocks doc)
- (if (and (eq :vlax-false (vla-get-isxref bks)) (eq :vlax-false (vla-get-islayout bks)))
- (vlax-for bk bks
- (if (and (eq (vla-get-objectname bk) "AcDbTable") (vlax-write-enabled-p bk))
- (vla-put-color bk 0)
- )
- )
- )
- )
- (vla-regen doc AcAllviewports)
- (vla-endundomark doc)
- (princ)
- )(vl-load-com)
|