码迷,mamicode.com
首页 > Web开发 > 详细

CAD绘制pl线(网页版)

时间:2019-07-04 11:42:12      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:js代码   ram   syn   nts   调用   make   ber   count   ctrl   

js代码实现如下:

function DrawPolyline()
{
      var mxOcx = document.all.item("MxDrawXCtrl");
              mxOcx.focus();
      var point1 = mxOcx.GetPoint(false,0,0,"\n 点取开始点:");
      if(point1 == null)
      {
             return;
      }
 
      //mxOcx.PathMoveToEx(point1.x,point1.y,10,10,0.0);
 
      mxOcx.PathMoveTo(point1.x,point1.y);
              
      var point2 = mxOcx.GetPoint(true,point1.x,point1.y,"\n 点取下一个:");
      if(point2 == null)
      {
             return;
      }
 
      var tmpobj = new Array();
      //mxOcx.PathLineToEx(point2.x,point2.y,10,10,0.0);
      mxOcx.PathLineTo(point2.x,point2.y);
                var iCount = 0;
      var id = mxOcx.DrawLine(point1.x,point1.y,point2.x,point2.y);
          tmpobj[iCount] = id;
                iCount = iCount + 1;
 
      point1 = point2;
                while(true)
                {
                       var point2 = mxOcx.GetPoint(true,point1.x,point1.y,"\n 点取下一个:");
         if(point2 == null)
         {
                break;
         }
 
         mxOcx.PathLineTo(point2.x,point2.y);
  
         var id = mxOcx.DrawLine(point1.x,point1.y,point2.x,point2.y);
             tmpobj[iCount] = id;
                   iCount = iCount + 1;
 
         point1 = point2;
                }
 
                var i = 0;
                for(;i < iCount;i++)
                {
         mxOcx.Erase(tmpobj[i] );
                }
 
                var lId = mxOcx.DrawPathToPolyline();
 
      // 把新绘的pl线变成双线。
                var param = mxOcx.Call("Mx_NewResbuf","");
                param.AddLong(lId);
      // 双线的宽度。
                var lineWidth = 2;
                param.AddDouble(lineWidth);
 
      // 调用变双线函数。
               var ret = mxOcx.CallEx("ExApp_MakeDoubleLine",param);
                
      if(ret.AtString(0) == "Ok")
      {
         // 返回的绘制的双线对象id.
         alert(ret.AtLong(1));
      }
 
      // 删除旧的pl线。
                mxOcx.Erase(lId);
        
}

CAD绘制pl线(网页版)

标签:js代码   ram   syn   nts   调用   make   ber   count   ctrl   

原文地址:https://www.cnblogs.com/yzy0224/p/11131042.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!