IMxDrawEntity::IntersectWith

求两个实体的交点,具体详细如下:

参数

说明

[in] IDispatch* pIntersectObject

另一个求交实体

[in] MCAD_McExtendOption exOption

求交方式,现在不支持延伸实体求交点

[out,retval] IMxDrawPoints** intersectPoints

返回实体的相交点

js代码得到两曲线的交点:

 //求曲线的交点    

function IntersectPoint() {

var ent1 = mxOcx.GetEntity("选择曲线1:");

if (ent1 == null)

return;


var curve;

if (ent1.ObjectName == "McDbSpline")

{

curve =ent1;

}

else

{

alert("实体类型不对");

return;

}

var ent2 = mxOcx.GetEntity("选择曲线2:");

if (ent2 == null)

return;


var curve1;

if (ent2.ObjectName == "McDbSpline")

{

curve1 =ent2;

}

else

{

alert("实体类型不对");

return;

}


var points = curve.IntersectWith(curve1, 1);

if(points.Count == 0)

{

alert("没有求到交点");

}

else

{

var pt = points.Item(0);

alert("交点为:" + pt.x + "," + pt.y);

}

}