明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: gdslqs

怎么用lisp画出选择集的外围线

  [复制链接]
发表于 2012-9-13 08:17 | 显示全部楼层
占个位置,以后要用就好找了
发表于 2012-9-13 08:45 | 显示全部楼层
论坛里有相关的代码,找找应该有
发表于 2013-1-7 16:26 | 显示全部楼层
非常有用啊 谢谢!!!版主 谢谢网站!
发表于 2013-1-7 18:55 | 显示全部楼层
本帖最后由 阿然 于 2013-1-7 18:56 编辑

给个lee大的函数
参数是图元表(vla-object)
返回包围框的左下角和右上角点坐标


  1. ;;------------------=={ List BoundingBox }==------------------;;
  2. ;;                                                            ;;
  3. ;;  Returns the coordinates of a rectangle framing all        ;;
  4. ;;  objects in a supplied list                                ;;
  5. ;;------------------------------------------------------------;;
  6. ;;  Author: Lee Mac, Copyright ?2010 - www.lee-mac.com       ;;
  7. ;;------------------------------------------------------------;;
  8. ;;  Arguments:                                                ;;
  9. ;;  lst - list of VLA-Objects to process                      ;;
  10. ;;------------------------------------------------------------;;
  11. ;;  Returns:  coordinates of rectangle framing objects        ;;
  12. ;;------------------------------------------------------------;;
  13. (defun LM:ListBoundingBox ( lst / ll ur bb )
  14.   ;; ?Lee Mac 2010
  15.   (foreach obj lst (vla-getBoundingBox obj 'll 'ur)
  16.     (setq bb (cons (vlax-safearray->list ur)
  17.                    (cons (vlax-safearray->list ll) bb))
  18.     )
  19.   )
  20.   (mapcar
  21.     (function
  22.       (lambda ( operation )
  23.         (apply (function mapcar) (cons operation bb))
  24.       )
  25.     )
  26.    '(min max)
  27.   )
  28. )
  29. ;;----------------=={ BoundingBox -> List }==-----------------;;
  30. ;;                                                            ;;
  31. ;;  Returns the coordinates of a rectangle from the           ;;
  32. ;;  coordinates of the lower-left and upper-right corners     ;;
  33. ;;------------------------------------------------------------;;
  34. ;;  Author: Lee Mac, Copyright ?2010 - www.lee-mac.com       ;;
  35. ;;------------------------------------------------------------;;
  36. ;;  Arguments:                                                ;;
  37. ;;  bbox - list of lower-left and upper-right coordinates     ;;
  38. ;;------------------------------------------------------------;;
  39. ;;  Returns:  coordinates of rectangle                        ;;
  40. ;;------------------------------------------------------------;;
  41. (defun LM:BBox->List ( bbox )
  42.   (mapcar
  43.     (function
  44.       (lambda ( funcs )
  45.         (mapcar
  46.           (function
  47.             (lambda ( func ) ((eval func) bbox))
  48.           )
  49.           funcs
  50.         )
  51.       )
  52.     )
  53.     '((caar  cadar)  (caadr cadar) (caadr cadadr) (caar  cadadr))
  54.   )
  55. )


发表于 2013-1-7 19:18 | 显示全部楼层
阿然 发表于 2013-1-7 18:55
给个lee大的函数
参数是图元表(vla-object)
返回包围框的左下角和右上角点坐标

能不能改个思路,就是选择集中图元的交点形成的不规则包围圈用多线段标记出来呢,这个很有用。希望高人指点
发表于 2013-1-7 20:12 | 显示全部楼层
本帖最后由 阿然 于 2013-1-7 20:25 编辑
yxh1202 发表于 2013-1-7 19:18
能不能改个思路,就是选择集中图元的交点形成的不规则包围圈用多线段标记出来呢,这个很有用。希望高人指 ...


参考高飞大的凸包计算方法,
所有交点论坛上也有程序,见链接
http://bbs.mjtd.com/thread-85947-1-1.html
发表于 2018-5-2 15:38 | 显示全部楼层
占个位,回头研究研究。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-29 17:55 , Processed in 0.129517 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表