Gets the graphic overrides of a RevitLinkType or RevitLinkInstance in view.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since: 2024
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- linkId
- Type: Autodesk.Revit.DBElementId
The id of the RevitLinkType or RevitLinkInstance.
Return Value
Settings representing graphic overrides for the input element id in the view, or a null reference (Nothing in Visual Basic) if the input id references RevitLinkInstance and it doesn't have overrides in the view.Examples

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
Exception | Condition |
---|---|
Autodesk.Revit.ExceptionsArgumentException | The input id is not a valid RevitLinkInstance or RevitLinkType id. |
Autodesk.Revit.ExceptionsArgumentNullException | A non-optional argument was null |
Autodesk.Revit.ExceptionsInvalidOperationException | The view type does not support Visibility/Graphics Overriddes. -or- The view does not support link graphical overrides. |