其他分享
首页 > 其他分享> > CAD绘制pl线(网页版)

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);          }

标签:mxOcx,网页,point1,point2,var,iCount,id,pl,CAD
来源: https://www.cnblogs.com/yzy0224/p/11131042.html