← 返回 Skills 市场
datadrivenconstruction

Bim Qto

作者 datadrivenconstruction · GitHub ↗ · v2.1.0
win32 ⚠ suspicious
1328
总下载
0
收藏
3
当前安装
2
版本数
在 OpenClaw 中安装
/install bim-qto
功能描述
Extract quantities from BIM/CAD data for cost estimation. Group by type, level, zone. Generate QTO reports.
使用说明 (SKILL.md)

\r

BIM Quantity Takeoff\r

\r

Overview\r

Quantity Takeoff (QTO) extracts measurable quantities from BIM models. This skill processes BIM exports to generate grouped quantity reports for cost estimation.\r \r

Python Implementation\r

\r

import pandas as pd\r
import numpy as np\r
from typing import Dict, Any, List, Optional, Tuple\r
from dataclasses import dataclass, field\r
from enum import Enum\r
\r
\r
class QTOUnit(Enum):\r
    """Quantity takeoff measurement units."""\r
    COUNT = "ea"\r
    LENGTH = "m"\r
    AREA = "m2"\r
    VOLUME = "m3"\r
    WEIGHT = "kg"\r
    LINEAR_FOOT = "lf"\r
    SQUARE_FOOT = "sf"\r
    CUBIC_YARD = "cy"\r
\r
\r
@dataclass\r
class QTOItem:\r
    """Single QTO line item."""\r
    category: str\r
    type_name: str\r
    description: str\r
    quantity: float\r
    unit: str\r
    level: Optional[str] = None\r
    material: Optional[str] = None\r
    element_count: int = 0\r
\r
\r
@dataclass\r
class QTOReport:\r
    """Complete QTO report."""\r
    project_name: str\r
    items: List[QTOItem]\r
    total_elements: int\r
    categories: int\r
    generated_date: str\r
\r
\r
class BIMQuantityTakeoff:\r
    """Extract quantities from BIM data."""\r
\r
    # Column mappings for different BIM exports\r
    COLUMN_MAPPINGS = {\r
        'type': ['Type Name', 'TypeName', 'type_name', 'Family and Type', 'IfcType'],\r
        'category': ['Category', 'category', 'IfcClass', 'Element Category'],\r
        'level': ['Level', 'level', 'Building Storey', 'BuildingStorey', 'Floor'],\r
        'volume': ['Volume', 'volume', 'Volume (m³)', 'Qty_Volume'],\r
        'area': ['Area', 'area', 'Surface Area', 'Area (m²)', 'Qty_Area'],\r
        'length': ['Length', 'length', 'Length (m)', 'Qty_Length'],\r
        'count': ['Count', 'count', 'Quantity', 'ElementCount'],\r
        'material': ['Material', 'material', 'Structural Material', 'MaterialName']\r
    }\r
\r
    def __init__(self, df: pd.DataFrame):\r
        """Initialize with BIM data DataFrame."""\r
        self.df = df\r
        self.column_map = self._detect_columns()\r
\r
    def _detect_columns(self) -> Dict[str, str]:\r
        """Detect which columns exist in data."""\r
        mapping = {}\r
\r
        for standard, variants in self.COLUMN_MAPPINGS.items():\r
            for variant in variants:\r
                if variant in self.df.columns:\r
                    mapping[standard] = variant\r
                    break\r
\r
        return mapping\r
\r
    def get_column(self, standard_name: str) -> Optional[str]:\r
        """Get actual column name from standard name."""\r
        return self.column_map.get(standard_name)\r
\r
    def group_by_type(self, sum_column: str = 'volume') -> pd.DataFrame:\r
        """Group quantities by type name."""\r
\r
        type_col = self.get_column('type')\r
        qty_col = self.get_column(sum_column)\r
\r
        if type_col is None:\r
            raise ValueError("Type column not found")\r
\r
        if qty_col is None:\r
            # Fall back to count\r
            result = self.df.groupby(type_col).size().reset_index(name='count')\r
        else:\r
            result = self.df.groupby(type_col).agg({\r
                qty_col: 'sum'\r
            }).reset_index()\r
            result['count'] = self.df.groupby(type_col).size().values\r
\r
        result.columns = ['Type', 'Quantity', 'Count'] if len(result.columns) == 3 else ['Type', 'Count']\r
        return result.sort_values('Count', ascending=False)\r
