private void AddAppliableCategories(List <ElementId> defaultCategories)
 {
     //IL_001e: Unknown result type (might be due to invalid IL or missing references)
     //IL_0023: Unknown result type (might be due to invalid IL or missing references)
     //IL_0025: Unknown result type (might be due to invalid IL or missing references)
     //IL_002a: Unknown result type (might be due to invalid IL or missing references)
     //IL_002b: Unknown result type (might be due to invalid IL or missing references)
     //IL_0030: Unknown result type (might be due to invalid IL or missing references)
     //IL_0032: Unknown result type (might be due to invalid IL or missing references)
     //IL_003a: Unknown result type (might be due to invalid IL or missing references)
     //IL_003c: Unknown result type (might be due to invalid IL or missing references)
     //IL_0048: Unknown result type (might be due to invalid IL or missing references)
     //IL_004a: Unknown result type (might be due to invalid IL or missing references)
     //IL_0060: Unknown result type (might be due to invalid IL or missing references)
     this.checkedListBox2.Items.Clear();
     foreach (ElementId allFilterableCategory in ParameterFilterUtilities.GetAllFilterableCategories())
     {
         try
         {
             Category category = Category.GetCategory(this.doc, allFilterableCategory);
             if (!defaultCategories.Contains(allFilterableCategory) && category.get_AllowsVisibilityControl(this.view))
             {
                 category.set_Visible(this.view, false);
                 this.checkedListBox2.Items.Add(EnumParseUtility <BuiltInCategory> .Parse(allFilterableCategory.get_IntegerValue()));
             }
         }
         catch
         {
             Console.WriteLine("Coś poszło nie tak");
         }
     }
 }
예제 #2
0
        /// <summary>
        /// This method will reset Category check list box with all applicable categories with document
        /// </summary>
        void AddAppliableCategories()
        {
            categoryCheckedListBox.Items.Clear();
            ICollection <ElementId> filterCatIds = ParameterFilterUtilities.GetAllFilterableCategories();

            foreach (ElementId id in filterCatIds)
            {
                categoryCheckedListBox.Items.Add(EnumParseUtility <BuiltInCategory> .Parse((BuiltInCategory)id.IntegerValue));
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            //IL_000e: Unknown result type (might be due to invalid IL or missing references)
            //IL_0013: Unknown result type (might be due to invalid IL or missing references)
            //IL_0015: Unknown result type (might be due to invalid IL or missing references)
            //IL_001a: Unknown result type (might be due to invalid IL or missing references)
            //IL_001b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0020: Unknown result type (might be due to invalid IL or missing references)
            //IL_0021: Unknown result type (might be due to invalid IL or missing references)
            //IL_0023: Unknown result type (might be due to invalid IL or missing references)
            //IL_002f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0031: Unknown result type (might be due to invalid IL or missing references)
            //IL_008b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0090: Unknown result type (might be due to invalid IL or missing references)
            //IL_0099: Unknown result type (might be due to invalid IL or missing references)
            //IL_00a7: Unknown result type (might be due to invalid IL or missing references)
            //IL_00aa: Unknown result type (might be due to invalid IL or missing references)
            //IL_010a: Unknown result type (might be due to invalid IL or missing references)
            //IL_010f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0112: Unknown result type (might be due to invalid IL or missing references)
            //IL_0117: Unknown result type (might be due to invalid IL or missing references)
            //IL_0119: Unknown result type (might be due to invalid IL or missing references)
            //IL_011f: Unknown result type (might be due to invalid IL or missing references)
            foreach (ElementId allFilterableCategory in ParameterFilterUtilities.GetAllFilterableCategories())
            {
                try
                {
                    Category category = Category.GetCategory(this.doc, allFilterableCategory);
                    if (category.get_AllowsVisibilityControl(this.view))
                    {
                        category.set_Visible(this.view, false);
                    }
                }
                catch
                {
                    Console.WriteLine("Coś poszło nie tak");
                }
            }
            foreach (object checkedItem in this.checkedListBox1.CheckedItems)
            {
                foreach (Category defaultCategory in this.defaultCategories)
                {
                    if (checkedItem.ToString() == defaultCategory.get_Name())
                    {
                        defaultCategory.set_Visible(this.view, true);
                    }
                }
            }
            foreach (object checkedItem2 in this.checkedListBox2.CheckedItems)
            {
                BuiltInCategory val = EnumParseUtility <BuiltInCategory> .Parse(checkedItem2.ToString());

                try
                {
                    Category.GetCategory(this.doc, val).set_Visible(this.view, true);
                }
                catch
                {
                    Console.WriteLine("Coś poszło nie tak");
                }
            }
        }
예제 #4
0
        private void DisplayCategories()
        {
            try
            {
                Categories categories = m_doc.Settings.Categories;
                List <CategoryProperties> spaceCategoryList = new List <CategoryProperties>();
                BuiltInCategory           bltRoom           = BuiltInCategory.OST_Rooms;
                Category roomCat = categories.get_Item(bltRoom);
                if (null != roomCat)
                {
                    CategoryProperties cp = new CategoryProperties(roomCat);
                    cp.ParamDictionary = GetParameterProperties(roomCat);
                    if (cp.ParamDictionary.Count > 0)
                    {
                        spaceCategoryList.Add(cp);
                    }
                }

                BuiltInCategory bltSpace = BuiltInCategory.OST_MEPSpaces;
                Category        spaceCat = categories.get_Item(bltSpace);
                if (null != spaceCat)
                {
                    CategoryProperties cp = new CategoryProperties(spaceCat);
                    cp.ParamDictionary = GetParameterProperties(spaceCat);
                    if (cp.ParamDictionary.Count > 0)
                    {
                        spaceCategoryList.Add(cp);
                    }
                }

                comboBoxSpace.ItemsSource       = spaceCategoryList;
                comboBoxSpace.DisplayMemberPath = "CategoryName";
                comboBoxSpace.SelectedIndex     = 0;

                List <CategoryProperties> elementCategoryList = new List <CategoryProperties>();
                List <ElementId>          filterCatIds        = ParameterFilterUtilities.GetAllFilterableCategories().ToList();
                foreach (ElementId id in filterCatIds)
                {
                    try
                    {
                        BuiltInCategory bltCat   = (BuiltInCategory)id.IntegerValue;
                        Category        category = categories.get_Item(bltCat);
                        if (null != category)
                        {
                            if (null != category.Parent)
                            {
                                continue;
                            }                                          //skip subcategories
                            if (bltCat == BuiltInCategory.OST_Rooms || bltCat == BuiltInCategory.OST_MEPSpaces)
                            {
                                continue;
                            }

                            if (category.HasMaterialQuantities)
                            {
                                if (category.CategoryType == CategoryType.Model)
                                {
                                    CategoryProperties cp = new CategoryProperties(category);
                                    cp.ParamDictionary = GetParameterProperties(category);
                                    if (cp.ParamDictionary.Count > 0)
                                    {
                                        elementCategoryList.Add(cp);
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        string message = ex.Message;
                    }
                }

                elementCategoryList             = elementCategoryList.OrderBy(o => o.CategoryName).ToList();
                comboBoxRevit.ItemsSource       = elementCategoryList;
                comboBoxRevit.DisplayMemberPath = "CategoryName";
                comboBoxRevit.SelectedIndex     = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to display categories.\n" + ex.Message, "Display Categories", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }