可乐版 (下述程序是在‘ZZXXQQ’的基础上修改的)
(DEFUN C:MJ () (if (not (entlast)) (progn (alert "老大图形里总得有点东西再用吧。") (exit) ) ) (SETvar "CMDECHO" 0) (SETQ TXTH (CDR (ASSOC 40 (TBLSEARCH "STYLE" (GETvar "CMLSTYLE"))))) (COMMAND ".UNDO" "BE") (SETvar "CECOLOR" "1") (WHILE (SETQ PT (GETPOINT "\nSelect a Point 选取点:")) (setq LastHand (cdr(assoc 5 (entget (entlast))))) (COMMAND "BPOLY" PT "") (SETQ EN (ENTLAST)) (IF (/= LastHand (cdr(assoc 5 (entget en)))) ;不等于才能说明已经有实体生成 (PROGN (COMMAND "AREA" "O" EN) (SETQ AA (GETvar "AREA")) (IF (> TXTH 0) (COMMAND "TEXT" PT 0 (RTOS AA 2 3)) (COMMAND "TEXT" PT 3 0 (RTOS AA 2 3)) ) (ENTDEL EN) ) (alert "你应该选择内部点,不然我不干。") ) ) (COMMAND ".UNDO" "E") (SETvar "CECOLOR" "BYLAYER") (PRIN1) ) (princ "\n虽然这个 MJ 的命令名总能让你想起‘麻将’但是我真的是用来计算面积的。\n\n") |