明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1702|回复: 2

[求助]帮帮忙看这段代码

[复制链接]
发表于 2004-12-4 15:36:00 | 显示全部楼层 |阅读模式
//2个poly求交,结果错误
Acad::ErrorStatus polyjiao(AcDbObjectId polylineId1,AcDbObjectId polylineId2,AcDbObjectId& polylineId)
{
AcDbObjectId e0Id,e1Id;
AcGeCurve2d *Gpln0;
AcGeCurve2d *Gpln1;
AcGeInterval Ginv0,Ginv1,Ginv2;
//=============================
//选择两条多义线
AcDbPolyline *pent;
acdbOpenObject(pent,polylineId1,AcDb::kForWrite);
convertPolylineToGeCurve(pent,Gpln0);
pent->close();
AcDbPolyline *pent2;
acdbOpenObject(pent2,polylineId2,AcDb::kForWrite);

convertPolylineToGeCurve(pent2,Gpln1);
pent2->close();
Gpln0->getInterval(Ginv0);
double bv0,bv1;
Ginv0.getBounds(bv0,bv1);
ads_printf("\n00:bv0=%f,bv1=%f",bv0,bv1);
Gpln1->getInterval(Ginv1);
Ginv1.getBounds(bv0,bv1);
ads_printf("\n01:bv0=%f,bv1=%f",bv0,bv1);
if(Ginv1.intersectWith(Ginv0,Ginv2)==Adesk::kTrue)
{
ads_printf("\nkTrue");
}

Ginv0.getBounds(bv0,bv1);
ads_printf("\n0:bv0=%f,bv1=%f",bv0,bv1);
Ginv1.getBounds(bv0,bv1);
ads_printf("\n1:bv0=%f,bv1=%f",bv0,bv1);
Ginv2.getBounds(bv0,bv1);
ads_printf("\n2:bv0=%f,bv1=%f",bv0,bv1);
double approxEps=0.001;
AcGePoint2dArray pntArr;
AcGeDoubleArray paramArr;
AcGeDoubleArray *ptayy=new AcGeDoubleArray();
Gpln0->getSamplePoints(bv0,bv1,approxEps,pntArr,paramArr);
ptayy->append(paramArr);
AcGePoint3dArray ptArr;
AcDbObjectId textBoundaryId;
AcGePoint2dArraytoAcGePoint3dArray(pntArr,ptArr);
DrawPolyline(textBoundaryId,ptArr,1,0,TRUE,"0","CONTINUOUS");
return Acad::eOk;
}
 楼主| 发表于 2004-12-4 17:31:00 | 显示全部楼层
我是想实现这样的功能



http://www.xdcad.net/tech/xd_tbox/xdtb_cboole.swf
 楼主| 发表于 2004-12-5 13:01:00 | 显示全部楼层
大侠帮忙看下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 09:35 , Processed in 0.167222 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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