参考博客地址
https://www.cnblogs.com/edata/p/17474704.html
var fn = @"D:\NetDriveDir\OneDrive\软件工具\MNYT.png";
var bm = Bitmap.FromFile(fn);
Clipboard.SetImage(bm);
var pt = new Point3d(10, 20, 0);
var cmdstrInsetOle = new List<string>()
{
"_pasteclip",
$"{pt.X},{pt.Y}"
};
var cr = env.acEd.CommandAsync(cmdstrInsetOle.ToArray());
cr.OnCompleted(() =>
{
env.acEd.WriteMessage($"插入old {fn} 完成\n");
Clipboard.Clear();
//var psr = env.acEd.SelectLast();
//using (var tr=env.acDb.TransactionManager.StartTransaction())
//{
// var ole = tr.GetObject(psr.Value[0].ObjectId, OpenMode.ForRead) as Ole2Frame;
// if (ole.Type!= Ole2Frame.ItemType.Embedded)
// {
// ole.UpgradeOpen();
// ole.DowngradeOpen();
// tr.Commit();
// }
//}
});
但是无法激活ole需要手工转换下
然后双击即可打开old源文件
标签:AutoCAD,OLE,pt,C#,tr,acEd,env,var,ole From: https://www.cnblogs.com/NanShengBlogs/p/17764474.html