Skip to content

Commit

Permalink
Improved Types.Element.DisplayName for unnamed elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
kike-garbo committed Nov 28, 2024
1 parent ccbe5d2 commit 95f0d81
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/RhinoInside.Revit.GH/Types/Element.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,18 @@ public override string IsValidWhyNot
#endregion

#region DocumentObject
public override string DisplayName => Nomen ?? (IsReferencedData ? string.Empty : "<None>");
public override string DisplayName
{
get
{
var displayName = Nomen ?? (IsReferencedData ? string.Empty : "<None>");
if (!string.IsNullOrEmpty(displayName)) return displayName;
if (Value?.Category is ARDB.Category category)
return $"<{category.ToBuiltInCategory().Name(localized: false).TrimEnd('s')}>";

return displayName;
}
}

public new ARDB.Element Value
{
Expand Down

0 comments on commit 95f0d81

Please sign in to comment.