作为起点
- (defun c:demo (/ col ent flag flag1 i lay ss)
- (setq flag1 T)
- (while (and flag1
- (setq ss (ssget ":L"))
- )
- (setq flag T)
- (while flag
- (setq lay (getstring t "\nEnter New Layer Name <exit>: "))
- (cond ((tblsearch "layer" lay)
- (prompt "\nLayer Already Exists!!!")
- )
- ((= lay "")
- (setq flag nil)
- (setq flag1 nil)
- )
- ((not (snvalid lay))
- (prompt "\nInvalid Layer Name!!!")
- )
- ((and (not (tblsearch "layer" lay))
- (snvalid lay)
- (setq col (acad_colordlg 7))
- )
- (entmake (list (cons 0 "LAYER")
- (cons 100 "AcDbSymbolTableRecord")
- (cons 100 "AcDbLayerTableRecord")
- (cons 2 lay)
- '(70 . 0)
- (cons 62 col)
- '(6 . "Continuous")
- )
- )
- (repeat (setq i (sslength ss))
- (setq ent (entget (ssname ss (setq i (1- i)))))
- (entmod (subst (cons 8 lay) (assoc 8 ent) ent))
- )
- (setq flag nil)
- )
- (T
- (setq flag nil)
- (setq flag1 nil)
- )
- );; cond
- );; while
- );; while
- (princ)
- )
希望有帮助
亨里克 |