Exemple #1
0
        public static List <string> GetFilterRuleType(RevitElements.Element ParameterFilterElement)
        {
            DB.Document   doc             = DocumentManager.Instance.CurrentDBDocument;
            List <string> filterRulesType = new List <string>();

            DB.ParameterFilterElement parameterFilterElement = (DB.ParameterFilterElement)ParameterFilterElement.InternalElement;
            ElementLogicalFilter      elementFilter          = parameterFilterElement.GetElementFilter() as ElementLogicalFilter;

            IList <ElementFilter> efs = elementFilter.GetFilters();

            foreach (ElementFilter ef in efs)
            {
                ElementParameterFilter epf = ef as ElementParameterFilter;
                foreach (FilterRule r in epf.GetRules())
                {
                    if (r is FilterDoubleRule)
                    {
                        filterRulesType.Add("FilterDoubleRule");
                    }
                    else if (r is FilterStringRule)
                    {
                        filterRulesType.Add("FilterStringRule");
                    }
                    else if (r is FilterIntegerRule)
                    {
                        filterRulesType.Add("FilterIntegerRule");
                    }
                    else if (r is FilterGlobalParameterAssociationRule)
                    {
                        filterRulesType.Add("FilterGlobalParameterAssociationRule");
                    }
                    else if (r is FilterInverseRule)
                    {
                        filterRulesType.Add("FilterInverseRule");
                    }
                    else if (r is SharedParameterApplicableRule)
                    {
                        filterRulesType.Add("SharedParameterApplicableRule");
                    }
                }
            }
            return(filterRulesType);
        }
Exemple #2
0
        public static List <string> GetFilterRuleMethod(RevitElements.Element ParameterFilterElement)
        {
            DB.Document   doc = DocumentManager.Instance.CurrentDBDocument;
            List <string> filterRulesEvaluatorType = new List <string>();

            DB.ParameterFilterElement parameterFilterElement = (DB.ParameterFilterElement)ParameterFilterElement.InternalElement;
            ElementLogicalFilter      elementFilter          = parameterFilterElement.GetElementFilter() as ElementLogicalFilter;

            IList <ElementFilter> efs = elementFilter.GetFilters();

            foreach (ElementFilter ef in efs)
            {
                ElementParameterFilter epf = ef as ElementParameterFilter;
                foreach (FilterRule r in epf.GetRules())
                {
                    string ruleMethod = FilterRuleMethod(CastFilterRule(r));
                    filterRulesEvaluatorType.Add(ruleMethod);
                }
            }
            return(filterRulesEvaluatorType);
        }