明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2213|回复: 6

[求助]如何求出两条闭合多义线的重叠部分的面积?

[复制链接]
发表于 2004-7-28 13:35:00 | 显示全部楼层 |阅读模式
我想用LISP程序求出两条闭合LWPOLYLILNE的重迭部分的面积
发表于 2004-7-28 13:43:00 | 显示全部楼层
给您点东西,参考一下。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2004-7-28 13:50:00 | 显示全部楼层
本帖最后由 作者 于 2004-7-29 1:23:20 编辑

kubi发表于2004-7-28 13:35:00回复:(kubi)如何求出两条闭合多义线的重迭部分的面积? 我想用LISP程序求出两条闭合LWPOLYLILNE的重迭部分的面积

看下帖: dispbbs.asp?boardID=2&ID=24021&page=1 两条多义线并不需要闭合,只要标注部分闭合就可以,注意:画图比例1:1,面积为㎡。
发表于 2004-7-28 15:04:00 | 显示全部楼层
;;;If neither of the two LWpolyline is self-intersected, then you can use ;;; the codes below: (defun c:tt (/ ss1 ss2 a reg1 reg2)
(vl-load-com)
(princ "\nSelect first polyline: ")
(setq ss1 (ssget ":s" '((0 . "LWPOLYLINE"))))
(if ss1 (redraw (ssname ss1 0) 3))
(princ "\nSelect second polyline: ")
(setq ss2 (ssget ":s" '((0 . "LWPOLYLINE"))))
(if (and ss1 ss2)
(progn
(command "copy" ss1 ss2 "" '(0 0 0) '(0 0 0))
(if (vl-cmdf "region" ss1 "")
(setq reg1 (vlax-ename->vla-object (entlast))))
(if (vl-cmdf "region" ss2 "")
(setq reg2 (vlax-ename->vla-object (entlast))))
(vla-boolean reg1 acIntersection reg2)
(if (vlax-erased-p reg2)
(progn
(setq a (vla-get-area reg1))
(vla-erase reg1)
)
(setq a 0)
)
)
)
(princ "\nArea = ")
(princ a)
(princ)
)
 楼主| 发表于 2004-7-28 19:42:00 | 显示全部楼层
谢谢alin,你的方法正是我想要的 可是此法有限制,即当两条多义线有许多交叉点时, (vla-boolean reg1 acIntersection reg2)会产生错误 命令行显示如下:
The Boolean operation on regions failed
Modeling operation Error
system inconsistency processing edge coincidence
发表于 2004-7-28 23:06:00 | 显示全部楼层
你把含有问题多义线的图贴上来吧。我没有遇到这种情况。注意我的程序要求两条多义线均不能自相交,否则生成不了region
发表于 2004-7-29 01:39:00 | 显示全部楼层
认真看看3楼说的!


估计更简单实用!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-30 22:28 , Processed in 0.193413 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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