本帖最后由 作者 于 2007-1-18 9:18:24 编辑
;;Test R2005 ;;要先加載Thumbnailer.arx ;;改XREF--->圖層名稱 & 增加"LUCAS"圖層 & 改所有空間物件為紅色 (defun C:TT (/ APP BNAME DBXDOC DOC DWGNAME LAYERS) (vl-load-com) (defun SAVEASEX (DBXDOC DWGNAME) (vlax-invoke-method (vla-getinterfaceobject (vlax-get-acad-object) "Thumbnailer.Application" ) 'PRESERVETHUMBNAIL (vlax-get-property DBXDOC 'DATABASE) ) (vlax-invoke-method DBXDOC 'SAVEAS DWGNAME) ) (if (vlax-property-available-p (setq DWGNAME (vlax-ename->vla-object (car (entsel "\nSelect Xref: ")) ) ) 'PATH ) (progn (setq APP (vlax-get-acad-object)) (setq DOC (vla-get-activedocument APP)) (setq DBXDOC (vla-getinterfaceobject APP (strcat "ObjectDBX.AxDbDocument." (substr (getvar "ACADVER") 1 2) ) ) ) (setq BNAME (vla-item (vla-get-blocks DOC) (vla-get-name DWGNAME)) ) (setq DWGNAME (vla-get-path DWGNAME)) (vla-open DBXDOC DWGNAME) (vlax-for BLK (vla-get-blocks DBXDOC) (if (= :vlax-true (vla-get-islayout BLK)) (vlax-for OBJ BLK (vla-put-color OBJ 1) ) ) ) (vlax-for LAY (setq LAYERS (vla-get-layers DBXDOC)) (if (/= "0" (vla-get-name LAY)) (vla-put-name LAY (strcat (vla-get-name LAY) "-lai")) ) ) (vla-add LAYERS "LUCAS") (if (> (atoi (getvar "AcadVer")) 15) (SAVEASEX DBXDOC DWGNAME) (vla-saveas DBXDOC DWGNAME) ) (vla-reload BNAME) (mapcar 'vlax-release-object (list APP DOC DBXDOC LAYERS)) ) ) (princ) ) |