using Autodesk.Revit.DB; using HStation.RevitDev.RevitDataExport.Common; using System.Collections.Generic; using System.Linq; namespace HStation.RevitDev.RevitDataExport.Utility { public class UIDocumentUtils { public static void ShowLinkedElements(string ids) { if (string.IsNullOrEmpty(ids)) { return; } var idArray = ids.Split(','); var idList = idArray.Select(x => new ElementId(int.Parse(x)))?.ToList(); GlobalResource.CurrentUIDocument.Selection.SetElementIds(idList); GlobalResource.CurrentUIDocument.ShowElements(idList); } public static void ShowElement(string id) { if (string.IsNullOrEmpty(id)) { return; } var elemId = new ElementId(int.Parse(id)); GlobalResource.CurrentUIDocument.Selection.SetElementIds( new List { elemId }); GlobalResource.CurrentUIDocument.ShowElements(elemId); } } }