Revit二次开发入门教程

2026-07-10 · 技术文章 · 12分钟 · 67 次阅读

环境搭建

Visual Studio 2022 + Revit 2025 + .NET Framework 4.8

创建第一个插件

实现一个弹出当前项目标高信息的插件。

using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

public class HelloWorld : IExternalCommand
{
    public Result Execute(
        ExternalCommandData commandData,
        ref string message,
        ElementSet elements)
    {
        TaskDialog.Show("提示", "Hello Revit!");
        return Result.Succeeded;
    }
}

调试技巧

使用Revit Lookup插件查看元素参数,使用AddInManager快速加载插件。

常用API

  • FilteredElementCollector — 元素过滤器
  • Transaction — 事务管理
  • Parameter — 参数读写
加载中...