CAD求两点之间的距离(网页版)

js代码如下:

  function PointDis() {
 
    var point1 = mxOcx.GetPoint(false,0,0,"\n 点取第一点:");
    if(point1 == null)
    {
        alert("用户取消");
        return;
    }
    var point2 = mxOcx.GetPoint(true,point1.x,point1.y,"\n 点取第二点:");
    if(point1 == null)
    {
        alert("用户取消");
        return;
    }
    var dDis=Math.abs((point1.x - point2.x) * (point1.x - point2.x)
        + (point1.y - point2.y) * (point1.y - point2.y));
    alert("两点距离:" + dDis.toString());
 
}


猜你喜欢

转载自blog.51cto.com/10455293/2414263