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.DBElementId
The id of the RevitLinkType or RevitLinkInstance.
linkDisplaySettings
Type: Autodesk.Revit.DBRevitLinkGraphicsSettings
Settings representing all link graphic overrides in the view.

Examples

CopyC#
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

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException 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.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.

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →