土木在线论坛 \ 建筑设计 \ CAD下载及教程 \ 测量封闭区域面积(2种方法)

测量封闭区域面积(2种方法)

发布于:2009-09-08 17:08:08 来自:建筑设计/CAD下载及教程 [复制转发]
[code](setvar "CMDECHO" 0)
(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]

全部回复(27 )

只看楼主 我来说两句
  • pu1102
    pu1102 沙发
    非常感谢楼主分享。
    2010-12-01 16:14:01

    回复 举报
    赞同0
  • liyp7608826
    liyp7608826 板凳
    下来看看,多谢楼主的资料。学习中!非常感谢
    2010-11-29 20:58:29

    回复 举报
    赞同0
加载更多
这个家伙什么也没有留下。。。

CAD下载及教程

返回版块

52.07 万条内容 · 655 人订阅

猜你喜欢

阅读下一篇

2009一级建造师工程经济考试重点

本考试重点为本人花重金所购。

回帖成功

经验值 +10