revit-api

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Revit 2026 API 参考

Revit 2026 API Reference

基于 RevitAPI.dll v26.0.4.0 的完整 API 文档,覆盖 30 个命名空间2724 个类型
Complete API documentation based on RevitAPI.dll v26.0.4.0, covering 30 namespaces and 2724 types.

查询流程

Query Process

第 0 步:需求预研(模糊问题必须执行)

Step 0: Requirement Pre-research (Mandatory for Ambiguous Questions)

当用户提出的问题不包含明确的类名、方法名或命名空间时(如"实现 DMU"、"链接更新阶段"、"怎么监听模型变化"、"做一个参数化族"),必须先完成预研,再进入后续查询。
判断标准:用户问题中是否包含可直接搜索的 Revit API 标识符(如
IUpdater
DocumentChanged
FilteredElementCollector
)。如果没有,执行以下步骤:
  1. 解析业务意图:将用户的模糊需求拆解为具体的技术概念。
    • 示例:"实现 DMU" → Dynamic Model Update 机制 → 需要
      IUpdater
      接口、
      UpdaterRegistry
    • 示例:"链接更新阶段" → Revit 链接文档的加载/更新事件 → 需要
      LinkedFileStatus
      RevitLinkType
      TransmissionData
  2. 网络搜索验证:使用 WebSearch 搜索
    Revit API + <技术概念>
    确认涉及的核心类和命名空间。
    搜索示例:"Revit API Dynamic Model Update IUpdater"
    搜索示例:"Revit API linked file update phase event"
  3. 提取关键词列表:从搜索结果中提取 2-5 个具体的类名/接口名/方法名,作为后续查询的输入。
  4. 进入第 1 步:带着明确的 API 标识符继续。
重要:禁止跳过预研直接凭经验回答模糊问题。即使你认为自己知道答案,也必须通过预研确认后再用本知识库验证。
When the user's question does not contain explicit class names, method names, or namespaces (e.g., "Implement DMU", "Link update phase", "How to monitor model changes", "Create a parametric family"), pre-research must be completed first before proceeding to subsequent queries.
Judgment Criteria: Whether the user's question contains directly searchable Revit API identifiers (such as
IUpdater
,
DocumentChanged
,
FilteredElementCollector
). If not, perform the following steps:
  1. Parse Business Intent: Break down the user's ambiguous requirements into specific technical concepts.
    • Example: "Implement DMU" → Dynamic Model Update mechanism → Requires
      IUpdater
      interface,
      UpdaterRegistry
      class
    • Example: "Link update phase" → Loading/update events of Revit linked documents → Requires
      LinkedFileStatus
      ,
      RevitLinkType
      ,
      TransmissionData
  2. Web Search Verification: Use WebSearch to search for
    Revit API + <technical concept>
    to confirm the core classes and namespaces involved.
    Search Example: "Revit API Dynamic Model Update IUpdater"
    Search Example: "Revit API linked file update phase event"
  3. Extract Keyword List: Extract 2-5 specific class names/interface names/method names from the search results as input for subsequent queries.
  4. Proceed to Step 1: Continue with explicit API identifiers.
Important: It is forbidden to skip pre-research and answer ambiguous questions directly based on experience. Even if you think you know the answer, you must confirm it through pre-research and then verify it with this knowledge base.

第 1 步:判断问题类型

Step 1: Determine Question Type

问题类型示例执行路径
查询特定 API"XX 类怎么用"、"XX 方法的参数"路径 A
浏览命名空间"XX 命名空间有什么"、"XX 模块的类"路径 B
查找成员归属"哪个类有 XX 方法"、"XX 属性在哪里"路径 C
通用开发问题"怎么创建墙"、"事务怎么用"路径 D
Question TypeExampleExecution Path
Query Specific API"How to use XX class", "Parameters of XX method"Path A
Browse Namespace"What's in XX namespace", "Classes in XX module"Path B
Find Member Attribution"Which class has XX method", "Where is XX property"Path C
General Development Question"How to create a wall", "How to use transactions"Path D

第 2 步:执行对应路径

Step 2: Execute Corresponding Path

路径 A:搜索特定 API(最常用)

Path A: Search for Specific APIs (Most Commonly Used)

  1. 先搜索定位:
bash
python scripts/search_api.py search "关键词"
  1. 查看类的成员概览:
bash
python scripts/search_api.py class "Autodesk.Revit.DB.ClassName"
  1. 需要完整文档时(签名、Remarks、继承链):
bash
python scripts/extract_page.py --type "Autodesk.Revit.DB.ClassName"
  1. 查看成员级详情(属性/方法签名):