\r
    def group_by_category(self, sum_column: str = 'volume') -> pd.DataFrame:\r
        """Group quantities by category."""\r
\r
        cat_col = self.get_column('category')\r
        qty_col = self.get_column(sum_column)\r
\r
        if cat_col is None:\r
            raise ValueError("Category column not found")\r
\r
        agg_dict = {}\r
        if qty_col:\r
            agg_dict[qty_col] = 'sum'\r
\r
        if agg_dict:\r
            result = self.df.groupby(cat_col).agg(agg_dict).reset_index()\r
            result['count'] = self.df.groupby(cat_col).size().values\r
        else:\r
            result = self.df.groupby(cat_col).size().reset_index(name='count')\r
\r
        return result.sort_values('count', ascending=False)\r
\r
    def group_by_level(self, sum_column: str = 'volume') -> pd.DataFrame:\r
        """Group quantities by building level."""\r
\r
        level_col = self.get_column('level')\r
        qty_col = self.get_column(sum_column)\r
\r
        if level_col is None:\r
            raise ValueError("Level column not found")\r
\r
        agg_dict = {}\r
        if qty_col:\r
            agg_dict[qty_col] = 'sum'\r
\r
        if agg_dict:\r
            result = self.df.groupby(level_col).agg(agg_dict).reset_index()\r
            result['count'] = self.df.groupby(level_col).size().values\r
        else:\r
            result = self.df.groupby(level_col).size().reset_index(name='count')\r
\r
        return result\r
\r
    def pivot_by_level_and_type(self) -> pd.DataFrame:\r
        """Create pivot table: levels as rows, types as columns."""\r
\r
        level_col = self.get_column('level')\r
        type_col = self.get_column('type')\r
\r
        if level_col is None or type_col is None:\r
            raise ValueError("Level or Type column not found")\r
\r
        pivot = pd.crosstab(\r
            self.df[level_col],\r
            self.df[type_col],\r
            margins=True\r
        )\r
\r
        return pivot\r
\r
    def filter_by_category(self, categories: List[str]) -> 'BIMQuantityTakeoff':\r
        """Filter to specific categories."""\r
\r
        cat_col = self.get_column('category')\r
        if cat_col is None:\r
            raise ValueError("Category column not found")\r
\r
        filtered_df = self.df[self.df[cat_col].isin(categories)]\r
        return BIMQuantityTakeoff(filtered_df)\r
\r
    def filter_by_level(self, levels: List[str]) -> 'BIMQuantityTakeoff':\r
        """Filter to specific levels."""\r
\r
        level_col = self.get_column('level')\r
        if level_col is None:\r
            raise ValueError("Level column not found")\r
\r
        filtered_df = self.df[self.df[level_col].isin(levels)]\r
        return BIMQuantityTakeoff(filtered_df)\r
\r
    def get_walls(self) -> pd.DataFrame:\r
        """Get wall quantities."""\r
        cat_col = self.get_column('category')\r
        if cat_col:\r
            walls = self.df[self.df[cat_col].str.contains('Wall', case=False, na=False)]\r
            return BIMQuantityTakeoff(walls).group_by_type()\r
        return pd.DataFrame()\r
\r
    def get_floors(self) -> pd.DataFrame:\r
        """Get floor/slab quantities."""\r
        cat_col = self.get_column('category')\r
        if cat_col:\r
            floors = self.df[self.df[cat_col].str.contains('Floor|Slab', case=False, na=False)]\r
            return BIMQuantityTakeoff(floors).group_by_type()\r
        return pd.DataFrame()\r
\r
    def get_doors(self) -> pd.DataFrame:\r
        """Get door quantities."""\r
        cat_col = self.get_column('category')\r
        if cat_col:\r
            doors = self.df[self.df[cat_col].str.contains('Door', case=False, na=False)]\r
            return BIMQuantityTakeoff(doors).group_by_type()\r
        return pd.DataFrame()\r
\r
    def get_windows(self) -> pd.DataFrame:\r
        """Get window quantities."""\r
        cat_col = self.get_column('category')\r
        if cat_col:\r
            windows = self.df[self.df[cat_col].str.contains('Window', case=False, na=False)]\r
            return BIMQuantityTakeoff(windows).group_by_type()\r
        return pd.DataFrame()\r
