예제 #1
0
        /// <summary>
        /// Reset rules because categories were changed
        /// </summary>
        void ResetRule_CategoriesChanged()
        {
            // Initialize all supported parameters for selected categories
            ICollection <BuiltInCategory> filterCat    = m_currentFilterData.FilterCategories;
            ICollection <ElementId>       filterCatIds = new List <ElementId>();

            foreach (BuiltInCategory curCat in filterCat)
            {
                filterCatIds.Add(new ElementId(curCat));
            }
            ICollection <ElementId> supportedParams =
                ParameterFilterUtilities.GetFilterableParametersInCommon(m_doc, filterCatIds);

            ResetParameterCombox(supportedParams);
            //
            // Reset filter rules controls and select 1st by default(if have)
            rulesListBox.Items.Clear();
            List <FilterRuleBuilder> ruleData = m_currentFilterData.RuleData;

            for (int ii = 1; ii <= ruleData.Count; ii++)
            {
                rulesListBox.Items.Add(m_ruleNamePrefix + ii);
            }
            if (rulesListBox.Items.Count > 0)
            {
                rulesListBox.SetSelected(0, true);
            }
            else
            {
                ResetControls_NoFilterRule();
            }
        }
예제 #2
0
        public static ObservableCollection <ParameterObject> GetParametersOfCategories(string documentGuid, ObservableCollection <CategoryObject> categoryObjects)
        {
            // We'll return this ObservableCollection of ParameterObjects straight for UI consumption
            ObservableCollection <ParameterObject> parameterObjects = new ObservableCollection <ParameterObject>();

            List <ElementId> categoryIds = categoryObjects
                                           .Where(x => x.IsChecked)
                                           .Select(x => x.CategoryObjectId)
                                           .Select(x => new ElementId(x))
                                           .ToList();

            Document document = RegularApp.DocumentCacheService.GetDocument(documentGuid);

            // Trying to only retrieve parameter of string type
            List <ElementId> parameterIds = ParameterFilterUtilities.GetFilterableParametersInCommon(document, categoryIds).ToList();

            foreach (ElementId parameterId in parameterIds)
            {
                parameterObjects.Add
                (
                    new ParameterObject
                {
                    ParameterObjectId   = parameterId.IntegerValue,
                    ParameterObjectName = GetParameterName(document, parameterId)
                }
                );
            }
            return(new ObservableCollection <ParameterObject>(parameterObjects.OrderBy(x => x.ParameterObjectName)));
        }
예제 #3
0
        /// <summary>
        /// Set new categories, this method will possibly update existing criteria
        /// </summary>
        /// <param name="newCatIds">New categories for current filter.</param>
        /// <returns>true if categories or criteria are changed; otherwise false.</returns>
        /// <remarks>
        /// If someone parameter of criteria cannot be supported by new categories,
        /// the old criteria will be cleaned and set to empty
        /// </remarks>
        public bool SetNewCategories(ICollection <ElementId> newCatIds)
        {
            // do nothing if new categories are equals to old categories
            List <BuiltInCategory> newCats = new List <BuiltInCategory>();

            foreach (ElementId catId in newCatIds)
            {
                newCats.Add((BuiltInCategory)catId.IntegerValue);
            }
            if (ListCompareUtility <BuiltInCategory> .Equals(newCats, m_filterCategories))
            {
                return(false);
            }
            m_filterCategories = newCats; // update categories
            //
            // Check if need to update file rules:
            // . if filer rule is empty, do nothing
            // . if some parameters of rules cannot be supported by new categories, clean all old rules
            ICollection <ElementId> supportParams =
                ParameterFilterUtilities.GetFilterableParametersInCommon(m_doc, newCatIds);

            foreach (FilterRuleBuilder rule in m_filterRules)
            {
                if (!supportParams.Contains(new ElementId(rule.Parameter)))
                {
                    m_filterRules.Clear();
                    break;
                }
            }
            return(true);
        }
 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");
         }
     }
 }
