[code](setvar "CMDECHO" 0)(vl-load-com);;;=================================================================*;;;功能:测量封闭区域的面积(可分别设置XY比例) *;;;日期:zml84 于 2009-06-07 *(defun C:TT (/ X Y SIZE SS AREA STR TMP)
(vl-load-com)
;;;=================================================================*
;;;功能:测量封闭区域的面积(可分别设置XY比例) *
;;;日期:zml84 于 2009-06-07 *
(defun C:TT (/ X Y SIZE SS AREA STR TMP)
;; 0 初始化
(or *TEST_TMP*
(setq *TEST_TMP* '(1000 100 2.5))
)
(setq X (nth 0 *TEST_TMP*)
Y (nth 1 *TEST_TMP*)
SIZE (nth 2 *TEST_TMP*)
)
;; 1
(while
(progn
(princ
(strcat
"\n当前设置:X比例="
(rtos X)
",X比例="
(rtos Y)
",字高="
(rtos SIZE)
)
)
(initget "X Y Size")
(princ
"\n点取要测量面积的封闭对象,或 [X比例(X)/Y比例(Y)/字高(S)]: "
)
(setq SS (entsel ""))
)
(cond ((= SS "X")
(if (and (setq TMP (getreal "\n设置X向比例: "))
(> TMP 0)
)
(setq X TMP)
)
)
((= SS "Y")
(if (and (setq TMP (getreal "\n设置Y向比例: "))
(> TMP 0)
)
(setq Y TMP)
)
)
((= SS "Size")
(if (and (setq TMP (getreal "\n设置字体高度: "))
(> TMP 0)
)
(setq SIZE TMP)
)
)
((and (setq
AREA (vla-get-area
(vlax-ename->vla-object (car SS))
)
)
(setq AREA (/ AREA 1.0 X Y)
STR (rtos AREA 2 3)
)
(princ (strcat "\n**面积 = " STR))
(setq PT (getpoint "\n文字的位置: "))
)
(command "_.TEXT" "non" PT SIZE 0 STR)
)
)
)
;; 2
(setq *TEST_TMP* (list X Y SIZE))
(princ)
)
;;;=================================================================*
;;;功能:点取内部一点,测量封闭区域的面积(可分别设置XY比例) *
;;;日期:zml84 于 2009-06-07 *
(defun C:TT2 (/ X Y SIZE PT EN AREA STR TMP)
;; 0 初始化
(or *TEST_TMP*
(setq *TEST_TMP* '(1000 100 2.5))
)
(setq X (nth 0 *TEST_TMP*)
Y (nth 1 *TEST_TMP*)
SIZE (nth 2 *TEST_TMP*)
)
;; 1
(while
(progn
(princ
(strcat
"\n当前设置:X比例="
(rtos X)
",X比例="
(rtos Y)
",字高="
(rtos SIZE)
)
)
(initget "X Y Size")
(princ
"\n点取要测量的位置,或 [X比例(X)/Y比例(Y)/字高(S)]: "
)
(setq PT (getpoint ""))
)
(cond ((= PT "X")
(if (and (setq TMP (getreal "\n设置X向比例: "))
(> TMP 0)
)
(setq X TMP)
)
)
((= PT "Y")
(if (and (setq TMP (getreal "\n设置Y向比例: "))
(> TMP 0)
)
(setq Y TMP)
)
)
((= PT "Size")
(if (and (setq TMP (getreal "\n设置字体高度: "))
(> TMP 0)
)
(setq SIZE TMP)
)
)
((and
(setq EN (bpoly PT))
(setq
AREA (vla-get-area
(vlax-ename->vla-object EN)
)
)
;;(progn (command "REGEN") (redraw EN 3) t)
(entdel EN)
(setq AREA (/ AREA 1.0 X Y)
STR (rtos AREA 2 3)
)
(princ (strcat "\n**面积 = " STR))
)
(command "_.TEXT" "non" PT SIZE 0 STR)
)
)
)
;; 2
(setq *TEST_TMP* (list X Y SIZE))
(princ)
)[/code]