简介
DataDrivenConstruction开源方案,A级安全认证,支持Revit模型批量转Excel,无缝对接成本估算与BI分析,实现BIM数据资产化。
原始描述
Convert RVT/RFA files to Excel databases. Extract BIM element data, properties, and quantities.
中文使用说明 来自收录源
核心用法
rvt-to-excel 是一款专为建筑信息模型(BIM)数据提取设计的工具型 Skill,通过调用本地 RvtExporter.exe 将 Autodesk Revit 的 .rvt/.rfa 文件转换为结构化的 Excel 数据库。该 Skill 本身为纯文档型,提供完整的 CLI 语法说明、Python 集成示例以及批量处理方案。
四种导出模式满足不同场景需求:
basic(309 类):快速提取核心结构元素standard(724 类):常规 BIM 数据导出complete(1209 类):全类别数据提取custom:用户自定义类别筛选
可选增强参数包括边界框坐标(bbox)、房间关联(rooms)、明细表导出(schedules)及图纸转 PDF(sheets),支持空间分析与可视化需求。
显著优点
- 批处理能力:原生支持文件夹级批量转换,配合循环脚本实现多项目自动化处理
- 数据可访问性:Excel 格式确保与非技术 stakeholders 的无缝协作,无需 Revit 软件即可查看分析
- 分析管道集成:输出文件可直接对接 pandas、BI 工具及机器学习模型,示例代码展示与 CWICR 造价数据库的集成路径
- 结构化输出:自动生成 Elements、Categories、Levels、Materials、Parameters 等工作表,包含 ElementId、Category、Family、Type、Area、Volume 等完整属性字段
潜在缺点与局限性
- 依赖外部二进制:核心功能依赖 RvtExporter.exe(需单独下载),Skill 本身不包含该可执行文件
- Windows 环境限制:RvtExporter.exe 为 Windows 原生程序,跨平台部署需额外配置
- 无实时同步:一次性导出模式,不支持 Revit 模型的实时监听与增量更新
- 大文件性能:文档提示"大型文件可能耗时较长,建议夜间处理",暗示内存与计算资源敏感
适合人群
- 造价工程师:快速生成工程量清单(Quantity Takeoff)
- 数据分析师:将 BIM 数据接入 Python/R 分析工作流
- 项目管理者:批量提取多项目数据用于对比报告
- 企业 IT/DevOps:构建自动化数据处理管道
常规风险
- 版本兼容性:Revit 版本升级可能导致 RvtExporter.exe 解析失败
- 数据完整性:导出后需与 Revit 内置明细表核对元素数量
- 本地工具安全:用户需自行验证下载来源的 RvtExporter.exe 完整性
- 权限问题:批量处理时需确保文件系统读写权限
该 Skill 作为 datadrivenconstruction 开源生态的一环,与 cad2data Pipeline 项目深度关联,体现了数据驱动建造(Data-Driven Construction)的技术理念。
技能正文
name: "rvt-to-excel" description: "Convert RVT/RFA files to Excel databases. Extract BIM element data, properties, and quantities."
RVT to Excel Conversion
Business Case
Problem Statement
BIM data inside RVT files needs to be extracted for:
- Processing multiple projects in batch
- Integrating BIM data with analytics pipelines
- Sharing structured data with stakeholders
- Generating reports and quantity takeoffs
Solution
Convert RVT files to structured Excel databases for analysis and reporting.
Business Value
- Batch processing - Convert multiple projects
- Data accessibility - Excel format for universal access
- Pipeline integration - Feed data to BI tools, ML models
- Structured output - Organized element data and properties
Technical Implementation
CLI Syntax
RvtExporter.exe <input_path> [export_mode] [options]
Export Modes
| Mode | Categories | Description |
|---|---|---|
basic |
309 | Essential structural elements |
standard |
724 | Standard BIM categories |
complete |
1209 | All Revit categories |
custom |
User-defined | Specific categories only |
Options
| Option | Description |
|---|---|
bbox |
Include bounding box coordinates |
rooms |
Include room associations |
schedules |
Export all schedules to sheets |
sheets |
Export sheets to PDF |
Examples
# Basic export
RvtExporter.exe "C:\Projects\Building.rvt" basic
# Complete with bounding boxes
RvtExporter.exe "C:\Projects\Building.rvt" complete bbox
# Full export with all options
RvtExporter.exe "C:\Projects\Building.rvt" complete bbox rooms schedules sheets
# Batch processing
for /R "C:\Projects" %f in (*.rvt) do RvtExporter.exe "%f" standard bbox
Python Integration
import subprocess
import pandas as pd
from pathlib import Path
from typing import List, Optional
class RevitExporter:
def __init__(self, exporter_path: str = "RvtExporter.exe"):
self.exporter = Path(exporter_path)
if not self.exporter.exists():
raise FileNotFoundError(f"RvtExporter not found: {exporter_path}")
def convert(self, rvt_file: str, mode: str = "complete",
options: List[str] = None) -> Path:
"""Convert Revit file to Excel."""
rvt_path = Path(rvt_file)
if not rvt_path.exists():
raise FileNotFoundError(f"Revit file not found: {rvt_file}")
cmd = [str(self.exporter), str(rvt_path), mode]
if options:
cmd.extend(options)
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode != 0:
raise RuntimeError(f"Export failed: {result.stderr}")
# Output file is same name with .xlsx extension
output_file = rvt_path.with_suffix('.xlsx')
return output_file
def batch_convert(self, folder: str, mode: str = "standard",
pattern: str = "*.rvt") -> List[Path]:
"""Convert all Revit files in folder."""
folder_path = Path(folder)
converted = []
for rvt_file in folder_path.glob(pattern):
try:
output = self.convert(str(rvt_file), mode)
converted.append(output)
print(f"Converted: {rvt_file.name}")
except Exception as e:
print(f"Failed: {rvt_file.name} - {e}")
return converted
def read_elements(self, xlsx_file: str) -> pd.DataFrame:
"""Read converted Excel as DataFrame."""
return pd.read_excel(xlsx_file, sheet_name="Elements")
def get_quantities(self, xlsx_file: str,
group_by: str = "Category") -> pd.DataFrame:
"""Get quantity summary grouped by category."""
df = self.read_elements(xlsx_file)
# Group and count
summary = df.groupby(group_by).agg({
'ElementId': 'count',
'Area': 'sum',
'Volume': 'sum'
}).reset_index()
summary.columns = [group_by, 'Count', 'Total_Area', 'Total_Volume']
return summary
Output Structure
Excel Sheets
| Sheet | Content |
|---|---|
| Elements | All BIM elements with properties |
| Categories | Element categories summary |
| Levels | Building levels |
| Materials | Material definitions |
| Parameters | Shared parameters |
Element Columns
| Column | Type | Description |
|---|---|---|
| ElementId | int | Unique Revit ID |
| Category | string | Element category |
| Family | string | Family name |
| Type | string | Type name |
| Level | string | Associated level |
| Area | float | Surface area (m²) |
| Volume | float | Volume (m³) |
| BBox_MinX/Y/Z | float | Bounding box min |
| BBox_MaxX/Y/Z | float | Bounding box max |
Usage Example
# Initialize exporter
exporter = RevitExporter("C:/Tools/RvtExporter.exe")
# Convert single file
xlsx = exporter.convert("C:/Projects/Office.rvt", "complete", ["bbox", "rooms"])
# Read and analyze
df = exporter.read_elements(str(xlsx))
print(f"Total elements: {len(df)}")
# Quantity summary
quantities = exporter.get_quantities(str(xlsx))
print(quantities)
# Export to CSV for further processing
df.to_csv("elements.csv", index=False)
Integration with DDC Pipeline
# Full pipeline: Revit → Excel → Cost Estimate
from semantic_search import CWICRSemanticSearch
# 1. Convert Revit
exporter = RevitExporter()
xlsx = exporter.convert("project.rvt", "complete", ["bbox"])
# 2. Extract quantities
df = exporter.read_elements(str(xlsx))
quantities = df.groupby('Category')['Volume'].sum().to_dict()
# 3. Search CWICR for pricing
search = CWICRSemanticSearch()
costs = {}
for category, volume in quantities.items():
results = search.search_work_items(category, limit=5)
if not results.empty:
avg_price = results['unit_price'].mean()
costs[category] = volume * avg_price
print(f"Total estimate: ${sum(costs.values()):,.2f}")
Best Practices
- Use appropriate mode -
basicfor quick analysis,completefor full data - Include bbox - Required for spatial analysis and visualization
- Batch carefully - Large files may take time; process overnight
- Validate output - Check element counts against Revit schedules
Resources
- GitHub: cad2data Pipeline
- Download: See repository releases for RvtExporter.exe
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。