本帖最后由 作者 于 2007-2-20 18:41:38 编辑
还没有人知道怎么处理吗? 原来我做一个计算3D实体边界框的体积,用了vla-getboundingbox,但是对于一些不规则的3D实体却计算错误,所以才用massprop来计算体积,可以成功,但老是弹出"按ENTER键继续",如果选择1000个3D实体,就要按1000次enter键,有办法去掉吗?? 附:以下是我用vla-getboundingbox编写的LISP,但是对于附件(20070220.dwg)中的模型,计算就会出错. (DEFUN C:XBK (/ ent ll ur sall pp x0y0 x1y1 l w h total totale ocezin) (setvar "cmdecho" 0) (vl-load-com) (setq total 0 totale 0) (prompt "\n选择要计算体积的3D实体:") (setq sall (ssget '((0 . "3DSOLID"))) n 0) (while (setq ent (ssname sall n)) (vla-getboundingbox (vlax-ename->vla-object ent) 'll 'ur) (setq pp (mapcar 'vlax-safearray->list (list ll ur))) (setq x0y0 (car pp) x1y1 (cadr pp)) (setq l (abs (- (car x1y1) (car x0y0)))) ;长 (setq w (abs (- (cadr x1y1) (cadr x0y0)))) ;宽 (setq h (abs (- (caddr x1y1) (caddr x0y0)))) ;高 (setq total (* l w h)) (setq totale (+ totale total)) (setq n (1+ n)) ) (setq ocezin (getvar "dimzin")) (setvar "dimzin" 1) (setq totale (rtos (/ totale 1000000000) 2 3)) (setvar "dimzin" ocezin) (princ (strcat "\n所选3D实体的总体积为:" totale "立方米")) (setvar "cmdecho" 1) (princ) ) |