コード例 #1
0
        /// <summary>
        /// Поиск архитектурных планов в Модели.
        /// Запускает транзакцию.
        /// </summary>
        public static List <FloorArchitect> GetAllPlanes(Database db, BaseService service)
        {
            List <FloorArchitect> floorsAr = new List <FloorArchitect>();

            using (var t = db.TransactionManager.StartTransaction())
            {
                var ms = SymbolUtilityServices.GetBlockModelSpaceId(db).GetObject(OpenMode.ForRead) as BlockTableRecord;
                foreach (ObjectId idEnt in ms)
                {
                    var blRefArPlan = idEnt.GetObject(OpenMode.ForRead, false, true) as BlockReference;
                    if (blRefArPlan == null)
                    {
                        continue;
                    }

                    if (blRefArPlan.Name.StartsWith(Settings.Default.BlockPlaneArchitectPrefixName, StringComparison.CurrentCultureIgnoreCase))
                    {
                        FloorArchitect floorAr = new FloorArchitect(blRefArPlan, service);
                        floorsAr.Add(floorAr);
                    }
                }
                t.Commit();
            }
            return(floorsAr);
        }
コード例 #2
0
        /// <summary>
        /// Поиск архитектурных планов в Модели.
        /// Запускает транзакцию.
        /// </summary>            
        public static List<FloorArchitect> GetAllPlanes(Database db, BaseService service)
        {
            List<FloorArchitect> floorsAr = new List<FloorArchitect>();

             using (var t = db.TransactionManager.StartTransaction())
             {
            var ms = SymbolUtilityServices.GetBlockModelSpaceId(db).GetObject( OpenMode.ForRead) as BlockTableRecord;
            foreach (ObjectId idEnt in ms)
            {
               var blRefArPlan = idEnt.GetObject(OpenMode.ForRead, false, true) as BlockReference;
               if (blRefArPlan == null) continue;

               if (blRefArPlan.Name.StartsWith(Settings.Default.BlockPlaneArchitectPrefixName, StringComparison.CurrentCultureIgnoreCase))
               {
                  FloorArchitect floorAr = new FloorArchitect(blRefArPlan, service);
                  floorsAr.Add(floorAr);
               }
            }
            t.Commit();
             }
             return floorsAr;
        }