예제 #5
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));
            }
        }
        public FilterDataForRebars(Document doc)
        {
            //определю, это шаблоне weandrevit или сторонний
            List <ElementId> rebarCategoryIds = new List <ElementId> {
                new ElementId(BuiltInCategory.OST_Rebar)
            };
            List <ElementId> paramsRebar = ParameterFilterUtilities.GetFilterableParametersInCommon(doc, rebarCategoryIds).ToList();

            _rebarIsFamilyParamExists = false;
            foreach (ElementId paramid in paramsRebar)
            {
                string paramName = ViewUtils.GetParamName(doc, paramid);
                if (paramName == rebarIsFamilyParamName)
                {
                    _rebarIsFamilyParamExists = true;
                    break;
                }
            }
        }
예제 #7
0
        /// <summary>
        /// Полный список доступных для фильтрации параметров у каждой категории
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="elements"></param>
        /// <returns></returns>
        public static List <MyParameter> GetAllFilterableParameters(Document doc, List <Element> elements)
        {
            HashSet <ElementId> catsIds = GetElementsCategories(elements);

            Dictionary <ElementId, HashSet <ElementId> > paramsAndCats = new Dictionary <ElementId, HashSet <ElementId> >();


            foreach (ElementId catId in catsIds)
            {
                List <ElementId> curCatIds = new List <ElementId> {
                    catId
                };
                List <ElementId> paramsIds = ParameterFilterUtilities.GetFilterableParametersInCommon(doc, curCatIds).ToList();

                foreach (ElementId paramId in paramsIds)
                {
                    if (paramsAndCats.ContainsKey(paramId))
                    {
                        paramsAndCats[paramId].Add(catId);
                    }
                    else
                    {
                        paramsAndCats.Add(paramId, new HashSet <ElementId> {
                            catId
                        });
                    }
                }
            }

            List <MyParameter> mparams = new List <MyParameter>();

            foreach (KeyValuePair <ElementId, HashSet <ElementId> > kvp in paramsAndCats)
            {
                ElementId   paramId   = kvp.Key;
                string      paramName = GetParamName(doc, paramId);
                MyParameter mp        = new MyParameter(paramId, paramName, kvp.Value.ToList());
                mparams.Add(mp);
            }

            mparams = mparams.OrderBy(i => i.Name).ToList();
            return(mparams);
        }
예제 #8
0
        public List <RevitParameter> GetFilterByCategory(List <ElementId> valValue)
        {
            List <RevitParameter> vResult = new List <RevitParameter>();

            foreach (var vData in valValue.AsParallel())
            {
                List <ElementId> vFilter = new List <ElementId>();
                vFilter.Add(vData);
                var vList = ParameterFilterUtilities.GetFilterableParametersInCommon(_Doc, vFilter);
                //Category vCategory = _Doc.Settings.Categories.get_Item((BuiltInCategory)vData.IntegerValue);
                foreach (ElementId vElementId in vList.AsParallel())
                {
                    RevitParameter vRecord = new RevitParameter();
                    string         vName   = string.Empty;
                    if (vResult.Where(p => p.Id == vElementId.IntegerValue).Count() == 0)
                    {
                        if (vElementId.IntegerValue < 0)
                        {
                            vName = LabelUtils.GetLabelFor((BuiltInParameter)vElementId.IntegerValue).Trim();
                        }
                        else
                        {
                            vName = _Doc.GetElement(vElementId).Name.Trim();
                        }



                        vRecord.Id        = vElementId.IntegerValue;
                        vRecord.ElementId = vElementId;
                        vRecord.Name      = vName;
                        //vRecord.Definition = vElementId;

                        vResult.Add(vRecord);
                    }
                }
            }
            return(vResult);
        }
        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");
                }
            }
        }
예제 #10
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);
            }
        }
