Hey. I found a strange bug in RevitAPI. When creating a FilterStringRule rule, I specify that the comparison should not be case sensitive (caseSensitive: false). But the comparison is done with case sensitivity. I put it in a separate code, where there is nothing else, and checked. Any ideas?
[Transaction(TransactionMode.Manual)]
public class Command : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Application app = uiapp.Application;
Document doc = uidoc.Document;
ParameterValueProvider pvp = new ParameterValueProvider(new ElementId(1236953));
FilterStringRule rule = new FilterStringRule(pvp, new FilterStringContains(), "вчшг", caseSensitive: false);
Element elem = doc.GetElement(new ElementId(1664890));
Parameter p = elem.GetParameters("Наименование").FirstOrDefault();
Debug.Print($"parameter value: '{p.AsString()}'");
Debug.Print($"check: {rule.ElementPasses(elem)}");
// Output message:
// parameter value: 'Труба чугунная напорная ВЧШГ 150 мм'
// check: False
return Result.Succeeded;
}
}