Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
I want to get each element that does not yet have "theValue" for a specific parameter. In the following code example i filter for elements that DO have the value, how do i reverse/invert this to get what i need?
FilteredElementCollector fec = new FilteredElementCollector(doc);
var elements = fec.ToElements();
var id = elements[0].LookupParameter("IfcName").Id;
ParameterValueProvider pvp = new ParameterValueProvider(id);
var fsc = new FilterStringEquals();
var ruleValue = "theValue";
var frule = new FilterStringRule(pvp, fsc, ruleValue, false);
var filter = new ElementParameterFilter(frule);
fec = fec.WherePasses(filter);
Solved! Go to Solution.
Solved by naveen.kumar.t. Go to Solution.
Hi @m.mastbergen ,
You can use the FilterInverseRule
https://www.revitapidocs.com/2023/bd21b884-c026-5a16-4470-72172b71db4a.htm
Here is the sample code
Can't find what you're looking for? Ask the community or share your knowledge.