예제 #11
0
        private Dictionary <string, ParameterProperties> GetParameterProperties(Category category)
        {
            Dictionary <string, ParameterProperties> paramDictionary = new Dictionary <string, ParameterProperties>();

            try
            {
                Element     firstElement           = null;
                ElementType firstTypeElement       = null;
                FilteredElementCollector collector = new FilteredElementCollector(m_doc);
                List <Element>           elements  = collector.OfCategoryId(category.Id).WhereElementIsNotElementType().ToElements().ToList();

                if (elements.Count > 0)
                {
                    firstElement     = elements.First();
                    firstTypeElement = m_doc.GetElement(firstElement.GetTypeId()) as ElementType;
                }
                else
                {
                    return(paramDictionary);
                }

                List <ElementId> categoryIds = new List <ElementId>();
                categoryIds.Add(category.Id);

                //add builtIn Parameter
                ICollection <ElementId> supportedParams = ParameterFilterUtilities.GetFilterableParametersInCommon(m_doc, categoryIds);
                foreach (ElementId eId in supportedParams)
                {
                    if (eId.IntegerValue < 0)
                    {
                        BuiltInParameter bltParam  = (BuiltInParameter)eId.IntegerValue;
                        string           paramName = LabelUtils.GetLabelFor(bltParam);

                        if (paramName.Contains("Extensions."))
                        {
                            continue;
                        }

                        ParameterProperties pp    = null;
                        Parameter           param = firstElement.LookupParameter(paramName);

                        if (null != param)
                        {
                            pp              = new ParameterProperties(param);
                            pp.IsInstance   = true;
                            pp.BltParameter = bltParam;
                            if (!paramDictionary.ContainsKey(pp.ParameterName))
                            {
                                paramDictionary.Add(pp.ParameterName, pp);
                            }
                        }
                        else if (null != firstTypeElement)
                        {
                            param = firstTypeElement.LookupParameter(paramName);

                            if (null != param)
                            {
                                pp              = new ParameterProperties(param);
                                pp.IsInstance   = false;
                                pp.BltParameter = bltParam;
                                if (!paramDictionary.ContainsKey(pp.ParameterName))
                                {
                                    paramDictionary.Add(pp.ParameterName, pp);
                                }
                            }
                        }
                    }
                }
                //add project parameter
                if (projectParameters.ContainsKey(category.Name))
                {
                    Dictionary <string, ParameterProperties> dictionary = projectParameters[category.Name];
                    foreach (string paramName in dictionary.Keys)
                    {
                        if (paramName.Contains("Extensions."))
                        {
                            continue;
                        }

                        ParameterProperties property = dictionary[paramName];
                        if (property.IsInstance && null != firstTypeElement)
                        {
                            Parameter param = firstElement.LookupParameter(property.ParameterName);

                            if (null != param)
                            {
                                ParameterProperties pp = new ParameterProperties(param);
                                pp.IsInstance = true;

                                if (!paramDictionary.ContainsKey(pp.ParameterName))
                                {
                                    paramDictionary.Add(pp.ParameterName, pp);
                                }
                            }
                        }
                        else if (null != firstTypeElement)
                        {
                            Parameter param = firstTypeElement.LookupParameter(property.ParameterName);

                            if (null != param)
                            {
                                ParameterProperties pp = new ParameterProperties(param);
                                pp.IsInstance = false;
                                if (!paramDictionary.ContainsKey(pp.ParameterName))
                                {
                                    paramDictionary.Add(pp.ParameterName, pp);
                                }
                            }
                        }
                    }
                }

                //add family parameter
                //sorting
                collector = new FilteredElementCollector(m_doc);
                ICollection <ElementId> familyInstanceIds = collector.OfCategoryId(category.Id).OfClass(typeof(FamilyInstance)).ToElementIds();
                collector = new FilteredElementCollector(m_doc);
                List <FamilySymbol> familySymbols = collector.OfCategoryId(category.Id).OfClass(typeof(FamilySymbol)).ToElements().Cast <FamilySymbol>().ToList();
                List <string>       familyNames   = new List <string>();

                if (familyInstanceIds.Count > 0)
                {
                    foreach (FamilySymbol symbol in familySymbols)
                    {
                        string familyName = symbol.Family.Name;
                        if (!string.IsNullOrEmpty(familyName))
                        {
                            if (!familyNames.Contains(familyName))
                            {
                                FamilyInstanceFilter instanceFilter = new FamilyInstanceFilter(m_doc, symbol.Id);
                                collector = new FilteredElementCollector(m_doc, familyInstanceIds);
                                List <Element> familyInstances = collector.WherePasses(instanceFilter).ToElements().ToList();
                                if (familyInstances.Count > 0)
                                {
                                    FamilyInstance firstFamilyInstance = familyInstances.First() as FamilyInstance;
                                    foreach (Parameter param in firstFamilyInstance.Parameters)
                                    {
                                        if (param.Id.IntegerValue > 0)
                                        {
                                            ParameterProperties pp = new ParameterProperties(param);
                                            pp.IsInstance = true;
                                            if (!paramDictionary.ContainsKey(pp.ParameterName) && !pp.ParameterName.Contains("Extensions."))
                                            {
                                                paramDictionary.Add(pp.ParameterName, pp);
                                            }
                                        }
                                    }

                                    FamilySymbol firstFamilySymbol = firstFamilyInstance.Symbol;
                                    foreach (Parameter param in firstFamilySymbol.Parameters)
                                    {
                                        if (param.Id.IntegerValue > 0)
                                        {
                                            ParameterProperties pp = new ParameterProperties(param);
                                            pp.IsInstance = false;
                                            if (!paramDictionary.ContainsKey(pp.ParameterName) && !pp.ParameterName.Contains("Extensions."))
                                            {
                                                paramDictionary.Add(pp.ParameterName, pp);
                                            }
                                        }
                                    }
                                }
                                familyNames.Add(familyName);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to get parameter properties.\n" + ex.Message, "Get Parameter Properties", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            return(paramDictionary);
        }
        private static ParameterInfo GetParameterInfo(Document doc, string categoryName, string parameterName)
        {
            ParameterInfo paramInfo = null;

            try
            {
                Categories            categories = doc.Settings.Categories;
                Category              category   = categories.get_Item(categoryName);
                ElementCategoryFilter catFilter  = new ElementCategoryFilter(category.Id);

                FilteredElementCollector collector = new FilteredElementCollector(doc);
                List <Element>           elements  = collector.WherePasses(catFilter).WhereElementIsNotElementType().ToElements().ToList();
                if (elements.Count > 0)
                {
                    Element   element = elements.First();
                    Parameter param   = element.LookupParameter(parameterName);
                    if (null != param)
                    {
                        paramInfo = new ParameterInfo(param);
                        return(paramInfo);
                    }
                }
                else
                {
                    List <ElementId> categoryIds = new List <ElementId>();
                    categoryIds.Add(category.Id);
                    List <ElementId> parameterIds = ParameterFilterUtilities.GetFilterableParametersInCommon(doc, categoryIds).ToList();

                    if (parameterName == "Comments")
                    {
                        paramInfo = new ParameterInfo();
                        paramInfo.ParameterName    = "Comments";
                        paramInfo.ParamStorageType = StorageType.String;
                        paramInfo.ParamType        = ParameterType.Text;
                        return(paramInfo);
                    }


                    if (parameterName == "Mark")
                    {
                        paramInfo = new ParameterInfo();
                        paramInfo.ParameterName    = "Mark";
                        paramInfo.ParamStorageType = StorageType.String;
                        paramInfo.ParamType        = ParameterType.Text;
                        return(paramInfo);
                    }


                    DefinitionBindingMapIterator bindingMapIterator = doc.ParameterBindings.ForwardIterator();
                    while (bindingMapIterator.MoveNext())
                    {
                        InstanceBinding binding = bindingMapIterator.Current as InstanceBinding;
                        if (null != binding)
                        {
                            if (binding.Categories.Contains(category))
                            {
                                Definition paramDefinition = bindingMapIterator.Key;
                                if (paramDefinition.Name == parameterName)
                                {
                                    paramInfo = new ParameterInfo();
                                    paramInfo.ParameterName = paramDefinition.Name;
                                    paramInfo.ParamType     = paramDefinition.ParameterType;
                                    return(paramInfo);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to get parameter information.\n" + ex.Message, "Get Parameter Info", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            return(paramInfo);
        }
예제 #13
0
        private void GetParameterInformation()
        {
            try
            {
                Categories categories = m_doc.Settings.Categories;
                hostParameters = new List <ParameterInfo>();
                if (!string.IsNullOrEmpty(massConfig.HostCategory))
                {
                    Category         hostCategory = categories.get_Item(massConfig.HostCategory);
                    BuiltInCategory  bltCategory  = (BuiltInCategory)hostCategory.Id.IntegerValue;
                    List <ElementId> categoryIds  = new List <ElementId>();
                    categoryIds.Add(hostCategory.Id);
                    List <ElementId> parameterIds = ParameterFilterUtilities.GetFilterableParametersInCommon(m_doc, categoryIds).ToList();

                    //get sample element
                    FilteredElementCollector collector = new FilteredElementCollector(m_doc);
                    List <Element>           elements  = collector.OfCategory(bltCategory).WhereElementIsNotElementType().ToElements().ToList();
                    if (elements.Count > 0)
                    {
                        Element sampleElement = elements.First();
                        foreach (Parameter param in sampleElement.Parameters)
                        {
                            if (param.Definition.Name.Contains("Extensions."))
                            {
                                continue;
                            }
                            if (parameterIds.Contains(param.Id))
                            {
                                ParameterInfo paramInfo = new ParameterInfo(param);
                                hostParameters.Add(paramInfo);
                            }
                        }
                    }
                }
                hostParameters = hostParameters.OrderBy(o => o.ParameterName).ToList();

                massParameters = new List <ParameterInfo>();
                if (!string.IsNullOrEmpty(massConfig.MassCategory))
                {
                    Category         massCategory = categories.get_Item(massConfig.MassCategory);
                    BuiltInCategory  bltCategory  = (BuiltInCategory)massCategory.Id.IntegerValue;
                    List <ElementId> categoryIds  = new List <ElementId>();
                    categoryIds.Add(massCategory.Id);
                    List <ElementId> parameterIds = ParameterFilterUtilities.GetFilterableParametersInCommon(m_doc, categoryIds).ToList();
                    //get sample element
                    FilteredElementCollector collector = new FilteredElementCollector(m_doc);
                    List <Element>           elements  = collector.OfCategory(bltCategory).WhereElementIsNotElementType().ToElements().ToList();
                    if (elements.Count > 0)
                    {
                        Element sampleElement = elements.First();
                        foreach (Parameter param in sampleElement.Parameters)
                        {
                            if (param.Definition.Name.Contains("Extensions."))
                            {
                                continue;
                            }
                            if (parameterIds.Contains(param.Id))
                            {
                                ParameterInfo paramInfo = new ParameterInfo(param);
                                massParameters.Add(paramInfo);
                            }
                        }
                    }
                    else
                    {
                        if (parameterIds.Contains(new ElementId((int)BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS)))
                        {
                            ParameterInfo commentsParamInfo = new ParameterInfo();
                            commentsParamInfo.ParameterName    = "Comments";
                            commentsParamInfo.ParamStorageType = StorageType.String;
                            commentsParamInfo.ParamType        = ParameterType.Text;
                            massParameters.Add(commentsParamInfo);
                        }


                        if (parameterIds.Contains(new ElementId((int)BuiltInParameter.ALL_MODEL_MARK)))
                        {
                            ParameterInfo markParamInfo = new ParameterInfo();
                            markParamInfo.ParameterName    = "Mark";
                            markParamInfo.ParamStorageType = StorageType.String;
                            markParamInfo.ParamType        = ParameterType.Text;
                            massParameters.Add(markParamInfo);
                        }


                        DefinitionBindingMapIterator bindingMapIterator = m_doc.ParameterBindings.ForwardIterator();

                        while (bindingMapIterator.MoveNext())
                        {
                            InstanceBinding binding = bindingMapIterator.Current as InstanceBinding;
                            if (null != binding)
                            {
                                if (binding.Categories.Contains(massCategory))
                                {
                                    Definition paramDefinition = bindingMapIterator.Key;
                                    if (paramDefinition.Name.Contains("Extensions."))
                                    {
                                        continue;
                                    }
                                    ParameterInfo paramInfo = new ParameterInfo();
                                    paramInfo.ParameterName = paramDefinition.Name;
                                    paramInfo.ParamType     = paramDefinition.ParameterType;
                                    massParameters.Add(paramInfo);
                                }
                            }
                        }
                    }
                }
                massParameters = massParameters.OrderBy(o => o.ParameterName).ToList();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to get parameter information.\n" + ex.Message, "Get Parameter Information", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }