protected BlockTableRecord CreateBtrDim(string prefix, ObjectId idLayer) { // Создание определения блока образмеривания BlockTableRecord btrDim; string blNameDim = panelBase.BlNameAkr.Replace(Settings.Default.BlockPanelAkrPrefixName, prefix); var bt = panelBase.Service.Db.BlockTableId.GetObject(OpenMode.ForRead) as BlockTable; if (bt.Has(blNameDim)) { btrDim = bt[blNameDim].GetObject(OpenMode.ForWrite) as BlockTableRecord; btrDim.ClearEntity(); } else { btrDim = new BlockTableRecord(); btrDim.Name = blNameDim; bt.UpgradeOpen(); bt.Add(btrDim); bt.DowngradeOpen(); t.AddNewlyCreatedDBObject(btrDim, true); } // Добавление ссылки блока обр в блок панели BlockReference blRefDim = new BlockReference(Point3d.Origin, btrDim.Id); blRefDim.LayerId = idLayer; idBlRefDim = btrPanel.AppendEntity(blRefDim); t.AddNewlyCreatedDBObject(blRefDim, true); return(btrDim); }
protected BlockTableRecord CreateBtrDim(string prefix, ObjectId idLayer) { // Создание определения блока образмеривания BlockTableRecord btrDim; string blNameDim = panelBase.BlNameAkr.Replace(Settings.Default.BlockPanelAkrPrefixName, prefix); var bt = panelBase.Service.Db.BlockTableId.GetObject(OpenMode.ForRead) as BlockTable; if (bt.Has(blNameDim)) { btrDim = bt[blNameDim].GetObject(OpenMode.ForWrite) as BlockTableRecord; btrDim.ClearEntity(); } else { btrDim = new BlockTableRecord(); btrDim.Name = blNameDim; bt.UpgradeOpen(); bt.Add(btrDim); bt.DowngradeOpen(); t.AddNewlyCreatedDBObject(btrDim, true); } // Добавление ссылки блока обр в блок панели BlockReference blRefDim = new BlockReference(Point3d.Origin, btrDim.Id); blRefDim.LayerId = idLayer; idBlRefDim = btrPanel.AppendEntity(blRefDim); t.AddNewlyCreatedDBObject(blRefDim, true); return btrDim; }