/// <summary> /// /// </summary> /// <param name="titleName"></param> /// <param name="idMap"></param> public Details(string titleName, AcDb.IdMapping idMap) { InitializeComponent(); this.Name = titleName; this.Text = titleName; m_idMap = idMap; m_colSorter = new MgdDbg.Utils.ListViewColumnSorter(); m_listViewMapItem.ListViewItemSorter = m_colSorter; DisplayMapProps(); DisplayMapItems(); }
internal static bool CloneFromRepository <T>(Db.Database db, string strName, string RepositorySourcePath) { bool returnValue = false; using (Db.Database dbSource = new Db.Database(false, true)) { try { dbSource.ReadDwgFile(RepositorySourcePath, System.IO.FileShare.Read, true, null); } catch (Autodesk.AutoCAD.Runtime.Exception ex) { App.Application.DocumentManager.MdiActiveDocument.Editor. WriteMessage("\nError reading file repository: " + ex.Message); return(returnValue); } Db.ObjectIdCollection sourceIds = new Db.ObjectIdCollection(); using (Db.Transaction tr1 = dbSource.TransactionManager. StartTransaction()) { Db.ObjectId destDbMsId = Db.ObjectId.Null; if (typeof(T) == typeof(Db.MLeaderStyle)) { destDbMsId = db.MLeaderStyleDictionaryId; } else if (typeof(T) == typeof(Db.LayerTableRecord)) { destDbMsId = db.LayerTableId; } Db.ObjectId destId = GetIDbyName <T>(dbSource, strName); if (destId != Db.ObjectId.Null && destDbMsId != Db.ObjectId.Null) { sourceIds.Add(destId); if (sourceIds.Count > 0) { Db.IdMapping mapping = new Db.IdMapping(); try { //Клонируем с заменой dbSource.WblockCloneObjects(sourceIds, destDbMsId, mapping, Db.DuplicateRecordCloning.Replace, false); returnValue = true; } catch (Rtm.Exception ex) { App.Application.DocumentManager.MdiActiveDocument.Editor. WriteMessage(@"\nError during clone from the repository: " + ex.Message); } } } else { App.Application.DocumentManager.MdiActiveDocument.Editor. WriteMessage("\nError during clone from repository. " + "At the repository there is no Object with the specified name!"); } tr1.Commit(); } } return(returnValue); } //CloneFromRepository