bash
python scripts/extract_page.py --id "P:Autodesk.Revit.DB.Wall.Flipped"
python scripts/extract_page.py --id "M:Autodesk.Revit.DB.Wall.Flip"
  1. First search and locate:
bash
python scripts/search_api.py search "keyword"
  1. View member overview of the class:
bash
python scripts/search_api.py class "Autodesk.Revit.DB.ClassName"
  1. When complete documentation is needed (signature, Remarks, inheritance chain):
bash
python scripts/extract_page.py --type "Autodesk.Revit.DB.ClassName"
  1. View member-level details (property/method signatures):
bash
python scripts/extract_page.py --id "P:Autodesk.Revit.DB.Wall.Flipped"
python scripts/extract_page.py --id "M:Autodesk.Revit.DB.Wall.Flip"

路径 B:浏览命名空间

Path B: Browse Namespace

  1. 列出所有命名空间:
bash
python scripts/search_api.py namespaces
  1. 查看特定命名空间的类型列表:
bash
python scripts/search_api.py namespace "Autodesk.Revit.DB"
  1. 或直接读取 references/namespace-overview.md 获取完整导航。
  1. List all namespaces:
bash
python scripts/search_api.py namespaces
  1. View the type list of a specific namespace:
bash
python scripts/search_api.py namespace "Autodesk.Revit.DB"
  1. Or directly read references/namespace-overview.md for complete navigation.

路径 C:查找成员归属

Path C: Find Member Attribution

  1. 跨类搜索成员名称:
bash
python scripts/search_api.py member "GetParameters"
  1. 从结果中定位目标类后,按路径 A 的第 2-4 步获取详情。
  1. Cross-class search for member names:
bash
python scripts/search_api.py member "GetParameters"
  1. After locating the target class from the results, follow steps 2-4 of Path A to get details.

路径 D:开发模式速查

Path D: Quick Reference for Development Patterns

  1. 直接读取 references/core-patterns.md,包含 11 个核心模式的 C# 代码示例。
  2. 若需进一步查看模式中涉及的 API 细节,按路径 A 继续查询。
  1. Directly read references/core-patterns.md, which includes C# code examples for 11 core patterns.
  2. If further details about the APIs involved in the patterns are needed, continue with Path A.

第 3 步:组织回答

Step 3: Organize the Answer

  1. 优先展示与用户问题直接相关的 API 签名和用法。
  2. 附带简要的代码示例(参考 core-patterns.md 中的模式)。
  3. 如有相关联的类或方法,补充提示。
  1. Prioritize displaying API signatures and usage directly related to the user's question.
  2. Attach brief code examples (refer to patterns in core-patterns.md).
  3. If there are related classes or methods, add supplementary hints.

核心类速查

Quick Reference for Core Classes

命名空间用途
Document
DB当前 Revit 文档,所有操作的入口
Element
DB所有模型元素的基类
ElementId
DB元素的唯一标识符
FilteredElementCollector
DB元素查询/过滤器(必学)
Transaction
DB模型修改的事务管理
Wall
DB墙体元素
Floor
DB楼板元素
FamilyInstance
DB族实例(门窗等)
FamilySymbol
DB族类型定义
Parameter
DB元素参数读写
XYZ
DB三维坐标点
Line
/
Arc
/
CurveLoop
DB几何曲线
Solid
/
Face
/
Edge
DB几何实体
Level
DB标高
View
/
ViewPlan
/
View3D
DB视图
UIApplication
UIUI 层应用对象
UIDocument
UIUI 层文档(选择交互)
ExternalCommandData
UICommand 执行上下文
TaskDialog
UI消息对话框
Selection
UI.Selection用户选择交互
ClassNamespacePurpose
Document
DBCurrent Revit document, the entry point for all operations
Element
DBBase class for all model elements
ElementId
DBUnique identifier of elements
FilteredElementCollector
DBElement query/filter (Must-learn)
Transaction
DBTransaction management for model modifications
Wall
DBWall element
Floor
DBFloor element
FamilyInstance
DBFamily instance (doors, windows, etc.)
FamilySymbol
DBFamily type definition
Parameter
DBRead/write element parameters
XYZ
DB3D coordinate point
Line
/
Arc
/
CurveLoop
DBGeometric curves
Solid
/
Face
/
Edge
DBGeometric solids
Level
DBLevel
View
/
ViewPlan
/
View3D
DBViews
UIApplication
UIUI layer application object
UIDocument
UIUI layer document (selection interaction)
ExternalCommandData
UICommand execution context
TaskDialog
UIMessage dialog box
Selection
UI.SelectionUser selection interaction

