private void GetData(bool withRegions)
        {
            using (var t = Doc.TransactionManager.StartTransaction())
            {
                // Выбор блоков
                SelectSection select = new SelectSection(Doc);
                var           selIds = select.Select(withRegions);
                if (selIds.Count == 0)
                {
                    throw new Exception("Не найдены блоки блок-секций");
                }
                else
                {
                    Doc.Editor.WriteMessage("\nВыбрано {0} блоков блок-секций.", selIds.Count);
                }
                Estimate = select.Estimate;

                // Обработка выбранных блоков
                List <IArea> classes;
                Sections = Parse(selIds, out classes, Doc.Editor);
                Classes  = classes;

                // Подсчет площадей и типов блок-секций
                DataSection = new DataSection(this);
                DataSection.Calc();
                t.Commit();
            }
        }
        /// <summary>
        /// Построение полилиний контура у блоков Блок-Секций.
        /// Выбор блоков пользователем.
        /// </summary>
        public static void CreateContour(Document doc)
        {
            using (var t = doc.TransactionManager.StartTransaction())
            {
                // Выбор блоков
                SelectSection select = new SelectSection(doc);
                var           selIds = select.Select(false);
                if (selIds.Count == 0)
                {
                    throw new Exception("Не найдены блоки Блок-Секций");
                }
                else
                {
                    doc.Editor.WriteMessage($"\nВыбрано {selIds.Count} блоков Блок-Секций.");
                }

                int count = 0;

                AcadLib.Layers.LayerInfo layInfo = new AcadLib.Layers.LayerInfo("Defpoints");
                ObjectId layerIdPl = AcadLib.Layers.LayerExt.GetLayerOrCreateNew(layInfo);

                ObjectId msId = doc.Database.CurrentSpaceId;
                foreach (var idBlRefSec in selIds)
                {
                    var ent = idBlRefSec.GetObject(OpenMode.ForRead) as Entity;
                    if (ent is BlockReference)
                    {
                        var    blRefSec = (BlockReference)ent;
                        string blName   = blRefSec.GetEffectiveName();
                        if (SectionService.IsBlockNameSection(blName))
                        {
                            try
                            {
                                Polyline plLayer;
                                var      pl = FindContourPolyline(blRefSec, out plLayer);
                                if (pl != null)
                                {
                                    var idPlCopy = pl.Id.CopyEnt(msId);
                                    var plCopy   = idPlCopy.GetObject(OpenMode.ForWrite, false, true) as Polyline;
                                    plCopy.LayerId = layerIdPl;
                                    plCopy.TransformBy(blRefSec.BlockTransform);
                                    count++;
                                }
                            }
                            catch (Exception ex)
                            {
                                Inspector.AddError($"Ошибка построения контура для блока '{blName}' - {ex.Message}", blRefSec, System.Drawing.SystemIcons.Error);
                            }
                        }
                    }
                }
                doc.Editor.WriteMessage($"\nПостроено {count} полилиний контура блоков Блок-Секций.");
                t.Commit();
            }
        }