\r
    def generate_report(self, project_name: str = "Project") -> QTOReport:\r
        """Generate complete QTO report."""\r
\r
        from datetime import datetime\r
\r
        items = []\r
        type_col = self.get_column('type')\r
        cat_col = self.get_column('category')\r
        level_col = self.get_column('level')\r
        vol_col = self.get_column('volume')\r
        area_col = self.get_column('area')\r
        mat_col = self.get_column('material')\r
\r
        # Group by type\r
        grouped = self.df.groupby(type_col if type_col else self.df.columns[0])\r
\r
        for type_name, group in grouped:\r
            # Determine primary quantity\r
            qty = 0\r
            unit = QTOUnit.COUNT.value\r
\r
            if vol_col and vol_col in group.columns:\r
                qty = group[vol_col].sum()\r
                unit = QTOUnit.VOLUME.value\r
            elif area_col and area_col in group.columns:\r
                qty = group[area_col].sum()\r
                unit = QTOUnit.AREA.value\r
            else:\r
                qty = len(group)\r
                unit = QTOUnit.COUNT.value\r
\r
            # Get category and material\r
            category = group[cat_col].iloc[0] if cat_col and cat_col in group.columns else ""\r
            material = group[mat_col].iloc[0] if mat_col and mat_col in group.columns else ""\r
            level = group[level_col].iloc[0] if level_col and level_col in group.columns else ""\r
\r
            items.append(QTOItem(\r
                category=str(category),\r
                type_name=str(type_name),\r
                description=str(type_name),\r
                quantity=round(qty, 2),\r
                unit=unit,\r
                level=str(level) if level else None,\r
                material=str(material) if material else None,\r
                element_count=len(group)\r
            ))\r
\r
        return QTOReport(\r
            project_name=project_name,\r
            items=items,\r
            total_elements=len(self.df),\r
            categories=self.df[cat_col].nunique() if cat_col else 0,\r
            generated_date=datetime.now().isoformat()\r
        )\r
\r
    def to_excel(self, output_path: str, project_name: str = "Project"):\r
        """Export QTO to Excel with multiple sheets."""\r
\r
        with pd.ExcelWriter(output_path, engine='openpyxl') as writer:\r
            # Summary by category\r
            self.group_by_category().to_excel(\r
                writer, sheet_name='By Category', index=False)\r
\r
            # Summary by type\r
            self.group_by_type().to_excel(\r
                writer, sheet_name='By Type', index=False)\r
\r
            # Level breakdown\r
            try:\r
                self.pivot_by_level_and_type().to_excel(\r
                    writer, sheet_name='Level-Type Matrix')\r
            except:\r
                pass\r
\r
            # Walls\r
            walls = self.get_walls()\r
            if not walls.empty:\r
                walls.to_excel(writer, sheet_name='Walls', index=False)\r
\r
            # Doors and Windows\r
            doors = self.get_doors()\r
            if not doors.empty:\r
                doors.to_excel(writer, sheet_name='Doors', index=False)\r
\r
            windows = self.get_windows()\r
            if not windows.empty:\r
                windows.to_excel(writer, sheet_name='Windows', index=False)\r
\r
        return output_path\r
```\r
\r
## Quick Start\r
\r
```python\r
# Load BIM export\r
df = pd.read_excel("revit_export.xlsx")\r
\r
# Initialize QTO\r
qto = BIMQuantityTakeoff(df)\r
\r
# Get quantities by type\r
by_type = qto.group_by_type()\r
print(by_type.head(10))\r
\r
# Get wall schedule\r
walls = qto.get_walls()\r
print(walls)\r
```\r
\r
## Common Use Cases\r
\r
### 1. Full QTO Report\r
```python\r
qto = BIMQuantityTakeoff(df)\r
report = qto.generate_report("Office Building")\r
print(f"Elements: {report.total_elements}")\r
for item in report.items[:5]:\r
    print(f"{item.type_name}: {item.quantity} {item.unit}")\r
