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