- ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ;将文件中全部外部参照归置于"0-0-参照图层"图层
- ;命令:XCC
- ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- (Defun C:XCC ( )
- (vl-load-com)
- ;--------------------------------------------------------------------------------------
- (setq Nme (getstring "\n请输入图层名称:<0-0-参照图层>"))
- (if (or (= 33 (ascii Nme))(= 0 (ascii Nme)))
- (setq Nme "0-0-参照图层")
- )
- (if (= (tblsearch "layer" Nme) nil)
- (entmake (list
- '(0 . "LAYER")
- '(100 . "AcDbSymbolTableRecord")
- '(100 . "AcDbLayerTableRecord")
- '(70 . 4)
- '(290 . 1)
- (cons 2 Nme)
- (cons 62 8)
- )
- )
- )
- (setvar "clayer" Nme)
- (if (setq ss (ssget "x" '((0 . "insert"))))
- (progn
- (setq sl (sslength ss))
- (while (setq e (ssname ss (setq sl (1- sl))))
- (if (vlax-property-available-p
- (setq obj (vlax-ename->vla-object e))
- 'Path
- )
- (progn
- (vl-catch-all-apply 'vla-put-layer (list obj Nme))
- ;(print (vla-get-name obj))
- )
- )
- )
- )
- )
-
- ;--------------------------------------------------------------------------------------
- (prin1)
- )
- ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|