ViewSetFilterOverrides Method |
Sets the overrides associated with a filter.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 27.0.4.0 (27.0.4.0)
Syntaxpublic void SetFilterOverrides(
ElementId filterElementId,
OverrideGraphicSettings overrideGraphicSettings
)
Public Sub SetFilterOverrides (
filterElementId As ElementId,
overrideGraphicSettings As OverrideGraphicSettings
)
public:
void SetFilterOverrides(
ElementId^ filterElementId,
OverrideGraphicSettings^ overrideGraphicSettings
)
member SetFilterOverrides :
filterElementId : ElementId *
overrideGraphicSettings : OverrideGraphicSettings -> unit Parameters
- filterElementId ElementId
-
ElementId of the filter.
- overrideGraphicSettings OverrideGraphicSettings
-
The overrides to apply to the filter.
Exceptions| Exception | Condition |
|---|
| ArgumentException |
ElementId is not associated with a FilterElement.
-or-
Fill pattern must be a drafting pattern.
-or-
Fill pattern Id must be invalidElementId or point to a LinePattern element.
|
| ArgumentNullException |
A non-optional argument was null
|
| InvalidOperationException |
The element "this View" does not belong to a project document.
-or-
The view type does not support Visibility/Graphics Overriddes.
|
Remarks
If the filter is not currently applied to the view, this will add the filter with the assigned overrides.
Examplepublic static void ModifyExistingFilter(Document doc, View view)
{
Dictionary<ElementId, OverrideGraphicSettings> filterIdsToChange = new Dictionary<ElementId, OverrideGraphicSettings>();
foreach (ElementId filterId in view.GetFilters())
{
OverrideGraphicSettings overrideSettings = view.GetFilterOverrides(filterId);
Color lineColor = overrideSettings.CutLineColor;
if (lineColor == Color.InvalidColorValue)
continue;
if (lineColor.Red == 0xFF && lineColor.Green == 0x00 && lineColor.Blue == 0x00)
{
overrideSettings.SetCutLineColor(new Color(0x00, 0xFF, 0x00));
filterIdsToChange[filterId] = overrideSettings;
}
}
using (Transaction t = new Transaction(doc, "Change override filters"))
{
t.Start();
foreach (ElementId filterId in filterIdsToChange.Keys)
{
view.SetFilterOverrides(filterId, filterIdsToChange[filterId]);
}
t.Commit();
}
}
See Also