马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
![](source/plugin/imc_colorcode/images/loading.gif) - (defun c:CL ( / ENTITY1 LN OLDCE OLDERR OLDTE)
- ; Save the current value of cmdecho then redefine it.
- (setq OLDCE (getvar "cmdecho"))
- (setvar "cmdecho" 1)
- ; Save the current value of texteval then set it to 1
- (setq OLDTE (getvar "texteval"))
- (setvar "texteval" 1)
- ; Save the current value of the error handling subroutine then redefine it.
- (setq OLDERR *error*)
- (defun *error* (errmes)
- (princ (strcat "\nExecution of CL halted by the following error: " ERRMES))
- (setvar "cmdecho" OLDCE)
- (setq *error* OLDERR)
- (prin1)
- )
- ;(setq *error* nil)
- ; NOTE: to turn error handling off, erase the semicolon in the line above.
- ; GET a ENTITY from the user and store it in ENTITY1.
- (setq ENTITY1 (car (entsel "\nSelect object from which to extract the layer: ")))
- ; EXTRACT the Layer name from the entity ENTITY1 and store it in LN.
- (setq LN (cdr (assoc 8 (entget ENTITY1))))
- ; Input to AutoCAD's command line.
- (command
- "change"
- )
- (command
- (ssget)
- ""
- "p"
- "la"
- LN
- ""
- )
- ; Reset "cmdecho" to previous value.
- (setvar "cmdecho" OLDCE)
- ; Reset "texteval" to previous value.
- (setvar "texteval" OLDTE)
- ; Reset *error* to previous definition.
- (setq *error* OLDERR)
- ; Exit quietly (no return value.)
- (prin1)
- )
|