代码实例:

using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System.Collections.Generic;

namespace RevitAddin4
{
    [TransactionAttribute(TransactionMode.Manual)]
    public class RevitAddin : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIDocument uiDoc = commandData.Application.ActiveUIDocument;
            Document doc = uiDoc.Document;
            FilteredElementCollector collector = new FilteredElementCollector(doc);
            collector.OfClass(typeof(Wall));

            List<ElementId> walIds = new List<ElementId>();
            foreach (var wall in collector)
            {
                walIds.Add(wall.Id);
            }
            uiDoc.ShowElements(walIds);
            return Result.Succeeded;
        }
    }
}

    运行结果:

Revit二次开发 - 显示(ShowElements)

相关文章:

  • 2021-10-03
  • 2021-12-01
  • 2021-11-12
  • 2021-10-29
  • 2021-12-02
  • 2021-12-02
  • 2021-06-05
  • 2021-04-24
猜你喜欢
  • 2021-12-26
  • 2021-10-03
  • 2021-12-04
  • 2022-01-08
  • 2021-12-18
  • 2021-12-26
  • 2021-05-23
相关资源
相似解决方案