闲社服务运行正常AI智能体自动化平台
i

IFC转Excel

技能标识:ifc-to-excel"

Convert IFC files (2x3, 4x1, 4x3) to Excel databases using IfcExporter CLI. Extract BIM data, properties, and geometry without proprietary software."

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 2.0.0
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

IFC转Excel

IFC 转 Excel 转换

业务案例

问题陈述

IFC(工业基础类)是开放的 BIM 标准,但:
  • - 读取 IFC 需要专业软件
  • 属性提取需要编程知识
  • 批量处理是手动且耗时的
  • 与分析工具的集成复杂

解决方案

IfcExporter.exe 将 IFC 文件转换为结构化的 Excel 数据库,使 BIM 数据可用于分析、验证和报告。

业务价值

  • - 开放标准 - 处理任何 IFC 文件(2x3、4x、4.3)
  • 无需许可证 - 离线运行,无需 BIM 软件
  • 数据提取 - 所有属性、数量、材料
  • 3D 几何 - 导出为 Collada DAE 格式
  • 管道就绪 - 与 ETL 工作流集成

技术实现

CLI 语法

bash IfcExporter.exe <输入_ifc> [选项]

支持的 IFC 版本
版本架构描述
IFC2x3MVD最常见的交换格式
IFC4
ADD1 | 增强属性 |

| IFC4x1 | Alignment | 基础设施支持 | | IFC4x3 | Latest | 完整基础设施 |

输出格式
输出描述
.xlsx包含元素和属性的 Excel 数据库
.dae
具有匹配 ID 的 Collada 3D 几何 |

选项
选项描述
bbox包含元素边界框
-no-xlsx
跳过 Excel 导出 |

| -no-collada | 跳过 3D 几何导出 |

示例

bash

基本转换(XLSX + DAE)


IfcExporter.exe C:\Models\Building.ifc

带边界框

IfcExporter.exe C:\Models\Building.ifc bbox

仅 Excel(无 3D 几何)

IfcExporter.exe C:\Models\Building.ifc -no-collada

批量处理

for /R C:\IFC_Models %f in (*.ifc) do IfcExporter.exe %f bbox

Python 集成

python
import subprocess
import pandas as pd
from pathlib import Path
from typing import List, Optional, Dict, Any, Set
from dataclasses import dataclass, field
from enum import Enum
import json

class IFCVersion(Enum):
IFC 架构版本。
IFC2X3 = IFC2X3
IFC4 = IFC4
IFC4X1 = IFC4X1
IFC4X3 = IFC4X3

class IFCEntityType(Enum):
常见 IFC 实体类型。
IFCWALL = IfcWall
IFCWALLSTANDARDCASE = IfcWallStandardCase
IFCSLAB = IfcSlab
IFCCOLUMN = IfcColumn
IFCBEAM = IfcBeam
IFCDOOR = IfcDoor
IFCWINDOW = IfcWindow
IFCROOF = IfcRoof
IFCSTAIR = IfcStair
IFCRAILING = IfcRailing
IFCFURNISHINGELEMENT = IfcFurnishingElement
IFCSPACE = IfcSpace
IFCBUILDINGSTOREY = IfcBuildingStorey
IFCBUILDING = IfcBuilding
IFCSITE = IfcSite

@dataclass
class IFCElement:
表示一个 IFC 元素。
global_id: str
ifc_type: str
name: str
description: Optional[str]
object_type: Optional[str]
level: Optional[str]

# 数量
area: Optional[float] = None
volume: Optional[float] = None
length: Optional[float] = None
height: Optional[float] = None
width: Optional[float] = None

# 边界框(如果导出)
bboxminx: Optional[float] = None
bboxminy: Optional[float] = None
bboxminz: Optional[float] = None
bboxmaxx: Optional[float] = None
bboxmaxy: Optional[float] = None
bboxmaxz: Optional[float] = None

# 属性
properties: Dict[str, Any] = field(default_factory=dict)
materials: List[str] = field(default_factory=list)

