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