明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2591|回复: 4

求封闭多义线X和Y方向的程序

[复制链接]
发表于 2004-1-3 21:44 | 显示全部楼层 |阅读模式
请教各位高手,我想要一个能自动计算一个封闭多义线的最小X坐标及Y坐标和最大X坐标及Y坐标的程序,有谁能帮帮我????
发表于 2004-1-3 21:49 | 显示全部楼层
什么意思?是计算线上的坐标吗?
发表于 2004-1-4 15:49 | 显示全部楼层
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=8747&star=1&skin=0
发表于 2004-1-6 22:32 | 显示全部楼层
(defun c:pxy( / p_list p_obj obj_ty nof xmin ymin xmax ymax p_ent xy_min xy_max a )
(setq p_list nil obj_ty nil)
(while (/= obj_ty "LWPOLYLINE")
(setq p_obj (car (entsel "\n选择多义线:")))
(setq p_ent (entget p_obj))
(setq obj_ty (cdr (assoc 0 p_ent)))
)
(setq nof (assoc 10 p_ent))
(while (/= nof nil)
(setq p_ent (cdr (member nof p_ent)))
(setq p_list (append p_list (list (cdr nof))))
(setq nof (assoc 10 p_ent))
)
(setq xmin 999999999 ymin 999999999 xmax -9999999 ymax -99999999)
(foreach x p_list
(progn
(setq xmin (min xmin (car x)))
(setq ymin (min ymin (last x)))
(setq xmax (max xmax (car x)))
(setq ymax (max ymax (last x)))
)
)
(setq xy_min (list xmin ymin) xy_max (list xmax ymax))
(setq a (append (list xy_min) (list xy_max)))
;(command "rectang" (car a) (last a))
)

其实在vba中使用object.GetBoundingBox MinPoint, MaxPoint即可。
发表于 2004-1-7 08:23 | 显示全部楼层
你这个函数对于有圆弧的PLINE就不行了,如果没有圆弧,也不用这么复杂了。
LISP中也可以使用GetBoundingBox,实用函数里面就有,你可以看看,这就是VLISP
http://www.mjtd.com/function/list.asp?id=190
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-20 08:43 , Processed in 0.350879 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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