- (defun c:NL()
- (setq lay_name (getstring "\n输入要新建的图层名称:"))
- (if (tblsearch "LAYER" lay_name)
- (progn
- (princ "\n该图层已存在!")
- (c:NL)
- )
- (progn
- (setq lay_cor (abs (cdr(assoc 62 (tblnext"layer" t)))))
- (setq cor_list nil)
- (while lay_cor
- (setq cor_list (vl-list* lay_cor cor_list))
- (if (setq lay_cor (cdr (assoc 62 (tblnext"layer"))))
- (setq lay_cor (abs lay_cor)))
- )
- (setq cor 1)
- (while (member cor cor_list)
- (setq cor (1+ cor))
- )
- (if (> cor 255)
- (progn
- (princ "\n您的图层颜色过多,已按255色建层")
- (setq cor 255)))
- (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") '(70 . 0) '(6 . "Continuous")(cons 62 cor)
- (cons 2 lay_name)
- )
- )
- (command "clayer" lay_name)
- (princ "\n已新建图层<<")
- (princ lay_name)
- (princ ">>并切换成当前图层")
- )
-
- )
- (prin1)
- )
|