求答疑
大神帮忙看下如何去掉尾部的nil?(defun c:bz()
(setvar "cmdecho" 0)
(setq en (entsel "\n 选取尺寸标注"))
(setq I 0)
(while (/= en nil)
(setq DM(entget (car en)))
(setq x (cdr(assoc 42 DM)))
(princ x)
(princ \n)
(setq I (+ 1 I))
(setq en (entsel "\n 选取下一个尺寸标注"))
)
(princ "\n 共选取")(princ I)(princ "个尺寸标注")
(prin1)
) 试试下面的:
(defun c:bz()
(setvar "cmdecho" 0)
(setq en (entsel "\n 选取尺寸标注"))
(setq I 0)
(while (/= en nil)
(setq DM(entget (car en)))
(setq x (cdr(assoc 42 DM)))
(princ x)
(setq I (+ 1 I))
(setq en (entsel "\n 选取下一个尺寸标注"))
)
(princ "\n 共选取")(princ I)(princ "个尺寸标注")
(prin1)
) (defun c:bz(/ i en dm x )
(setvar "cmdecho" 0)
(setq I 0)
(while (setq en (entsel "\n 选取尺寸标注"))
(setq DM(entget (car en)))
(setq x (cdr(assoc 42 DM)))
(print x)
(setq I (+ 1 I))
)
(print (strcat"共选取" (rtos I ) "个尺寸标注"))
(princ)
) sowin 发表于 2023-10-19 09:44
试试下面的:
(defun c:bz()
(setvar "cmdecho" 0)
多谢,语法错误
(princ \n) nil
(princ "\n")
页:
[1]