编辑代码

lisp
(defun c:TJJS (/ ss en pt h txt)  
   (setq ss (getpoint "\n选择面积/体积起点:")  
         en (getpoint ss "\n选择面积/体积终点:")
         pt (list ss en))
   (setq h (getreal "\n请输入高度(仅体积计算需要):"))
   (if h 
       (progn
         (setq vol (* (lwpolyarea pt) h))
         (setq txt (strcat "Volume=" (rtos vol 2 0) "mm^3")) )
     (setq area (lwpolyarea pt))
     (setq txt (strcat "Area=" (rtos area 2 0) "mm^2")))
   (setq annotpt (getpoint "\n指定标注点:"))
   (entmake (list (cons 0 "TEXT")
                  (cons 100 "AcDbEntity")    
                  (cons 100 annotpt)     
                  (cons 1 txt)))
   (princ)
) 
(כ"TJJS")     ;Set shortcut key as "TJJS"