hzzhao 发表于 2010-10-23 13:51:00

[求助]LISP提取三维实体的体积

怎么搞,实体的体积啊,entget 没有要用的东西,用<font face="Verdana">massprop怎么取啊!!帮帮忙啊</font>

yshf 发表于 2010-10-23 22:05:00

<p>&nbsp;</p>
<p><font face="Verdana">(defun c:tj()<br/>&nbsp;&nbsp;&nbsp; (while (setq ent (car (entsel "\n选择三维实体:")))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (redraw ent 3)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq vob (vlax-ename-&gt;vla-object ent)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v&nbsp;&nbsp; (vl-catch-all-apply 'vla-get-Volume (list vob))<br/>&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (vl-catch-all-error-p v)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (alert "所选取的图元不具有体积属性!")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (alert (strcat "体积=" (rtos v)))<br/>&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (redraw ent 4)<br/>&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp; (princ)<br/>)</font></p>
<p>&nbsp;</p>

hzzhao 发表于 2011-10-15 08:59:35

非常感谢,我试试

zj20190405 发表于 2024-11-9 19:39:14

yshf 发表于 2010-10-23 22:05
&nbsp;
(defun c:tj()&nbsp;&nbsp;&nbsp; (while (setq ent (car (entsel "\n选择三维实体:")))&nbsp;&nbs ...

这个代码让计算出的结果像前移动九位书写到CAD绘图区,后面加上单位立方米,感谢大佬指点
页: [1]
查看完整版本: [求助]LISP提取三维实体的体积