rvt-to-excel について
rvt-to-excel は Revit の RVT ファイルを、BIM 分析やレポートに使える構造化された Excel ブックに変換します。CLI で出力モードを選び、要素プロパティや集計表、部屋、シートを出力できます。
主な機能
- 01RVT データを Excel に出力
- 02basic、standard、complete、custom モードの選択
- 03境界ボックスと部屋情報の追加
- 04集計表とシートの出力
- 05要素、レベル、材料をシートに整理
活用シーン
- 01複数プロジェクトの BIM データ抽出
- 02分析用の構造化データの準備
- 03要素プロパティを Excel で共有
- 04数量集計とレポートの作成
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ datadrivenconstruction/ ddc_skills_for_ai_agents_in_construction --skill rvt-to-excelインストール後、Claude Code で/rvt-to-excelを入力して読み込まれたか確認します。
同梱ファイルclaw.jsoninstructions.md
詳細
RVT から Excel への変換
ビジネスケース
課題
RVT ファイル内の BIM データは、次の用途で抽出する必要があります。
- 複数のプロジェクトを一括処理する
- BIM データを分析パイプラインに統合する
- 構造化データを関係者と共有する
- レポートや数量拾いを作成する
ソリューション
RVT ファイルを、分析やレポート作成に使える構造化 Excel データベースに変換します。
ビジネス価値
- 一括処理 - 複数のプロジェクトを変換できます
- データへのアクセス性 - 幅広く利用できる Excel 形式
- パイプライン統合 - BI ツールや ML モデルにデータを提供できます
- 構造化された出力 - 要素データとプロパティを整理して出力します
技術的な実装
CLI の構文
RvtExporter.exe <input_path> [export_mode] [options]
エクスポートモード
| モード | カテゴリ | 説明 |
|---|---|---|
basic | 309 | 主要な構造要素 |
standard | 724 | 標準的な BIM カテゴリ |
complete | 1209 | Revit のすべてのカテゴリ |
custom | ユーザー定義 | 指定したカテゴリのみ |
オプション
| オプション | 説明 |
|---|---|
bbox | バウンディングボックスの座標を含めます |
rooms | 部屋との関連付けを含めます |
schedules | すべての集計表をシートにエクスポートします |
sheets | シートを PDF にエクスポートします |
使用例
# 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 との統合
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
出力構成
Excel のシート
| シート | 内容 |
|---|---|
| Elements | プロパティ付きのすべての BIM 要素 |
| Categories | 要素カテゴリの概要 |
| Levels | 建物のレベル |
| Materials | マテリアルの定義 |
| Parameters | 共有パラメーター |
要素の列
| 列 | 型 | 説明 |
|---|---|---|
| ElementId | int | 一意の Revit ID |
| Category | string | 要素カテゴリ |
| Family | string | ファミリ名 |
| Type | string | タイプ名 |
| Level | string | 関連付けられたレベル |
| Area | float | 表面積(m²) |
| Volume | float | 体積(m³) |
| BBox_MinX/Y/Z | float | バウンディングボックスの最小値 |
| BBox_MaxX/Y/Z | float | バウンディングボックスの最大値 |
使用例
# 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)
DDC パイプラインとの統合
# 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}")
ベストプラクティス
- 適切なモードを使用する - 簡単な分析には
basic、すべてのデータが必要な場合はcompleteを使用します - bbox を含める - 空間分析と可視化に必要です
- 一括処理は慎重に行う - 大きなファイルは処理に時間がかかることがあります。夜間に処理してください
- 出力を検証する - 要素数を Revit の集計表と照合してください
リソース
- GitHub:cad2data Pipeline
- ダウンロード:RvtExporter.exe についてはリポジトリのリリースを参照してください
コメント
Markdown 対応