```\r
\r
### 2. Level-by-Level Analysis\r
```python\r
pivot = qto.pivot_by_level_and_type()\r
print(pivot)\r
```\r
\r
### 3. Export to Excel\r
```python\r
qto.to_excel("qto_report.xlsx", "My Project")\r
```\r
\r
## Resources\r
- **DDC Book**: Chapter 3.2 - Quantity Take-Off\r
安全使用建议
This skill appears to implement the QTO logic but has gaps you should resolve before installing. Specifically: - It requires python3 but the provided code imports pandas/numpy (and likely Excel libraries) without declaring or installing them — ensure the runtime environment has these packages or ask the author for an install spec. - The manifest grants filesystem access (needed to read user files). Only supply files you trust and run the skill in an isolated environment if you have sensitive files. - Confirm there are no network calls or hidden endpoints in the remainder of SKILL.md (the provided fragment is code-only and local, but review the full file). - Prefer a skill that lists its Python package dependencies or provides an installation step (pip/venv) and that documents where output files are written. If you can't verify these, run the skill in a sandboxed/ephemeral environment or request the author to add explicit dependency and execution instructions.
功能分析
Type: OpenClaw Skill Name: bim-qto Version: 2.1.0 The skill is designed for BIM quantity takeoff, processing data from and exporting reports to Excel files. The declared 'filesystem' permission in `claw.json` is justified by the use of `pandas.read_excel` and `to_excel` methods in `SKILL.md`. The Python code does not contain any direct malicious constructs like `os.system`, `subprocess`, network calls for exfiltration, or obfuscation. Neither `SKILL.md` nor `instructions.md` contain prompt injection attempts or instructions for the AI agent to perform unauthorized actions. While a lack of input sanitization by the OpenClaw agent for file paths could lead to a path traversal vulnerability, the skill's code itself does not exhibit malicious intent, only legitimate file operations.
能力评估
Purpose & Capability
Name/description, Windows-only restriction, and requirement of python3 align with a BIM QTO tool. Filesystem access in claw.json is reasonable for reading user-provided model exports.
Instruction Scope
SKILL.md contains detailed Python code and instructs the agent to 'process data using methods described in SKILL.md' and to accept user file paths (CSV/Excel/JSON). That scope is appropriate for the task, but the instructions assume the agent will execute Python code without describing how to run it or how to obtain Python libraries.
Install Mechanism
There is no install spec (instruction-only), which is low risk by itself, but the included Python code imports pandas/numpy (and likely other libraries for Excel handling) while the manifest only requires 'python3'. Missing declared Python package dependencies / install steps is an incoherence that will break runtime or force the agent to install packages on the fly.
Credentials
The skill requests no environment variables or external credentials. Filesystem permission is present in claw.json, which is proportional for a tool that reads user-provided files. No evidence of requests for unrelated secrets or external services.
Persistence & Privilege
always is false and the skill is user-invocable. It does request filesystem access (manifest), but it does not request permanent inclusion or system-wide changes. No evidence it modifies other skills or system configs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install bim-qto
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /bim-qto 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.1.0
- Added comprehensive Python implementation for extracting and grouping quantities from BIM/CAD data. - Introduced data classes (`QTOItem`, `QTOReport`) for structured output of quantity takeoff results. - Implemented flexible column mapping to support various BIM export formats. - Enabled grouping and filtering of quantities by type, category, and level, with additional methods for walls, floors, doors, and windows. - Added report generation to output complete QTO summaries for cost estimation.
v1.0.0
Initial release of BIM QTO. - Extracts measurable quantities from BIM/CAD exports for cost estimation. - Groups quantities by type, level, or category. - Supports flexible column mapping for various BIM data formats. - Provides detailed QTO reports, including walls, floors, doors, and windows. - Offers Python API for grouping, filtering, and pivoting quantity data.
元数据
Slug bim-qto
版本 2.1.0
许可证
累计安装 3
当前安装数 3
历史版本数 2
常见问题

Bim Qto 是什么?

Extract quantities from BIM/CAD data for cost estimation. Group by type, level, zone. Generate QTO reports. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1328 次。

如何安装 Bim Qto?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install bim-qto」即可一键安装,无需额外配置。

Bim Qto 是免费的吗?

是的,Bim Qto 完全免费(开源免费),可自由下载、安装和使用。

Bim Qto 支持哪些平台?

Bim Qto 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(win32)。

谁开发了 Bim Qto?

由 datadrivenconstruction(@datadrivenconstruction)开发并维护,当前版本 v2.1.0。

💬 留言讨论