将(setq ss (ssget "_wp" wl'((0."TEXT"))))改为(setq ss (ssget "_wp" wl '((0 . "TEXT")))),
由排版的原因,那刊物上漏了好多空格,正确的如下,自己去比较:- ;;快速求场地的平均高程:
- (defun c:gc()
- (setq wl nil)
- (command "3dpoly");画所求范围的闭合线
- (while (setq pt (getpoint))
- (setq wl (append wl (list pt)))
- (command pt)
- )
- (command "c" "chprop" (entlast) "" "c" 1 "");将闭合线的颜色设为红色
- (setq plen (entlast))
- (setq ss (ssget "_wp" wl '((0 . "TEXT"))))
- (setq n (sslength ss)
- i 0
- sum 0
- )
- (repeat n
- (setq db (entget (ssname ss i))
- sum (+ sum (read (cdr (assoc l db))));提取高程值并累加
- i (1+ i)
- )
- )
- (setq pjg (strcat "平均高程=" (rtos (/ sum n)))
- nds (strcat "高程点数=" (itoa n))
- pt1 (getpoint "\ n 请选择计算结果写入点:")
- pt2 (mapcar '+ pt1 '(0 20 0))
- )
- (command "text" pt1 4 0 pjg
- "text" pt2 4 0 nds
- "erase" plen "" "redraw";删除所求范围的闭合线)
- )
- )
|