关于 n8n-cost-estimation
n8n 工作流将 Revit 等 CAD 文件转换为结构化构件数据,并结合 LLM 分类与 CWICR 价格匹配生成成本和工期估算,面向施工估算与 BIM 流程。
主要功能
- 01转换 CAD 文件并提取构件数据
- 02按类别分组并由 LLM 分类
- 03在 CWICR 中进行向量检索
- 04计算成本并生成报告
适用场景
- 01从 Revit 模型生成工程成本估算
- 02按构件类别匹配施工项目与价格
- 03汇总项目阶段成本和工期数据
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ datadrivenconstruction/ ddc_skills_for_ai_agents_in_construction --skill n8n-cost-estimation安装后在 Claude Code 中输入/n8n-cost-estimation确认已加载。
附带文件claw.jsoninstructions.md
详细介绍
自动化成本估算流水线
商业案例
问题陈述
传统成本估算需要:
- 手动在价格数据库中查找工作项
- 耗时的构件分类
- 熟悉定价标准的专业知识
- 重复录入数据
解决方案
免费的开源 n8n 流水线,可借助 AI(大模型)和包含 55,000 多个工作项的向量数据库,将 CAD(Revit 2015-2026)文件转换为完整的成本和工时估算。
商业价值
| 传统角色 | 自动化替代方案 |
|---|---|
| BIM 经理手动导出数据 | 流水线自动分类构件 |
| 初级估算员搜索数据库 | 向量搜索在毫秒内找到匹配项 |
| 高级估算员映射组件 | 大模型识别数量参数 |
| 工长计算人工工时 | DDC CWICR 提供有记录的标准工时 |
| 项目经理汇总成本 | 流水线输出分阶段明细 |
处理速度:每组构件 3-10 秒
技术实现
流水线架构
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Revit/IFC │───>│ CAD2DATA │───>│ Structured │
│ File │ │ Converter │ │ Excel/CSV │
└─────────────┘ └─────────────┘ └─────────────┘
│
▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Cost Report │<───│ Price Match │<───│ LLM Class. │
│ HTML/Excel │ │ DDC CWICR │ │ + QTO │
└─────────────┘ └─────────────┘ └─────────────┘
n8n 流水线步骤
1. 文件转换节点
// Execute CAD converter
const filePath = $input.first().json.file_path;
const outputDir = filePath.replace(/\.[^.]+$/, '');
const command = `RvtExporter.exe "${filePath}" complete bbox`;
// Returns: { xlsx_path, dae_path }
2. 加载构件
// Read converted Excel into n8n
const xlsx = $node["Read Binary Files"].json;
const elements = xlsx.sheets["Elements"];
// Group by category for processing
const grouped = elements.reduce((acc, el) => {
const cat = el.Category;
if (!acc[cat]) acc[cat] = [];
acc[cat].push(el);
return acc;
}, {});
return Object.entries(grouped).map(([category, items]) => ({
json: {category, items, count: items.length}
}));
3. 大模型分类
// Prompt for Claude/GPT classification
const prompt = `
You are a construction estimator. Given these BIM elements:
Category: ${$input.first().json.category}
Sample elements: ${JSON.stringify($input.first().json.items.slice(0,5))}
1. Identify the construction work type
2. List relevant quantity parameters (Volume, Area, Length, Count)
3. Suggest standard work items from construction norms
Return as JSON:
{
"work_type": "...",
"quantity_params": ["Volume", "Area"],
"suggested_items": ["Concrete foundation", "Formwork"]
}
`;
4. 在 CWICR 中进行向量搜索
// Search DDC CWICR database for matching work items
const qdrantClient = require('@qdrant/js-client-rest');
const searchResults = await qdrantClient.search('cwicr_en_v3', {
vector: await getEmbedding($input.first().json.work_description),
limit: 10,
score_threshold: 0.7
});
return searchResults.map(r => ({
json: {
work_code: r.payload.work_item_code,
description: r.payload.description,
unit: r.payload.unit,
unit_price: r.payload.unit_price,
similarity: r.score
}
}));
5. 计算成本
// Match quantities to prices
const elements = $node["Load Elements"].json;
const prices = $node["Vector Search"].json;
let totalCost = 0;
const breakdown = [];
for (const el of elements.items) {
const matchedPrice = prices.find(p => p.similarity > 0.8);
if (matchedPrice) {
const quantity = el.Volume || el.Area || 1;
const cost = quantity * matchedPrice.unit_price;
totalCost += cost;
breakdown.push({
element: el.Name,
quantity: quantity,
unit: matchedPrice.unit,
unit_price: matchedPrice.unit_price,
total: cost
});
}
}
return [{json: {totalCost, breakdown}}];
6. 生成报告
// Create HTML report
const data = $input.first().json;
const html = `
<!DOCTYPE html>
<html>
<head>
<title>Cost Estimate Report</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background-color: #4CAF50; color: white; }
.total { font-size: 1.5em; font-weight: bold; }
</style>
</head>
<body>
<h1>Cost Estimate Report</h1>
<p class="total">Total: $${data.totalCost.toLocaleString()}</p>
<table>
<tr><th>Element</th><th>Quantity</th><th>Unit</th><th>Price</th><th>Total</th></tr>
${data.breakdown.map(row => `
<tr>
<td>${row.element}</td>
<td>${row.quantity.toFixed(2)}</td>
<td>${row.unit}</td>
<td>$${row.unit_price.toFixed(2)}</td>
<td>$${row.total.toFixed(2)}</td>
</tr>
`).join('')}
</table>
</body>
</html>
`;
return [{json: {html, filename: 'estimate_report.html'}}];
实际成果
示例项目(rac_basic_sample.rvt):
- 处理时间:使用 ChatGPT 约 30 分钟
- 分析的构件:500+
- 自动分类准确率:95%
- 需要人工审核:5% 的边缘案例
社区的重要见解
“我的个人看法是:如今忽视工作流自动化和 AI Agent 的专业人士,距离被建筑行业淘汰大约还有 5 年。工具免费且开源。数据也是开放的。唯一的问题是,谁能先学会使用它们。”
先决条件
- n8n(本地或托管)
- DDC CAD 转换器
- DDC CWICR 数据库
- OpenAI/Anthropic API 密钥
- Qdrant 向量数据库
资源
- GitHub:cad2data 流水线仓库
- 数据库:OpenConstructionEstimate-DDC-CWICR
- 社区:建筑行业 n8n 工作流(Telegram)
评论
支持 Markdown