其他分享
首页 > 其他分享> > CAD将图块替换成dwg文件(网页版)

CAD将图块替换成dwg文件(网页版)

作者:互联网

js中使用如下:

var ent = mxOcx.GetEntity("选择图面的属性块:");

if(ent == null)

{

    return;

}

if (ent.ObjectName != "McDbBlockReference") {

    alert("选择的对象不是块引用");

}

else

{

    var blkref = ent;

    var sBlkFilePath = mxOcx.GetOcxAppPath() + "\\Blk\\Rect.dwg";

    mxOcx.InsertBlock(sBlkFilePath, "MyBlk2");

 

    var curDatabase = mxOcx.GetDatabase();

    var blkTable = curDatabase.GetBlockTable();

    var myblkRec =  blkTable.GetAt("MyBlk2"false);

    if(myblkRec == null)

    {

        return;

    }

    blkref.BlockTableRecordId = myblkRec.ObjectID;

}

标签:mxOcx,blkref,替换成,图块,ent,dwg,sBlkFilePath,var,myblkRec
来源: https://blog.csdn.net/u013725001/article/details/95059650