本帖最后由 shh_188 于 2016-2-24 12:01 编辑
 - (defun c:mj(/ pt sta qarea)
- (setq pt (getpoint "积书写位置:" ))
- (setq sta (bpoly pt))
- (if (= (type sta) 'ENAME)
- (if (entget sta)
- (progn
- (command "area" "e" sta)
- (setq qarea (rtos (getvar "area") 2 2))
- (command "layer" "m" "面积" "co" "" "" )
- (command "text" pt "0.4" "" (strcat "=" qarea))
- (entdel sta)
- )
- )
- )
- )
你试试看这个吧
你的问题有2个:
一个是对bpoly的返回值注意得不够
一个是,if函数里只能有符合条件与不符合条件的2组表达式,如果表达式超过一个函数的行范围,就要用(progn)括起来 |