Exemple #1
0
        public static ElementFilter GetElementFilter(this ParameterFilterElement parameterFilter)
        {
            var filters = new List <ElementFilter>()
            {
                new ElementMulticategoryFilter(parameterFilter.GetCategories())
            };

            foreach (var rule in parameterFilter.GetRules())
            {
                filters.Add(new ElementParameterFilter(rule));
            }

            return(new LogicalAndFilter(filters));
        }
        private bool CanPassFilterRules(ParameterFilterElement filter, ElementId elemId)
        {
            Element elem = CurrentDocument.GetElement(elemId);

            if (elem == null)
            {
                return(false);
            }

            bool bPassed = true;

            foreach (FilterRule rule in filter.GetRules())
            {
                if (!rule.ElementPasses(elem))
                {
                    bPassed = false;
                    break;
                }
            }

            return(bPassed);
        }
Exemple #3
0
 /// <summary>
 /// Initialize from a Filter object.
 /// </summary>
 /// <param name="filterElement"></param>
 public FilterST(ParameterFilterElement filterElement)
 {
     Name        = filterElement.Name;
     Categories  = filterElement.GetCategories();
     FilterRules = filterElement.GetRules().ToList();
 }