@dataclass
class IFCProperty:
表示一个 IFC 属性。
pset_name: str
property_name: str
value: Any
value_type: str

@dataclass
class IFCMaterial:
表示一个 IFC 材料。
name: str
category: Optional[str]
thickness: Optional[float]
layer_position: Optional[int]

class IFCExporter:
使用 DDC IfcExporter CLI 的 IFC 转 Excel 转换器。

def init(self, exporter_path: str = IfcExporter.exe):
self.exporter = Path(exporter_path)
if not self.exporter.exists():
raise FileNotFoundError(f未找到 IfcExporter:{exporter_path})

def convert(self, ifc_file: str,
include_bbox: bool = True,
export_xlsx: bool = True,
export_collada: bool = True) -> Path:
将 IFC 文件转换为 Excel。
ifcpath = Path(ifcfile)
if not ifc_path.exists():
raise FileNotFoundError(f未找到 IFC 文件:{ifc_file})

cmd = [str(self.exporter), str(ifc_path)]

if include_bbox:
cmd.append(bbox)
if not export_xlsx:
cmd.append(-no-xlsx)
if not export_collada:
cmd.append(-no-collada)

result = subprocess.run(cmd, capture_output=True, text=True)

if result.returncode != 0:
raise RuntimeError(f导出失败:{result.stderr})

return ifcpath.withsuffix(.xlsx)

def batch_convert(self, folder: str,
include_subfolders: bool = True,
include_bbox: bool = True) -> List[Dict[str, Any]]:
转换文件夹中的所有 IFC 文件。
folder_path = Path(folder)
pattern = /.ifc if include_subfolders else .ifc

results = []
for ifcfile in folderpath.glob(pattern):
try:
output = self.convert(str(ifcfile), includebbox)
results.append({
input: str(ifc_file),
output: str(output),
status: success
})
print(f✓ 已转换:{ifc_file.name})
except Exception as e:
results.append({
input: str(ifc_file),
output: None,
status: failed,
error: str(e)
})
print(f✗ 失败:{ifc_file.name} - {e})

return results

def readelements(self, xlsxfile: str) -> pd.DataFrame:
将转换后的 Excel 读取为 DataFrame。
return pd.readexcel(xlsxfile, sheet_name=Elements)

def getelementtypes(self, xlsx_file: str) -> pd.DataFrame:
获取元素类型摘要。
df = self.readelements(xlsxfile)

if IfcType not in df.columns:
raise ValueError(未找到 IfcType 列)

summary = df.groupby(IfcType).agg({
GlobalId: count,
Volume: sum if Volume in df.columns else count,
Area: sum if Area in df.columns else count
}).reset_index()

summary.columns = [IFCType, Count, TotalVolume, Total_Area]
return summary.sort_values(Count, ascending=False)

def getlevels(self, xlsxfile: str) -> pd.DataFrame:
获取建筑楼层摘要。
df = self.readelements(xlsxfile)

level_col = None
for col in [Level, BuildingStorey, IfcBuildingStorey]:
if col in df.columns:
level_col = col
break

if level_col is None:
return pd.DataFrame(columns=[Level, Element_

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 ifc-to-excel-1776345264 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 ifc-to-excel-1776345264 技能

通过命令行安装

skillhub install ifc-to-excel-1776345264

下载

⬇ 下载 ifc-to-excel" v2.0.0(免费)

文件大小: 6.65 KB | 发布时间: 2026-4-17 15:04

v2.0.0 最新 2026-4-17 15:04
Major update with new features and improved usability.

- Added support for IFC4x1 and IFC4x3 schemas, including full infrastructure alignment and latest standards.
- Enables export of 3D geometry to Collada DAE format alongside Excel, with matching element IDs for correlation.
- Introduced CLI options for selective export (Excel only, 3D only, include bounding boxes).
- Improved batch processing: convert multiple IFC files recursively from folders via command line or Python.
- Provided Python integration with a detailed API for conversion, reading, filtering, and summarizing results in Excel.
- Documentation overhaul with clear business use cases, CLI usage examples, and schema/entity reference.
返回顶部