CAD由曲线上的一点返回该点到曲线开始点的长度(网页版)

主要用到函数说明:

IMxDrawCurve::GetDistAtPoint

由曲线上的一点返回该点到曲线开始点的长度,具体说明如下:

参数说明

[in] IMxDrawPoint* point

曲线上的一点

[out] DOUBLE* pDis

返回到开始点的曲线上长度

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.GetDistAtPoint2(getPt1))
    {
        alert(curve.GetDistAtPoint2(getPt1));
    }
    else
    {
        alert("失败");
    }

posted on 2019-07-04 10:50  梦想CAD控件  阅读(282)  评论(0)    收藏  举报

导航