Create FilterRule: get "ParameterId" without elements
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm writing an application for batch creating ViewFilters (ParameterFilterElement).
For creating filter I want to create FilterRule:
FilterRule stringRule = ParameterFilterRuleFactory.CreateEqualsRule(ParameterId, StringValue, true);
How to get "ParameterId" for shared parameter?
SDK contains two examples:
- for BuiltIn Parameter:
-
ElementId ParamId = new ElementId(BuiltInParameter.FUNCTION_PARAM);
- for SharedParameter:
Wall wall = new FilteredElementCollector(doc).OfClass(typeof(Wall)).FirstElement() as Wall; Parameter sharedParam = wall.get_Parameter(spGuid); ElementId sharedParamId = sharedParam.Id;
OMG: create collector for all elements in model, get one element, get parameter from this element? I think this is a bad way.
If model have no element - collector will be empty, I can't get Parameter and create Rule, other problem is possible.
Is there an another way to get ParameterId? Without elements and collectors, as for BuiltIn Parameter.
For example, by the Definition, BindingMap, etc. After all, manually in Revit interface I can create Rule, even if there is no element in the model.
Thanks.
Alexander Zuev
In BIM we trust
Facebook | Linkedin | Telegram