命名空间导航

Namespace Navigation

核心(每天用):
  • Autodesk.Revit.DB
    — 数据库核心:元素、几何、参数、事务
  • Autodesk.Revit.UI
    — 用户界面:Ribbon、对话框、选择
  • Autodesk.Revit.ApplicationServices
    — 应用服务:Application、ControlledApplication
  • Autodesk.Revit.Creation
    — 工厂方法:创建文档、几何对象
  • Autodesk.Revit.Attributes
    — 特性标记:Transaction、Regeneration
专业领域:
  • DB.Architecture
    — 建筑:房间、楼梯、栏杆
  • DB.Structure
    — 结构:梁、柱、基础
  • DB.Mechanical
    — 暖通:风管、设备
  • DB.Electrical
    — 电气:线路、配电盘
  • DB.Plumbing
    — 给排水:管道、卫浴
高级:
  • DB.ExtensibleStorage
    — 自定义数据存储
  • DB.ExternalService
    — 外部服务框架
  • DB.Events
    /
    UI.Events
    — 事件系统
  • DB.DirectContext3D
    — 自定义 3D 渲染
  • DB.Visual
    — 材质与渲染外观
  • Autodesk.Revit.Exceptions
    — 异常类型
Core (Used Daily):
  • Autodesk.Revit.DB
    — Database core: elements, geometry, parameters, transactions
  • Autodesk.Revit.UI
    — User interface: Ribbon, dialog boxes, selection
  • Autodesk.Revit.ApplicationServices
    — Application services: Application, ControlledApplication
  • Autodesk.Revit.Creation
    — Factory methods: create documents, geometric objects
  • Autodesk.Revit.Attributes
    — Attribute markers: Transaction, Regeneration
Professional Fields:
  • DB.Architecture
    — Architecture: rooms, stairs, railings
  • DB.Structure
    — Structure: beams, columns, foundations
  • DB.Mechanical
    — HVAC: ducts, equipment
  • DB.Electrical
    — Electrical: circuits, switchboards
  • DB.Plumbing
    — Plumbing: pipes, sanitary ware
Advanced:
  • DB.ExtensibleStorage
    — Custom data storage
  • DB.ExternalService
    — External service framework
  • DB.Events
    /
    UI.Events
    — Event system
  • DB.DirectContext3D
    — Custom 3D rendering
  • DB.Visual
    — Materials and rendering appearance
  • Autodesk.Revit.Exceptions
    — Exception types

禁止事项

Prohibited Items

  • 禁止对模糊问题跳过第 0 步预研,直接凭记忆回答 API 细节
  • 禁止在未经搜索验证的情况下猜测 API 名称或签名,必须通过预研 + 脚本查询确认
  • 禁止直接编辑
    data/
    目录下的 JSON 数据文件
  • 禁止向用户提供未在文档中出现的 API 用法,若文档不足应明确说明
  • 禁止混淆不同 Revit 版本的 API,本文档仅覆盖 Revit 2026(v26.0.4.0)
  • It is forbidden to skip Step 0 pre-research for ambiguous questions and directly answer API details from memory
  • It is forbidden to guess API names or signatures without search verification; confirmation must be done through pre-research + script queries
  • It is forbidden to directly edit JSON data files in the
    data/
    directory
  • It is forbidden to provide API usage not documented in the knowledge base; if the documentation is insufficient, it should be clearly stated
  • It is forbidden to confuse APIs of different Revit versions; this documentation only covers Revit 2026 (v26.0.4.0)

注意事项

Notes

  • 所有脚本基于 Python 标准库,无需额外安装依赖
  • 脚本路径相对于此 skill 目录,使用
    scripts/
    前缀
  • 数据已预提取为按命名空间的 JSON 文件(
    data/pages/*.json
    ),无需原始 HTML
  • 索引文件
    data/api_index.json
    build_index.py
    生成
  • extract_page.py
    支持
    --id
    参数直接查询成员级文档(前缀:T=类型, P=属性, M=方法, E=事件)
  • All scripts are based on Python standard libraries, no additional dependencies are required
  • Script paths are relative to this skill directory, use the
    scripts/
    prefix
  • Data has been pre-extracted into namespace-based JSON files (
    data/pages/*.json
    ), no original HTML is needed
  • The index file
    data/api_index.json
    is generated by
    build_index.py
  • extract_page.py
    supports the
    --id
    parameter to directly query member-level documentation (prefixes: T=type, P=property, M=method, E=event)