CAD返回曲线上一点在曲线上的参数(网页版)
主要用到函数说明:
IMxDrawCurve::GetParamAtPoint
返回曲线上一点在曲线上的参数,具体说明如下:
| 参数 | 说明 |
|---|---|
|
[in] IMxDrawPoint* point |
曲线的点 |
|
[out] DOUBLE* pParam |
返回曲线上的参数 |
js代码实现如下:
var ent = mxOcx.GetEntity("选择曲线:");
if (ent == null)
return;
var curve;
if (ent.ObjectName == "McDbSpline")
{
curve =ent;
}
else
{
alert("实体类型不对");
return;
}
var getPt1 = mxOcx.GetPoint(false,0,0,"\n 点取一个点:");
if (getPt1 == null)
{
alert("用户取消..");
return;
}
if (curve.GetParamAtPoint2(getPt1))
{
alert(curve.GetParamAtPoint2(getPt1));
}
else
{
alert("失败");
}
|