如何将图块替换成dwg文件?
MxDraw网页开发|黄洪辉|2018-05-07 10:37
-
回答:
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; }