SetLinkOverrides Method


Sets the graphic overrides of a RevitLinkType or RevitLinkInstance in the view.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since: 2024

Syntax

C#
public void SetLinkOverrides(
	ElementId linkId,
	RevitLinkGraphicsSettings linkDisplaySettings
)
Visual Basic
Public Sub SetLinkOverrides ( _
	linkId As ElementId, _
	linkDisplaySettings As RevitLinkGraphicsSettings _
)
Visual C++
public:
void SetLinkOverrides(
	ElementId^ linkId, 
	RevitLinkGraphicsSettings^ linkDisplaySettings
)

Parameters

linkId
Type: Autodesk.Revit.DB ElementId
The id of the RevitLinkType or RevitLinkInstance .
linkDisplaySettings
Type: Autodesk.Revit.DB RevitLinkGraphicsSettings
Settings representing all link graphic overrides in the view.

Examples

Copy C#
public static void UpdateOverridesInView(View view, ElementId linkElementId, ElementId linkedViewId)
{
    RevitLinkGraphicsSettings settings = new RevitLinkGraphicsSettings();
    settings.LinkVisibilityType = LinkVisibility.ByLinkView;
    settings.LinkedViewId = linkedViewId;

    using(Transaction transaction = new Transaction(view.Document, "Set link graphical overrides"))
    {
        transaction.Start();
        view.SetLinkOverrides(linkElementId, settings);    
        transaction.Commit();
    }
}

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException The input id is not a valid RevitLinkInstance or RevitLinkType id. -or- Setting link overrides to type LinkVisibility.Custom is not supported via the API. -or- The LinkedViewId of linkDisplaySettings has incorrect value for the specified LinkVisibilityType.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null
Autodesk.Revit.Exceptions InvalidOperationException The view type does not support Visibility/Graphics Overriddes. -or- The view does not support link graphical overrides.

See Also