首页 > 其他分享 >新建一个DWG把当前图形中的块复制过去

新建一个DWG把当前图形中的块复制过去

时间:2022-10-04 17:22:05浏览次数:58  
标签:Database dbNew ids 复制 DWG var new 图形 ObjectIdCollection

private void btnSave_Click(object sender, EventArgs e)
{
//定义数据库
Database db = HostApplicationServices.WorkingDatabase;
if (dicIds.Count < 11) return;
using (Transaction trans = db.TransactionManager.StartTransaction())
{
Database dbNew = new Database(true, true);
//获取所选实体的ObjectId集合
ObjectIdCollection ids = new ObjectIdCollection();
foreach (var dic in dicIds)
{
ids.Add(dic.Value);
}
var msId = SymbolUtilityServices.GetBlockModelSpaceId(dbNew);
var mapping = new IdMapping();
dbNew.WblockCloneObjects(ids, msId, mapping, DuplicateRecordCloning.Ignore, false);
string sPath = ConSQL.DirUserSetting + "\\Sign\\";
dbNew.SaveAs(sPath + tbName.Text + ".dwg", DwgVersion.AC1027);
trans.Commit();
}
}

标签:Database,dbNew,ids,复制,DWG,var,new,图形,ObjectIdCollection
From: https://www.cnblogs.com/swtool/p/16754089.html

相关文章