本帖最后由 xyp1964 于 2017-11-20 21:51 编辑
- ;; xyp-9Pt 实体9点坐标 (xyp-9Pt ename site)
- (defun xyp-9Pt (ename site / MinPT MaxPT p1 p9 p5 p3 p7 p2 p4 p6 p8)
- (defun mid (p1 p2)(mapcar '(lambda (x) (* x 0.5)) (mapcar '+ p1 p2)))
- (setq ename (cond ((= (type ename) 'ENAME) (vlax-ename->vla-object ename))
- ((= (type ename) 'VLA-OBJECT) ename)
- )
- )
- (vla-getboundingbox ename 'MinPT 'MaxPT)
- (setq p1 (vlax-safearray->list MinPT)
- p9 (vlax-safearray->list MaxPT)
- p5 (mid p1 p9)
- p3 (if (< (car p9) (car p1))
- (list (car p1) (cadr p9) (caddr p1))
- (list (car p9) (cadr p1) (caddr p1))
- )
- p7 (if (< (car p9) (car p1))
- (list (car p9) (cadr p1) (caddr p9))
- (list (car p1) (cadr p9) (caddr p9))
- )
- p2 (mid p1 p3)
- p4 (mid p1 p7)
- p6 (mid p3 p9)
- p8 (mid p7 p9)
- )
- (nth (- site 1) (list p1 p2 p3 p4 p5 p6 p7 p8 p9))
- )
|