论坛里有相关的代码,找找应该有 非常有用啊 谢谢!!!版主 谢谢网站! 本帖最后由 阿然 于 2013-1-7 18:56 编辑
给个lee大的函数
参数是图元表(vla-object)
返回包围框的左下角和右上角点坐标
;;------------------=={ List BoundingBox }==------------------;;
;; ;;
;;Returns the coordinates of a rectangle framing all ;;
;;objects in a supplied list ;;
;;------------------------------------------------------------;;
;;Author: Lee Mac, Copyright ?2010 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;;Arguments: ;;
;;lst - list of VLA-Objects to process ;;
;;------------------------------------------------------------;;
;;Returns:coordinates of rectangle framing objects ;;
;;------------------------------------------------------------;;
(defun LM:ListBoundingBox ( lst / ll ur bb )
;; ?Lee Mac 2010
(foreach obj lst (vla-getBoundingBox obj 'll 'ur)
(setq bb (cons (vlax-safearray->list ur)
(cons (vlax-safearray->list ll) bb))
)
)
(mapcar
(function
(lambda ( operation )
(apply (function mapcar) (cons operation bb))
)
)
'(min max)
)
)
;;----------------=={ BoundingBox -> List }==-----------------;;
;; ;;
;;Returns the coordinates of a rectangle from the ;;
;;coordinates of the lower-left and upper-right corners ;;
;;------------------------------------------------------------;;
;;Author: Lee Mac, Copyright ?2010 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;;Arguments: ;;
;;bbox - list of lower-left and upper-right coordinates ;;
;;------------------------------------------------------------;;
;;Returns:coordinates of rectangle ;;
;;------------------------------------------------------------;;
(defun LM:BBox->List ( bbox )
(mapcar
(function
(lambda ( funcs )
(mapcar
(function
(lambda ( func ) ((eval func) bbox))
)
funcs
)
)
)
'((caarcadar)(caadr cadar) (caadr cadadr) (caarcadadr))
)
)
阿然 发表于 2013-1-7 18:55 static/image/common/back.gif
给个lee大的函数
参数是图元表(vla-object)
返回包围框的左下角和右上角点坐标
能不能改个思路,就是选择集中图元的交点形成的不规则包围圈用多线段标记出来呢,这个很有用。希望高人指点 本帖最后由 阿然 于 2013-1-7 20:25 编辑
yxh1202 发表于 2013-1-7 19:18 http://bbs.mjtd.com/static/image/common/back.gif
能不能改个思路,就是选择集中图元的交点形成的不规则包围圈用多线段标记出来呢,这个很有用。希望高人指 ...
参考高飞大的凸包计算方法,
所有交点论坛上也有程序,见链接
http://bbs.mjtd.com/thread-85947-1-1.html
学习了 占个位,回头研究研究。
页:
1
[2]