revit-api
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRevit 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 标识符(如 、、)。如果没有,执行以下步骤:
IUpdaterDocumentChangedFilteredElementCollector-
解析业务意图:将用户的模糊需求拆解为具体的技术概念。
- 示例:"实现 DMU" → Dynamic Model Update 机制 → 需要 接口、
IUpdater类UpdaterRegistry - 示例:"链接更新阶段" → Revit 链接文档的加载/更新事件 → 需要 、
LinkedFileStatus、RevitLinkTypeTransmissionData
- 示例:"实现 DMU" → Dynamic Model Update 机制 → 需要
-
网络搜索验证:使用 WebSearch 搜索确认涉及的核心类和命名空间。
Revit API + <技术概念>搜索示例:"Revit API Dynamic Model Update IUpdater" 搜索示例:"Revit API linked file update phase event" -
提取关键词列表:从搜索结果中提取 2-5 个具体的类名/接口名/方法名,作为后续查询的输入。
-
进入第 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 , , ). If not, perform the following steps:
IUpdaterDocumentChangedFilteredElementCollector-
Parse Business Intent: Break down the user's ambiguous requirements into specific technical concepts.
- Example: "Implement DMU" → Dynamic Model Update mechanism → Requires interface,
IUpdaterclassUpdaterRegistry - Example: "Link update phase" → Loading/update events of Revit linked documents → Requires ,
LinkedFileStatus,RevitLinkTypeTransmissionData
- Example: "Implement DMU" → Dynamic Model Update mechanism → Requires
-
Web Search Verification: Use WebSearch to search forto confirm the core classes and namespaces involved.
Revit API + <technical concept>Search Example: "Revit API Dynamic Model Update IUpdater" Search Example: "Revit API linked file update phase event" -
Extract Keyword List: Extract 2-5 specific class names/interface names/method names from the search results as input for subsequent queries.
-
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 Type | Example | Execution 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)
- 先搜索定位:
bash
python scripts/search_api.py search "关键词"- 查看类的成员概览:
bash
python scripts/search_api.py class "Autodesk.Revit.DB.ClassName"- 需要完整文档时(签名、Remarks、继承链):
bash
python scripts/extract_page.py --type "Autodesk.Revit.DB.ClassName"- 查看成员级详情(属性/方法签名):
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"- First search and locate:
bash
python scripts/search_api.py search "keyword"- View member overview of the class:
bash
python scripts/search_api.py class "Autodesk.Revit.DB.ClassName"- When complete documentation is needed (signature, Remarks, inheritance chain):
bash
python scripts/extract_page.py --type "Autodesk.Revit.DB.ClassName"- 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
- 列出所有命名空间:
bash
python scripts/search_api.py namespaces- 查看特定命名空间的类型列表:
bash
python scripts/search_api.py namespace "Autodesk.Revit.DB"- 或直接读取 references/namespace-overview.md 获取完整导航。
- List all namespaces:
bash
python scripts/search_api.py namespaces- View the type list of a specific namespace:
bash
python scripts/search_api.py namespace "Autodesk.Revit.DB"- Or directly read references/namespace-overview.md for complete navigation.
路径 C:查找成员归属
Path C: Find Member Attribution
- 跨类搜索成员名称:
bash
python scripts/search_api.py member "GetParameters"- 从结果中定位目标类后,按路径 A 的第 2-4 步获取详情。
- Cross-class search for member names:
bash
python scripts/search_api.py member "GetParameters"- 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
- 直接读取 references/core-patterns.md,包含 11 个核心模式的 C# 代码示例。
- 若需进一步查看模式中涉及的 API 细节,按路径 A 继续查询。
- Directly read references/core-patterns.md, which includes C# code examples for 11 core patterns.
- If further details about the APIs involved in the patterns are needed, continue with Path A.
第 3 步:组织回答
Step 3: Organize the Answer
- 优先展示与用户问题直接相关的 API 签名和用法。
- 附带简要的代码示例(参考 core-patterns.md 中的模式)。
- 如有相关联的类或方法,补充提示。
- Prioritize displaying API signatures and usage directly related to the user's question.
- Attach brief code examples (refer to patterns in core-patterns.md).
- If there are related classes or methods, add supplementary hints.
核心类速查
Quick Reference for Core Classes
| 类 | 命名空间 | 用途 |
|---|---|---|
| DB | 当前 Revit 文档,所有操作的入口 |
| DB | 所有模型元素的基类 |
| DB | 元素的唯一标识符 |
| DB | 元素查询/过滤器(必学) |
| DB | 模型修改的事务管理 |
| DB | 墙体元素 |
| DB | 楼板元素 |
| DB | 族实例(门窗等) |
| DB | 族类型定义 |
| DB | 元素参数读写 |
| DB | 三维坐标点 |
| DB | 几何曲线 |
| DB | 几何实体 |
| DB | 标高 |
| DB | 视图 |
| UI | UI 层应用对象 |
| UI | UI 层文档(选择交互) |
| UI | Command 执行上下文 |
| UI | 消息对话框 |
| UI.Selection | 用户选择交互 |
| Class | Namespace | Purpose |
|---|---|---|
| DB | Current Revit document, the entry point for all operations |
| DB | Base class for all model elements |
| DB | Unique identifier of elements |
| DB | Element query/filter (Must-learn) |
| DB | Transaction management for model modifications |
| DB | Wall element |
| DB | Floor element |
| DB | Family instance (doors, windows, etc.) |
| DB | Family type definition |
| DB | Read/write element parameters |
| DB | 3D coordinate point |
| DB | Geometric curves |
| DB | Geometric solids |
| DB | Level |
| DB | Views |
| UI | UI layer application object |
| UI | UI layer document (selection interaction) |
| UI | Command execution context |
| UI | Message dialog box |
| UI.Selection | User selection interaction |
命名空间导航
Namespace Navigation
核心(每天用):
- — 数据库核心:元素、几何、参数、事务
Autodesk.Revit.DB - — 用户界面:Ribbon、对话框、选择
Autodesk.Revit.UI - — 应用服务:Application、ControlledApplication
Autodesk.Revit.ApplicationServices - — 工厂方法:创建文档、几何对象
Autodesk.Revit.Creation - — 特性标记:Transaction、Regeneration
Autodesk.Revit.Attributes
专业领域:
- — 建筑:房间、楼梯、栏杆
DB.Architecture - — 结构:梁、柱、基础
DB.Structure - — 暖通:风管、设备
DB.Mechanical - — 电气:线路、配电盘
DB.Electrical - — 给排水:管道、卫浴
DB.Plumbing
高级:
- — 自定义数据存储
DB.ExtensibleStorage - — 外部服务框架
DB.ExternalService - /
DB.Events— 事件系统UI.Events - — 自定义 3D 渲染
DB.DirectContext3D - — 材质与渲染外观
DB.Visual - — 异常类型
Autodesk.Revit.Exceptions
Core (Used Daily):
- — Database core: elements, geometry, parameters, transactions
Autodesk.Revit.DB - — User interface: Ribbon, dialog boxes, selection
Autodesk.Revit.UI - — Application services: Application, ControlledApplication
Autodesk.Revit.ApplicationServices - — Factory methods: create documents, geometric objects
Autodesk.Revit.Creation - — Attribute markers: Transaction, Regeneration
Autodesk.Revit.Attributes
Professional Fields:
- — Architecture: rooms, stairs, railings
DB.Architecture - — Structure: beams, columns, foundations
DB.Structure - — HVAC: ducts, equipment
DB.Mechanical - — Electrical: circuits, switchboards
DB.Electrical - — Plumbing: pipes, sanitary ware
DB.Plumbing
Advanced:
- — Custom data storage
DB.ExtensibleStorage - — External service framework
DB.ExternalService - /
DB.Events— Event systemUI.Events - — Custom 3D rendering
DB.DirectContext3D - — Materials and rendering appearance
DB.Visual - — Exception types
Autodesk.Revit.Exceptions
禁止事项
Prohibited Items
- 禁止对模糊问题跳过第 0 步预研,直接凭记忆回答 API 细节
- 禁止在未经搜索验证的情况下猜测 API 名称或签名,必须通过预研 + 脚本查询确认
- 禁止直接编辑 目录下的 JSON 数据文件
data/ - 禁止向用户提供未在文档中出现的 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 directory
data/ - 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 文件(),无需原始 HTML
data/pages/*.json - 索引文件 由
data/api_index.json生成build_index.py - 支持
extract_page.py参数直接查询成员级文档(前缀:T=类型, P=属性, M=方法, E=事件)--id
- All scripts are based on Python standard libraries, no additional dependencies are required
- Script paths are relative to this skill directory, use the prefix
scripts/ - Data has been pre-extracted into namespace-based JSON files (), no original HTML is needed
data/pages/*.json - The index file is generated by
data/api_index.jsonbuild_index.py - supports the
extract_page.pyparameter to directly query member-level documentation (prefixes: T=type, P=property, M=method, E=event)--id