Example #1
0
        public SelectColumnSamePlaceViewModel(UIDocument uidoc)
        {
            // Lưu trữ data từ Revit
            UiDoc = uidoc;
            Doc   = UiDoc.Document;

            // Lấy về Columns
            try
            {
                IEnumerable <Category> categories = new List <Category>
                {
                    Category.GetCategory(Doc, BuiltInCategory.OST_StructuralColumns),
                    Category.GetCategory(Doc, BuiltInCategory.OST_Columns),
                    Category.GetCategory(Doc, BuiltInCategory.OST_Walls),
                };

                FirstElements = KDXQqeontLCGWXe.PickObjects(UiDoc, new NelWeZOVFbiLttv(categories),
                                                            "Select the first Column/Wall", true);
            }
            catch (Exception)
            {
                return;
            }

            // khởi tạo data cho WPF

            AllLevel = new FilteredElementCollector(Doc)
                       .OfClass(typeof(Level))
                       .Cast <Level>().ToList();
            AllLevel = AllLevel.OrderBy(l => l.Elevation)
                       .ToList();

            try
            {
                FromLevel = AllLevel[0];
                ToLevel   = AllLevel[1];
            }
            catch (Exception)
            {
            }
        }
        /// <summary>
        /// Update số lượng elements được chọn để lấy value parameter
        /// </summary>
        public void UpdateScope()
        {
            currentSelection = uidoc.Selection.GetElementIds().ToList();
            //if (expr)
            //{

            //}


            _allInstanceElements =
                KDXQqeontLCGWXe.GetModelElements(doc, IsCurrentView,
                                                 IsCurrentSelection, currentSelection);

            _allFamilySymbol =
                _allInstanceElements.Select(e => e?.GetElementType())
                .Distinct(new EAArFxukdmItCtf()).ToList();

            UpdateAllValueParameters01();
            //UpdateAllParameters02();
            UpdateAllValueParameters02();
            //UpdateAllParameters03();
            UpdateAllValueParameters03();
        }