主要用到函数说明:

IMxDrawCurve::GetSamplePoints

离散曲线,具体说明如下:

参数

说明

[in] DOUBLE dApproxEps

离散后的曲线的最大弧高

[out,retval] IMxDrawPoints** ppPointArray

返回离散的点数组

js代码实现如下:

  var ent = mxOcx.GetEntity("选择需要离散的曲线:");

if (ent == null)

return;


var curve;

if (ent.ObjectName == "McDbSpline")

{

curve =ent;

}

else

{

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

return;

}

var curvelen = curve.GetSamplePoints(1);

if (curvelen == null) {

return;

}

var pt = curvelen.Item(0);

console.log(pt)

mxOcx.PathMoveTo(pt.x, pt.y);

for(var i = 1; i < curvelen.Count;i++)

{

pt = curvelen.Item(i);

mxOcx.PathLineTo(pt.x,pt.y)

}


mxOcx.LineWidth = 10;

mxOcx.DrawPathToPolyline();