Autolisp:利用AuoCAD之Lisp编程案例之自动智能获取所选对象的面积并标注在指定位置
作者:互联网
Autolisp:利用AuoCAD之Lisp编程案例之自动智能获取所选对象的面积并标注在指定位置
目录
输出结果
实现代码
;; write area value of a close polygon to drawing
(DEFUN C:EA(/ OLDOS PT STA QAREA)
;;
(setq olderr *error*)
(setq *error* myerr)
(SETVAR "CMDECHO" 0)
(SETQ OLDOS (GETVAR "OSMODE"))
;;
(SETVAR "OSMODE" 0)
(SETQ STA (CAR (ENTSEL)))
(COMMAND "AREA" "E" STA)
(SETQ QAREA (RTOS (GETVAR "AREA") 2 2))
(SETQ PT (GETPOINT"\nPick the point you want to write area:"))
(COMMAND "TEXT" PT "" "" QAREA)
;;
(SETVAR "OSMODE" OLDOS)
(SETVAR "CMDECHO" 1)
(setq *error* olderr)
(PRINC)
)
标签:AuoCAD,PT,Lisp,SETQ,OLDOS,Autolisp,QAREA,SETVAR,STA 来源: https://blog.51cto.com/u_14217737/2907396