- (defun C:bwzb (/ sel minPt maxPt obj minPt1 maxPt1)
- (setq q (ssget))
- (setq sel (ssname q 0))
- (setq oce (getvar "cmdecho"))
- (setvar "cmdecho" 0)
- (vl-load-com)
- (setq minPt (vlax-make-safearray vlax-vbdouble '(0 . 2)))
- (setq maxPt (vlax-make-safearray vlax-vbdouble '(0 . 2)))
- (setq obj (vlax-ename->vla-object sel))
- (vla-GetBoundingBox obj 'minpt 'maxpt)
- (setq minPt1 (vlax-safearray->list minPt))
- (setq maxPt1 (vlax-safearray->list maxPt))
- (command ".rectang" minPt1 maxPt1 "")
- (setvar "cmdecho" oce)
- )
这个是原程序 我想变成子程序 修改如下- (defun C:bwzb (sel / minPt maxPt obj minPt1 maxPt1)
- (setq oce (getvar "cmdecho"))
- (setvar "cmdecho" 0)
- (vl-load-com)
- (setq minPt (vlax-make-safearray vlax-vbdouble '(0 . 2)))
- (setq maxPt (vlax-make-safearray vlax-vbdouble '(0 . 2)))
- (setq obj (vlax-ename->vla-object sel))
- (vla-GetBoundingBox obj 'minpt 'maxpt)
- (setq minPt1 (vlax-safearray->list minPt))
- (setq maxPt1 (vlax-safearray->list maxPt))
- (command ".rectang" minPt1 maxPt1 "")
- (setvar "cmdecho" oce)
- )
- (defun C:bw (/ q a)
- (setq q (ssget))
- (setq a (ssname q 0))
- (bwzb a)
- )
为什么函数bwzb不好使呢 请各位大侠帮我看看,另外我不太懂vla-GetBoundingBox的使用,不知道我的程序还能简化么 vla-GetBoundingBox使用的对么? |