Esempio n. 1
0
 public Album()
 {
     _doc         = Application.DocumentManager.MdiActiveDocument;
     _db          = _doc.Database;
     Date         = DateTime.Now;
     StartOptions = new StartOption();
     StartOptions.LoadDefault();
 }
Esempio n. 2
0
        public void AKR_RemoveMarkPaintingFromMountingPanels()
        {
            CommandStart.Start(doc =>
            {
                Editor ed   = doc.Editor;
                Database db = doc.Database;

                try
                {
                    var startOptions = new StartOption();
                    startOptions.LoadDefault();
                    if (startOptions.CheckMarkPainting)
                    {
                        MessageBox.Show("Для чертежа включена проверка марок покраски панелей. Нельзя выполнять очистку!",
                                        "АКР. Очистка марок покраски в монтажных панелях.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                }
                catch { }

                using (var t = db.TransactionManager.StartTransaction())
                {
                    // Все монтажные блоки панелей в модели
                    var ms = SymbolUtilityServices.GetBlockModelSpaceId(db).GetObject(OpenMode.ForRead) as BlockTableRecord;
                    var mountingsPanelsInMs = MountingPanel.GetPanels(ms, Point3d.Origin, Matrix3d.Identity, null, null);
                    mountingsPanelsInMs.ForEach(p => p.RemoveMarkPainting());
                    foreach (ObjectId idEnt in ms)
                    {
                        if (idEnt.IsValidEx() && idEnt.ObjectClass.Name == "AcDbBlockReference")
                        {
                            var blRefMounting = t.GetObject(idEnt, OpenMode.ForRead, false, true) as BlockReference;
                            if (blRefMounting.Name.StartsWith(Settings.Default.BlockPlaneMountingPrefixName, StringComparison.CurrentCultureIgnoreCase))
                            {
                                var btr             = blRefMounting.BlockTableRecord.GetObject(OpenMode.ForRead) as BlockTableRecord;
                                var mountingsPanels = MountingPanel.GetPanels(btr, blRefMounting.Position, blRefMounting.BlockTransform, null, null);
                                mountingsPanels.ForEach(p => p.RemoveMarkPainting());
                            }
                        }
                    }
                    t.Commit();
                }
                ed.Regen();
            });
        }