Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since:
2024
Syntax
Return Value
Settings representing graphic overrides for the input element id in the view, or
nullNothingnullptra null reference (Nothing in Visual Basic) if the input id references
RevitLinkInstance and it doesn't have overrides in the view.
Examples
CopyC#
public static void PrintLinkOverridesInView(View view)
{
var ids = new FilteredElementCollector(view.Document)
.WhereElementIsElementType()
.OfType<RevitLinkType>()
.Select(link => link.Id)
.ToList();
ids.AddRange(new FilteredElementCollector(view.Document)
.WhereElementIsNotElementType()
.OfType<RevitLinkInstance>()
.Select(link => link.Id)
.ToList());
StringBuilder message = new StringBuilder();
foreach(ElementId id in ids)
{
RevitLinkGraphicsSettings settings = view.GetLinkOverrides(id);
if (settings == null)
{
message.AppendLine(string.Format("Element with Id - {0} doesn't have graphical overrides in the view.",
id.Value.ToString()));
continue;
}
message.AppendLine(string.Format("Element with Id - {0} has overrides of the type {1} and references LinkedView: {2}.",
id.Value.ToString(), settings.LinkVisibilityType, settings.LinkedViewId.Value.ToString()));
}
TaskDialog.Show("Link Overrides report", message.ToString());
}
Exceptions
See Also