CAD绘制pl线(网页版)

Posted yzy0224

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CAD绘制pl线(网页版)相关的知识,希望对你有一定的参考价值。

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线(网页版)的主要内容,如果未能解决你的问题,请参考以下文章

CAD交互绘制圆形云线标注(网页版)

CAD参数绘制图案填充(网页版)

CAD参数绘制多段线(网页版)

CAD绘制单行文字(网页版)

CAD参数绘制椭圆(网页版)

CAD参数绘制圆(网页版)