Thank you!
i want to use string variables because I want to state the settings like ElementCategory, ElementClass, ElementParameters, etc. in an Excel or txt file, and let the programme reads the settings. The users can change the settings but not the programme.
The Reference Code Snippet provided by you still requires to hardcode the class name ViewSchedule. In that case, I may as well just use it directly.
Using a Dictionary would require me to know all the key-value pairs of possible classes. I do not know how to get a list of valid class names.
The simplest but not complete solution would then be using the following for the already known and required classes:
if (classname == "ViewSchedule")
{
ElementClassFilter elementClassFilter = new ElementClasssFilter(typeof(ViewSchedule));
}
else if ....
By the way, Revit Python Wrapper gives the flexibility:
Coerces a class or class reference to a Class.
>>> from rpw.utils.coerce import to_class
>>> to_class('Wall')
[ DB.Wall ]
>>> to_class(Wall)
[ DB.Wall ]