View.GetLinkOverrides
Method
Description:
Gets the graphic overrides of a or in view.
Gets the graphic overrides of a or in 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();
message.AppendLine("View: " + view.Id.ToString());
foreach(ElementId id in ids)
{
message.AppendLine("Element Id in the view: " + id.ToString());
RevitLinkGraphicsSettings settings = view.GetLinkOverrides(id);
if (settings == null)
{
message.AppendLine("It doesn't have graphical overrides in the view.");
continue;
}
message.AppendLine(" LinkVisibilityType " + settings.LinkVisibilityType);
message.AppendLine(" LinkedView: " + settings.LinkedViewId.Value.ToString());
message.AppendLine(" ViewFilterType: " + settings.ViewFilterType);
message.AppendLine(" ViewRange: " + settings.ViewRange);
message.AppendLine(" ColorFill: " + settings.ColorFill);
message.AppendLine(" ObjectStyles: " + settings.ObjectStyles);
message.AppendLine(" NestedLinks: " + settings.NestedLinks);
message.AppendLine(string.Format(" Discipline has type {0} and value: {1}",
settings.GetDisciplineType(), settings.GetDiscipline()));
message.AppendLine(string.Format(" Phase has type {0} and value: {1}",
settings.GetPhaseType(), settings.GetPhaseId().ToString()));
message.AppendLine(string.Format(" PhaseFilter has type {0} and value: {1}",
settings.GetPhaseFilterType(), settings.GetPhaseFilterId().ToString()));
message.AppendLine(string.Format(" ViewDetailLevel has type {0} and value: {1}",
settings.GetViewDetailLevelType(), settings.GetViewDetailLevel()));
}
TaskDialog.Show("Link Overrides report", message.ToString());
}
Parameters
Parameter | Type | Description |
---|---|---|
linkId | ElementId | The id of the <a href="2204a5ab-6476-df41-116d-23dbe3cb5407.htm">RevitLinkType</a> or <a href="a3a27c39-75bf-67d1-ae78-4cadd49a9c8e.htm">RevitLinkInstance</a>. |
Return Value
Type | Description |
---|---|
RevitLinkGraphicsSettings | Settings representing graphic overrides for the input element id in the view, or if the input id references and it doesn't have overrides in the view. |
Exceptions
Exception | Condition |
---|---|
ArgumentException | The input id is not a valid RevitLinkInstance or RevitLinkType id. |
ArgumentNullException | A non-optional argument was null |